1. 程式人生 > >React Native 入門系列(瘸腿走路狀態)

React Native 入門系列(瘸腿走路狀態)

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中
跑