Fixed bootstrap link

This commit is contained in:
Lallo Vigil
2018-10-16 22:24:02 -05:00
committed by Kristofer Koishigawa
parent 80918b962a
commit 018f941277

View File

@ -1,6 +1,7 @@
--- ---
title: Styling title: Styling
--- ---
## React Native - Styling ## React Native - Styling
React Native provides an API for creating stylesheets and styling your components: [StyleSheet](https://facebook.github.io/react-native/docs/stylesheet). React Native provides an API for creating stylesheets and styling your components: [StyleSheet](https://facebook.github.io/react-native/docs/stylesheet).
@ -10,7 +11,7 @@ import React, { Component } from 'react';
import { StyleSheet, View, Text } from 'react-native'; import { StyleSheet, View, Text } from 'react-native';
export default class App extends Component { export default class App extends Component {
render () { render() {
return ( return (
<View> <View>
<Text style={styles.header}>I am a header!</Text> <Text style={styles.header}>I am a header!</Text>
@ -22,11 +23,11 @@ export default class App extends Component {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
header: { header: {
fontSize: 20 fontSize: 20,
}, },
text: { text: {
color: 'blue' color: 'blue',
} },
}); });
``` ```
@ -40,7 +41,7 @@ Styles are also not inherited as they are in traditional CSS. In most cases, you
React Native uses an implementation of [flexbox](https://facebook.github.io/react-native/docs/flexbox) similar to the web standard. By default, items in the view will be set to `display: flex`. React Native uses an implementation of [flexbox](https://facebook.github.io/react-native/docs/flexbox) similar to the web standard. By default, items in the view will be set to `display: flex`.
> If you do not want to use flexbox, you can also arrange React Native components via `relative` or `absolute` positioning. > If you do not want to use flexbox, you can also arrange React Native components via `relative` or `absolute` positioning.
Flexbox in React Native defaults to `flexDirection: column`, instead of `flex-direction: row` (web standard). The `column` value displays flexible items vertically, which accommodates mobile devices in portrait orientation. Flexbox in React Native defaults to `flexDirection: column`, instead of `flex-direction: row` (web standard). The `column` value displays flexible items vertically, which accommodates mobile devices in portrait orientation.
@ -60,9 +61,7 @@ const Button = ({ onPress, children }) => {
const { buttonStyle, textStyle } = styles; const { buttonStyle, textStyle } = styles;
return ( return (
<TouchableOpacity onPress={onPress} style={buttonStyle}> <TouchableOpacity onPress={onPress} style={buttonStyle}>
<Text style={textStyle}> <Text style={textStyle}>{children}</Text>
{children}
</Text>
</TouchableOpacity> </TouchableOpacity>
); );
}; };
@ -76,7 +75,7 @@ const styles = {
fontSize: 16, fontSize: 16,
fontWeight: '600', fontWeight: '600',
paddingTop: 10, paddingTop: 10,
paddingBottom: 10 paddingBottom: 10,
}, },
buttonStyle: { buttonStyle: {
backgroundColor: '#fff', backgroundColor: '#fff',
@ -87,8 +86,8 @@ const styles = {
paddingRight: 25, paddingRight: 25,
paddingLeft: 25, paddingLeft: 25,
marginTop: 10, marginTop: 10,
width: 300 width: 300,
} },
}; };
``` ```
@ -103,8 +102,8 @@ export default class Login extends Component {
render() { render() {
return ( return (
<View> <View>
<TextInput placeholder='Username or Email' /> <TextInput placeholder="Username or Email" />
<TextInput placeholder='Password' /> <TextInput placeholder="Password" />
<Button>Log In</Button> <Button>Log In</Button>
</View> </View>
); );
@ -114,4 +113,4 @@ export default class Login extends Component {
### Libraries for Styling ### Libraries for Styling
There are a few popular libraries for styling React Native. Some of them provide features similar to [Bootstrap](../../bootstrap/index.md), including default forms, button styles, and page layout options. One of the most popular libraries is [styled-components](https://github.com/styled-components/styled-components). There are many others you can find on npm and GitHub to try for yourself. There are a few popular libraries for styling React Native. Some of them provide features similar to [Bootstrap](../../bootstrap), including default forms, button styles, and page layout options. One of the most popular libraries is [styled-components](https://github.com/styled-components/styled-components). There are many others you can find on npm and GitHub to try for yourself.