未定义不是对象(评估RNGestureHandlerModule.State)

时间:2018-11-19 10:56:39

标签: reactjs react-native react-navigation

我正在尝试创建一个堆栈导航器,它给了我上面提到的错误。我的代码如下

 import React, {Component} from 'react';
 import { createStore, applyMiddleware, compose } from 'redux';
 import NavigationService from './Utils/NavigationService'
 import { Provider } from 'react-redux';
 import thunk from 'redux-thunk';
 import { createStackNavigator, createSwitchNavigator } from 'react-navigation'; 
 import Stat from './App/statsScreen'
 import Sec from './App/loginScreen'


const RootStack = createStackNavigator(
  {
   Home: Stat,
   Details: Sec
  },
  {
    initialRouteName: "Details"
  }
 );

const AppNavigator = createSwitchNavigator(
 {

  App: RootStack,

 }, {
 initialRouteName: 'App'
 }
);

export const store = (__DEV__) ? createStore(rootReducer, compose(applyMiddleware(thunk), window.devToolsExtension ? window.devToolsExtension() : f => f)) : createStore(rootReducer, applyMiddleware(thunk));

export default class App extends React.Component {

 render() {
   return (
    <Provider store={store}>
     <AppNavigator
      ref={navigatorRef => {
        NavigationService.setTopLevelNavigator(navigatorRef);
      }}
     />
    </Provider>
   );
 }

}

但是,如果我注释“ createStackNavigator”部分并导出常规类,则它可以工作。我在这里想念什么?并用这段代码为什么会令我出错呢?

0 个答案:

没有答案