未定义不是函数('...(0 _reactnavigation.stacknavigator)...'附近)

时间:2019-08-30 12:26:38

标签: react-native

我已经通过Google帮助尝试了一切,请某人为我提供解决方案。

我已经尝试了每个答案的StackOverflow,但没有得到

这是我的route.js

import { StackNavigator } from 'react-navigation';
import Contacts from '../screens/Contacts';
import Details from '../screens/Details';

export const ContactsStack = StackNavigator({
Contacts: {
    screen: Contacts,
    navigationOptions: {
        title: 'Contacts',
    },
},
Details: {
    screen: Details,
    navigationOptions: {
        title: 'Details',
    },
},
});

这是index.js

import React from 'react';
import { ContactsStacks } from './config/router';

const App = () => {
   return <ContactsStacks />;
};

export default App;

package.json

"dependencies": {
"react": "16.8.6",
"react-native": "0.60.5",
"react-native-gesture-handler": "^1.4.1",
"react-native-reanimated": "^1.2.0",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "^3.12.1"
},

2 个答案:

答案 0 :(得分:0)

您不能像这样创建StackNavigator

请尝试以下代码:

import { createStackNavigator } from 'react-navigation';
import Contacts from '../screens/Contacts';
import Details from '../screens/Details';

export const ContactsStack = createStackNavigator({
Contacts: {
    screen: Contacts,
    navigationOptions:  ({ navigation }) => ({
      title: `Contacts`,
    }),
},
Details: {
    screen: Details,
    navigationOptions: ({ navigation }) => ({
      title: `Details`,
    }),
},
});

您真的是Google吗?

答案 1 :(得分:0)

您必须使用myplot + scale_x_discrete(labels = c("Ambystoma mexicanum" = "Ambystoma\nmexicanum") 而不是createStackNavigator

这是react-navigation 3.0中的更改

react-navigation stack navigator.