1. 程式人生 > >React Native undefined is not an object (evaluating 'RNGestureHandlerModule.State')

React Native undefined is not an object (evaluating 'RNGestureHandlerModule.State')

前言:

  1. 當使用RN開發跨平臺app時,使用的元件(如,react-navigation...),這個元件可能是需要連結原生庫的。就是說要使用react-native  link
  2. 如使用到需要連結原生庫,而沒有 react-native link,執行時報:undefined is not an object (evaluating 'RNGestureHandlerModule.State')

環境:

  1. Mac OSX
  2. Intellij IDEA
  3. Jdk 1.8x
  4. React-native-cli:2.0.1
  5. React-native:0.57.6 
  6. npm:6.4.1
  7. node:v11.2.0

Code:

當前專案根目錄下如下命令:

➜  react-native link

停止包管理伺服器(關閉命令視窗,或者ctrl + c),

重新執行專案:

➜  react-native run-ios

➜  react-native run-android

稍等片刻...

working for you?