如何将状态值从一个屏幕发送到另一个屏幕

How to send the state values from one screen to another screen

我不知道如何将值从一个屏幕发送到另一个屏幕,

这是我的代码

<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>

试试这个

发送值

this.props.navigation.navigate(
                             "cart",{
                                     food: this.state.item,
                                     amount: this.state.ruppes
                                     }
                               );

在下一个屏幕上获取值

const food = this.props.navigation.getParam("food", "");
const amount = this.props.navigation.getParam("amount", "");