Skip to content

Instantly share code, notes, and snippets.

@chuyihuang
Created August 13, 2017 03:37
Show Gist options
  • Save chuyihuang/5653d6b26c986768a273181673806b47 to your computer and use it in GitHub Desktop.
Save chuyihuang/5653d6b26c986768a273181673806b47 to your computer and use it in GitHub Desktop.
React Native workshop #2 snippet
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