每个人,我都在尝试创建简单的抽屉式导航,但是似乎无法识别createAppContainer在屏幕上显示此错误消息“(0,_reactNavigation.createAppContainer)不是函数。
(In '(0, _reactNavigation.createAppContainer)(navigator)', '(0, _reactNavigation.createAppContainer)' is undefined)
<unknown>
App.js:46:34
loadModuleImplementation
require.js:331:6
<unknown>
index.js:7
loadModuleImplementation
require.js:331:6
guardedLoadModule
require.js:197:45
global code
<unknown file>:0
"
我尝试注释掉某些行并在Google上搜索,但没有结果
import * as React from 'react';
import { Text, View, Image, ScrollView, StyleSheet } from 'react-native';
import {
createDrawerNavigator,
createAppContainer,
DrawerItems,
SafeAreaView,
} from 'react-navigation';
class Home extends React.Component {
static navigationOptions = {
title: 'Home',
};
render() {
return (
<View style={styles.container}>
</View>
);
}
}
const navigator = createDrawerNavigator(
{
Home,
},
{
// drawerType: 'back',
// drawerPosition: 'right',
// drawerWidth: 200,
// drawerBackgroundColor: 'orange',
}
);
export default createAppContainer(navigator);
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
backgroundColor: '#ecf0f1',
padding: 8,
}
});