我正在使用反应导航。我以模态形式展示了Stack Navigator。现在要退出堆栈,我需要将呼叫传递回导航器屏幕。
我该如何实现?
示例
const ExampleStack = createStackNavigator({
Payment: {
screen: PaymentScreen
},
ManageAddress: {
screen: ManageAddressScreen,
}
})
const modal = <Modal
animationType="fade"
transparent={true}
visible={this.state.showPaymentSheet}
>
<ExampleStack onCancel={()=> this.setState({ showPaymentSheet:false })}/>
</Modal>
// Now i need to call onCancel from PaymentScreen