React Native 入门系列(瘸腿走路状态)

react

React Native 也太容易跳错了吧哭死 现在看见红屏就想一头撞死在手机上

react-navigation碰到的跳错

  1. 死活找不到StackNavigation
    看react-navigation的状态应该是改成createStackNavigator了,但是props的写法没变

  2. undefined is not an object (evaluating ‘RNGestureHandlerModule.State’)
    参考https://stackoverflow.com/questions/52861437/undefined-is-not-an-object-evaluating-rngesturehandlermodule-state
    意思应该是说还要再npm install RNGestureHandlerModule然后link一下

  3. Invarient Violation:The navigation prop is missing for the navigator.In react-navigation 3 you must set up your app container directly.
    参考http://www.cnblogs.com/wuvkcyan/p/10011012.html
    官方文档上这样讲的Containers are responsible for managing your app state and linking your top-level navigator to the app environment.
    意思大概是要把navigator绑在app环境里,不能光export App.js而是先createAppContainer才能显示出来

稍微记一下下Navigation的练习过程

建立AppNavigators并通过如createStackNavigator建立stack等navigator,引入要create的各个screen

把top-level navigator放入appcontainer中

以上是 React Native 入门系列(瘸腿走路状态) 的全部内容, 来源链接: utcz.com/z/384134.html

回到顶部