小编Vic*_*ike的帖子

找不到变量:createDrawerNavigator

我正在尝试在我的应用中实现抽屉导航。我发现这个网站(https://reactnavigation.org/docs/en/drawer-based-navigation.html)给出了一个实现的代码示例,但是当我运行它时它说

找不到变量:createDrawerNavigator。

所以这意味着缺少导入。但是,我似乎无法为createDrawerNavigator. 想知道是否有人可以帮我解决这个问题!React Native 的新手。

class MyHomeScreen extends React.Component {
    static navigationOptions = {
        drawerLabel: 'Home',
        drawerIcon: ({
            tintColor
        }) => ( <
            Image source = {
                require('./chats-icon.png')
            }
            style = {
                [styles.icon, {
                    tintColor: tintColor
                }]
            }
            />
        ),
    };

    render() {
        return ( <
            Button onPress = {
                () => this.props.navigation.navigate('Notifications')
            }
            title = "Go to notifications" /
            >
        );
    }
}

class MyNotificationsScreen extends React.Component {
    static navigationOptions = {
        drawerLabel: 'Notifications', …
Run Code Online (Sandbox Code Playgroud)

navigation-drawer react-native

2
推荐指数
1
解决办法
3456
查看次数

标签 统计

navigation-drawer ×1

react-native ×1