Created
May 7, 2018 08:56
-
-
Save YuanLiou/805edf28afda2c5e9b2fc592a4053005 to your computer and use it in GitHub Desktop.
First Try React Native
This file contains hidden or 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
import React from 'react'; | |
import { StyleSheet, Text, Image, View } from 'react-native'; | |
export default class App extends React.Component { | |
render() { | |
return ( | |
<View style={{alignItems: 'center', marginTop: 250}} > | |
<Greeting name="Denkeni" relationship="Boss" /> | |
<Greeting name="Joan" relationship="Classmate" /> | |
<Greeting name="Billy" relationship="Roommate" /> | |
</View> | |
); | |
} | |
} | |
class Greeting extends React.Component { | |
render() { | |
return ( | |
<Text style={styles.container} > Hello {this.props.name}! {'\n'} I'm your {this.props.relationship}!? </Text> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
lineHeight: 30, | |
textAlign: 'center' | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment