React Native + Reduxでは、私はリアクションネイティブドロワーhttps://github.com/root-two/react-native-drawerを持っていますが、NavigationExperimental
、より具体的にはNavigationCardStack
を使用してナビゲーションボタンを実装しようとしています。だから私は引き出しに3つのボタンを作成し、それらの間をナビゲートしようとするとエラーが発生します:ProfilePage
ボタンを押してからHomePage
ボタンを押した後にもう一度ProfilePage
を押すとエラーになります)React Native:NavigationExperimentalを使用してReact Native Drawerのナビゲーションを正しく実装するにはどうすればよいですか?
何が問題なのですか?私は正しくナビゲートしていますか?そうでない場合は、React Native Drawerのナビゲーションボタンを使用してシーン間をナビゲートする適切な方法は何ですか?ここで
は私のセットがアップしている:リアクトネイティブ引き出しのナビゲーションボタンの押しに_handleNavigate(route)
を使用して
_renderScene (props) {
const { route } = props.scene
return (
<route.component _handleNavigate={this._handleNavigate} actions={this.props}/>
)
}
_handleBackAction() {
if (this.props.navigation.index === 0) {
return false
}
this.props.popRoute()
return true
}
_handleNavigate(action) {
switch (action && action.type) {
case 'push':
this.props.pushRoute(action.route)
return true
case 'back':
case 'pop':
return this._handleBackAction()
default:
return false
}
}
<Drawer
content={<DrawerPanel {...this.props} _handleNavigate={this._handleNavigate}/>}
openDrawerOffset={100}
ref={(ref) => this._drawer = ref}
type='static'
tweenHandler={Drawer.tweenPresets.parallax}
tapToClose
acceptPan
negotiatePan
>
<NavigationCardStack
direction='horizontal'
navigationState={this.props.navigation}
onNavigate={this._handleNavigate}
renderScene={this._renderScene}
/>
</Drawer>
、これはroute
がフォーマットされる方法である:
const route = {
group: {
type: 'push',
route: {
key: 'profilepage',
title: 'ProfilePage',
component: ProfilePage,
direction: 'horizontal',
},
}
}
そして、 .push
および.pop
は、naviReducer.js