Skip to content

Instantly share code, notes, and snippets.

@lrlineroa
Created July 3, 2019 22:58
Show Gist options
  • Save lrlineroa/f6521354049a58d6d517e8af0fe985bb to your computer and use it in GitHub Desktop.
Save lrlineroa/f6521354049a58d6d517e8af0fe985bb to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import { View, Text } from 'react-native';
import { Card, CardItem, Button, Item, Label, Input } from 'native-base';
class AddACard extends Component {
constructor(props) {
super(props);
this.state = {
cardValue: '',//<--- Nuevo
cards: [] //<--- Nuevo
}
}
//nuevo
handleInputText(value) {
this.setState({
cardValue: value
})
}
//nuevo
render() {
return (
<View style={{ padding: 10 }}>
<Card>
<CardItem header>
<Text>
Añade una tarjeta
</Text>
</CardItem>
<CardItem>
<Item floatingLabel>
<Label>Front</Label>
<Input
// nuevo
value={this.state.cardValue}
onChangeText={
(text)=>{
this.handleInputText(text)
}
}
//nuevo
/>
</Item>
</CardItem>
<CardItem footer>
<Button block light>
<Text>
Añadir
</Text>
</Button>
</CardItem>
</Card>
</View>
);
}
}
export default AddACard;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment