使用react-native-router-flux

时间:2018-11-20 16:00:39

标签: react-native react-native-ios react-native-router-flux

使用react-native-router-flux声明“抽屉”菜单时出现错误。

我正在使用该库中的4.0.6版本和React Native 0.57.5。

我的路由器如下:

<Router>
   <Scene key="root">
      <Scene key="drawer" drawer component={NavigationDrawer} open={false} direction="vertical">
         <Scene key="main">
            <Scene key="VirtualCard" hideNavBar={true} component={VirtualCard} panHandlers={null}/>
         </Scene>
      </Scene>
   </Scene>
</Router>

我的抽屉对象是:

export default class NavigationDrawer extends Component {

    render() {
        const state = this.props.navigationState;
        const children = state.children;

        return (
            <Drawer
                ref="navigation"
                open={state.open}
                onOpen={()=>Actions.refresh({key:state.key, open: true})}
                onClose={()=>Actions.refresh({key:state.key, open: false})}
                type="displace"
                content={<Menu />}
                tapToClose={true}
                openDrawerOffset={0.2}
                panCloseMask={0.2}
                panOpenMask={0.2}
                negotiatePan={true}
                acceptPan={true}
                tweenHandler={(ratio) => {
                    return {
                        mainOverlay: { opacity: ratio === 0 ? 0 : 0.3, backgroundColor: '#000' }
                    }
                }}
            >
              <DefaultRenderer navigationState={children[0]} onNavigate={this.props.onNavigate} />
            </Drawer>
        );
    }
}

我得到的错误是:

enter image description here

0 个答案:

没有答案