Created
July 3, 2019 22:58
-
-
Save lrlineroa/f6521354049a58d6d517e8af0fe985bb to your computer and use it in GitHub Desktop.
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, 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