Skip to content

Instantly share code, notes, and snippets.

@markthethomas
Created November 18, 2015 17:13
Show Gist options
  • Save markthethomas/b7e6837d320a798362fd to your computer and use it in GitHub Desktop.
Save markthethomas/b7e6837d320a798362fd to your computer and use it in GitHub Desktop.
react native quickstart part 2
'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