Created
February 24, 2017 01:07
-
-
Save samcorcos/c0d541639045e2df0b8ed2678d97dc8d to your computer and use it in GitHub Desktop.
React native local control
This file contains hidden or 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 from 'react' | |
import { View, TextInput, } from 'react-native' | |
export class Form extends React.PureComponent { | |
constructor(props) { | |
super(props) | |
this.state = { | |
input1: null, | |
input2: null, | |
} | |
} | |
handleChange(text, key) { | |
this.setState({ [key]: text, }) | |
} | |
render() { | |
return ( | |
<View> | |
<TextInput | |
style={{ paddingLeft: 10, height: 40, borderColor: 'gray', borderWidth: 1, }} | |
onChangeText={text => this.handleChange(text, 'input1')} /> | |
<TextInput | |
style={{ paddingLeft: 10, height: 40, borderColor: 'gray', borderWidth: 1, }} | |
onChangeText={text => this.handleChange(text, 'input2')} /> | |
</View> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment