Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class InputItem extends React.Component {
- state = {
- key: "",
- value: "",
- };
- onChange(key, value) {
- this.setState({
- [key]: value
- });
- this.props.onChange({
- ...this.state,
- [key]: value
- }, this.props.index);
- };
- render() {
- return (
- <View style={{
- display: 'flex',
- marginBottom: 10,
- flexDirection: 'row'
- }}>
- <TextInput
- style={{
- height: 40,
- borderColor: "gray",
- borderWidth: 1,
- flex: 1,
- marginRight: 5
- }}
- onChangeText={value => this.onChange('key', value)}
- value={this.state.text}
- />
- <TextInput
- style={{
- height: 40,
- borderColor: "gray",
- borderWidth: 1,
- flex: 1,
- }}
- onChangeText={value => this.onChange('value', value)}
- value={this.state.text}
- />
- </View>
- );
- }
- }
Add Comment
Please, Sign In to add comment