【问题标题】:React Native Error: TypeError: null is not an object _RNGestureHandlerModule.default.DirectionReact Native 错误:TypeError:null 不是对象 _RNGestureHandlerModule.default.Direction
【发布时间】:2019-11-13 08:02:40
【问题描述】:

我尝试了很多方法来修复这个错误,但所有尝试都失败了。

  • 适用于 Android 而非 IOS。

_RNGestureHandlerModule.default.Direction

我正在尝试安卓系统。我发现错误 react-native-gesture-handler 购买我不知道如何修复它。

我正在一步一步地遵循这个指令https://reactnavigation.org/docs/en/getting-started.html

我尝试链接 react-native-gesture-handler 手册。并尝试取消链接。 我用代码制作了 react-native.config.js

exports = {
    dependencies: {
      'react-native-gesture-handler': {
        platforms: {
          android: null,
          ios: null,
        },
      },
    },
  };

我正在使用系统:

 OS: Linux 5.3 Arch Linux undefined
    CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
    Memory: 16.06 GB / 31.21 GB
    Shell: 5.0.11 - /bin/bash
  Binaries:
    Node: 12.13.0 - /usr/bin/node
    Yarn: 1.19.1 - /usr/bin/yarn
    npm: 6.12.1 - /usr/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.4 => 0.61.4 
  npmGlobalPackages:
    react-native-cli: 2.0.1

"react-navigation": "^2.18.2",
"react-navigation-stack": "^1.10.3"
  • 适用于 Android 而非 IOS。

_RNGestureHandlerModule.default.Direction I wrote about the bug react-native-gesture-handler Github

【问题讨论】:

  • 你在安装 react-native-gesture-handler 后是否尝试过'react-native link react-native-gesture-handler'
  • 安装后和安装前有什么不同?我在安装手势处理程序时尝试了链接
  • 您是否在 MainActivity 中添加了以下内容? : ``` @Override protected ReactActivityDelegate createReactActivityDelegate() { return new ReactActivityDelegate(this, getMainComponentName()) { @Override protected ReactRootView createRootView() { return new RNGestureHandlerEnabledRootView(MainActivity.this); } }; } ```
  • 是的,我试过了,但是没用

标签: android reactjs react-native react-native-android react-native-navigation


【解决方案1】:

只需简单地注释行: // export { default as Directions } from './Directions';

在你的项目中 -> node_modules -> react-native-gesture-handler -> GestureHandler.js

希望对你有帮助

【讨论】:

    【解决方案2】:

    请尝试

    Pod update

    它对我有用

    【讨论】:

      猜你喜欢
      • 2021-01-13
      • 1970-01-01
      • 2021-06-22
      • 2021-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-15
      • 1970-01-01
      相关资源
      最近更新 更多