I am new to react native. I am using this package https://www.npmjs.com/package/react-native-numeric-input .
My problem is how to get the value pass to the next page.
From using this code:
class FirstActivity extends Component {
static navigationOptions = {
title: 'Main Screen'
}
constructor(props) {
super(props)
this.state = {number: ''}
}
Send_Data_Function = () => { this.props.navigation.navigate('Second', { no: this.state.number, }); }
render() {
return (
<NumericInput value={this.state.value} onChange={value => this.setState({number : value})}
<TouchableOpacity activeOpacity={.4} style={styles.TouchableOpacityStyle} onPress={this.Send_Data_Function} >
<Text style={styles.TextStyle}> NEXT </Text>
</TouchableOpacity>/>
)}
class SecondActivity extends Component{
static navigationOptions =
{
title: "Second Activity"
};
render() {
return (
<View style= {styles.MainContainer}>
<Text style={styles.textStyle}>
1 = {this.props.navigation.state.params.no}
</Text>
</View>
)}
}
const AppNavigator = createStackNavigator({
First : {screen: FirstActivity},
Second : {screen: SecondActivity}
});
export default createAppContainer(AppNavigator);
How to get the result? Anyone can help me?