Last active
August 13, 2017 16:14
-
-
Save chuyihuang/8fce9d83c1c5eb08037ca5aa9dfa91a5 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 { 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