react-navigation undefined 不是一个函数(正在评估'(0 _reactnavigation.StackNavigator)')
2018-12-09
10157
3个回答
半个月前我就放弃了。
然而,今天它却没有任何变化,没有任何依赖刷新,就可以正常工作!
所以,我想它可能需要 重启电脑 。WTF。
BaiJiFeiLong
2019-07-09
我认为你正确安装了 react-navigation。
npm install --save react-navigation
试试这个:
import { createStackNavigator } from 'react-navigation';
import Intro from './src/pages/Intro';
const AppNavigator = createStackNavigator({
Intro: {
screen: Intro,
navigationOptions: {
title: "Intro",
header: null,
navigationBar: null
},
},
});
export default class App extends Component {
render() {
return (
<AppNavigator />
);
}
}
kivul
2018-12-09
已安装导航:
npm install --save react-navigation
npm install --save react-native-gesture-handler
react-native link
尝试此
App.js
:
import React, { Component } from 'react';
import {createStackNavigator, createAppContainer} from 'react-navigation';
import Home from './screens/Home';
import Settings from './screens/Settings';
const AppNavigator = createStackNavigator({
HomeScreen: {
screen: Home,
},
SettingScreen: {
screen: Settings,
},
});
const App = createAppContainer(AppNavigator);
export default App;
DaoLQ
2018-12-15