Just now I started using AsyncStorage. I tried storing input text value like this:
class Sample extends React.Component{
constructor(props){
super(props);
this.state = {
Name:' ',
};
}
componentDidMount() {
AsyncStorage.getItem("Name").then((value) =>{
this.setState({"Name":value})
}).done();
handleChange(e){
AsyncStorage.setItem("Name", e.nativeEvent.text)
this.setState({
email: e.nativeEvent.text
})
}
render(){
return(
<View>
<TextInput
style={styles.textContainer}
value={this.state.Name}
placeholder="Name"
onChange={this.handleChange.bind(this)}/>
</View>
)
}
For this it is working correctly, but i want to add a record into an array instead of changing the record every time. I want to push the record into an array and need to display the total array data in the view, (i.e) I need previously avilable data also.