2017-12-20 20 views
3

enter image description hereTypeError例外:未定義( '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のすべての機能をインストールしましたが、デバイスでアプリケーションを実行しようとするたびにエラーが発生しました。引き出しコンポーネント以外のすべてのナビゲーションは正常に動作します。

答えて

3

これは、依存関係のバグです:[email protected]

試してみてください。

npm uninstall react-navigation && npm install [email protected] 

その問題は既に知られている:https://github.com/aksonov/react-native-router-flux/issues/2718

+0

ありがとうございます!これは私のためにうまく動作します。しかし、私は依存関係に関する質問があります。新しい反応ネイティブアプリを作成した後、この解決策が必要ですか? –

+0

あなたが[email protected]^4.0で作業している場合...この問題が修正されるまでこの手順が必要です。 –

0

は、このコマンドを実行してみてください:

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

drawerOpenRoute: 'DrawerOpen'、 drawerCloseRouteは: 'DrawerClose'、 drawerToggleRoute: 'DrawerToggle' DrawerNavigatorには私の問題を解決しました。試してみる。

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