美文网首页
TypeError: undefined is not an o

TypeError: undefined is not an o

作者: sunny635533 | 来源:发表于2022-03-23 14:47 被阅读0次

    使用react-navigation库遇到:
    TypeError: undefined is not an object (evaluating '_this.view._component.measureInWindow')

    找了很久没找到原因,上网查才知道:必须要设置第一个页面默认的navigationOptions = { header: null };

    const MyApp = createStackNavigator(
                    {
                        PrivacyPolicy: {
                            screen: PrivacyPolicyPage,
                            navigationOptions: ({ navigation }) => ({
                                header: null
                            })
                        },
                        HomeGroup: {
                            screen: HomeGroupPage,
                            navigationOptions: ({ navigation }) => ({
                                header: null
                            })
                        },
                        HomeArea: {
                            screen: HomeAreaPage
                        },
                        HomeManager: {
                            screen: HomeManagerPage
                        },
                        HomeStaff: {
                            screen: HomeStaffPage
                        },
                        Settings: {
                            screen: DrawerPage
                        },
                    },
    )
    

    发现如果使用drawer还是报错,继续参考:https://github.com/react-navigation/react-native-safe-area-view/issues/118

    image.png

    亲测,可以了!

    相关文章

      网友评论

          本文标题:TypeError: undefined is not an o

          本文链接:https://www.haomeiwen.com/subject/aqicjrtx.html