TypeError: undefined is not an object (evaluating 'route.routeName')

TypeError: undefined is not an object (evaluating 'route.routeName')

这是我的代码:-

import React from 'react-native';
import { Router, Drawer, Scene } from 'react-native-router-flux';

import Scene1 from '../../scenes/Scene1';
import Dashboard from '../../scenes/Dashboard';
import Images from '../../assets/images';

import styles from './Styles';

const Routes = () => (
    <Router
        backAndroidHandler={() => Actions.pop()}
        sceneStyle={styles.sceneStyle}
    >
            <Scene key="root">
                <Scene
                    key="scene1"
                    component={Scene1}
                    title="Scene 1"
                    navigationBarStyle={styles.navigationBarStyle}
                    navBarButtonColor={styles.navBarButtonColor}
                    titleStyle={styles.titleStyle}
                    initial
                />
                <Drawer
                    hideNavBar
                    key="dashboard"
                    drawerImage={Images.menuIcon}
                    contentComponent={Navigation}
                    drawerWidth={styles.drawerWidth}
                >
                <Scene
                    key="dashboard"
                    component={Dashboard}
                    title={strings.dashboard}
                    navigationBarStyle={styles.navigationBarStyle}
                    navBarButtonColor={styles.navBarButtonColor}
                    titleStyle={styles.titleStyle}
                    renderRightButton={renderNotificationButton}
                    />
                </Drawer>
            </Scene>
    </Router>
);

export default Routes; 

我遇到了一个问题。每当我尝试在设备中使用 运行 应用程序时,我都会在节点模块中安装所有 npm 依赖项,但它会出错。除抽屉组件外,所有导航工作正常;

这是依赖中的错误:react-navigation@1.0.0-beta.22

尝试:

npm uninstall react-navigation && npm install react-navigation@1.0.0-beta.21

该问题已知:https://github.com/aksonov/react-native-router-flux/issues/2718

试试这个命令:

rm -rf $TMPDIR/react-* $TMPDIR/react-native-packagerache-* $TMPDIR/metro-bundler-cache-*&& watchman watch-del-all && npm cache clean --force && npm i && npm start

添加

drawerOpenRoute: 'DrawerOpen', 抽屉关闭路线:'DrawerClose', drawerToggleRoute:'DrawerToggle' DrawerNavigator 解决了我的问题。试试看。

const AppDrawer = DrawerNavigator({
HomeStack: {
        screen: AppStack
    }
},
{
    contentComponent: props => (<Sidebar {...props} />),
    drawerOpenRoute: 'DrawerOpen',
    drawerCloseRoute: 'DrawerClose',
    drawerToggleRoute: 'DrawerToggle'
});