Created
November 18, 2015 17:13
-
-
Save markthethomas/b7e6837d320a798362fd to your computer and use it in GitHub Desktop.
react native quickstart part 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const React = require('react-native'); | |
// We need to include the Image component type so we can use it | |
const { | |
AppRegistry, | |
StyleSheet, | |
Text, | |
Image, | |
View, | |
} = React; | |
const myProjectName = React.createClass({ | |
render: function() { | |
return ( | |
<View style={styles.container}> | |
<Text style={styles.welcome}> | |
Welcome to our cool new app! | |
</Text> | |
// Add the image! | |
<Image source={require('./assets/fall.jpg')} | |
style={{width: 200, height: 100}} /> | |
</View> | |
); | |
} | |
}); | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
backgroundColor: '#F5FCFF', | |
}, | |
welcome: { | |
fontSize: 20, | |
textAlign: 'center', | |
margin: 10, | |
}, | |
instructions: { | |
textAlign: 'center', | |
color: '#333333', | |
marginBottom: 5, | |
}, | |
}); | |
AppRegistry.registerComponent('myProjectName', () => myProjectName); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment