Created
August 13, 2017 03:37
-
-
Save chuyihuang/5653d6b26c986768a273181673806b47 to your computer and use it in GitHub Desktop.
React Native workshop #2 snippet
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
import React, { Component } from 'react'; | |
import { Text, View } from 'react-native'; | |
export default class App extends Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
return ( | |
<Child value="我是子元素" /> | |
); | |
} | |
} | |
const Child = (props) => { | |
return ( | |
<View style={{height: '100%', justifyContent: 'center', alignItems: 'center'}}> | |
<Text allowFontScaling={false}>{props.value}</Text> | |
</View> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment