Skip to content

Instantly share code, notes, and snippets.

@chuyihuang
Last active August 13, 2017 16:14
Show Gist options
  • Save chuyihuang/8fce9d83c1c5eb08037ca5aa9dfa91a5 to your computer and use it in GitHub Desktop.
Save chuyihuang/8fce9d83c1c5eb08037ca5aa9dfa91a5 to your computer and use it in GitHub Desktop.
React Native workshop #2 snippet
import React, { Component } from 'react';
import { View, TextInput } from 'react-native';
export default class App extends Component {
constructor(props) {
super(props);
console.log("constructor");
}
componentWillMount() {
console.log("component will mount");
}
componentDidMount() {
console.log("component did mount");
}
componentWillReceiveProps() {
console.log("component will receive props");
}
shouldComponentUpdate() {
console.log("should component update");
return true;
}
componentWillUpdate() {
console.log("component will update");
}
componentDidUpdate() {
console.log("component did update");
}
componentWillUnmount() {
console.log("component will unmount");
}
render() {
console.log("render");
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<TextInput style={{width: '80%', fontSize: 24}} />
</View>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment