April 2017
Intermediate to advanced
414 pages
8h 14m
English
An inline style is one that is defined within the markup of your code. Check this sample out:
class Tasks extends Component { render () { return ( <View style = {{ flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF' }}> <Text style = {{ fontSize: 20, textAlign: 'center', margin: 10 }}> Welcome to React Native! </Text> </View> ) } }
In the preceding code, you can see how inline style can create a very convoluted and confusing mess, especially when there are several style properties that we want to apply to each component. It's not practical for us to write our styles like this in a large-scale application, so let's break apart the styles into a StyleSheet object.
Read now
Unlock full access