Pass data through an Input,
import React, { Component } from 'react';
import { Text, View, TextInput, TouchableOpacity } from 'react-native';
import { Actions } from 'react-native-router-flux';
export default class Com1 extends Component {
state = { text: '' };
render() {
return (
<View>
<TextInput
value={this.state.text}
onChangeText={text => this.setState({ text })}
/>
<TouchableOpacity onPress={this.onPressNext.bind(this)}>
<Text>Get Data</Text>
</TouchableOpacity>
</View>
);
}
onPressNext() {
Actions.Com2({text: this.state.text });
}
}
To get value in the second Page
export default class Com2 extends Component {
render() {
return (
<View>
<Text>
{this.props.text}
</Text>
</View>
);
}
}
You can refer to this link:
https://react-native-solutions.blogspot.com/2018/07/passing-data-between-screens-in-react.html