Reputation: 123
I dont know how to send the value from one screen to another screen,
Here is my code
<TouchableOpacity
style={{
width:"100%",
height:"200%",
alignItems:'center',
justifyContent:'center',
backgroundColor:'green'
}}
onPress={() =>
this.props.navigation.navigate(
'cart',
{ food : this.state.item,
amount : this.state.ruppess
}
)
}>
<Text>Cart</Text>
</TouchableOpacity>
Upvotes: 0
Views: 54
Reputation: 516
Try this
to send the value
this.props.navigation.navigate(
"cart",{
food: this.state.item,
amount: this.state.ruppes
}
);
to get the value on next screen
const food = this.props.navigation.getParam("food", "");
const amount = this.props.navigation.getParam("amount", "");
Upvotes: 1