Skip to content

Instantly share code, notes, and snippets.

@YuanLiou
Created May 7, 2018 08:56
Show Gist options
  • Save YuanLiou/805edf28afda2c5e9b2fc592a4053005 to your computer and use it in GitHub Desktop.
Save YuanLiou/805edf28afda2c5e9b2fc592a4053005 to your computer and use it in GitHub Desktop.
First Try React Native
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