items in center in native
var styles = StyleSheet.create({ content:{ flex:1, flexDirection:'row', alignItems:'center', justifyContent:'center' }, … });
Here is what the above code is Doing:
1. We’re creating a new component called MyComponent
that extends Component
from the react-native
library.
2. We’re creating a new styles
object that contains a content
property.
3. We’re creating a new render
method that returns a View
component with a style
property that references the styles.content
property.
4. We’re exporting the MyComponent
component so that it can be used in other files.
Now, let’s create a new file called index.ios.js
in the MyProject
directory and add the following code: