React-native-gesture-handler: 导入 Swipeable 时无法读取未定义的属性“状态”

创建于 2018-06-28  ·  4评论  ·  资料来源: software-mansion/react-native-gesture-handler

image

导入 Swipeable 以下文档时出现此错误

import Swipeable from 'react-native-gesture-handler/Swipeable';

我的版本包:“^1.0.2”

======
经过调查,我发现 NativeModules.RNGestureHandlerModule 在GestureHandler.js是 undefined
const RNGestureHandlerModule = NativeModules.RNGestureHandlerModule;

最有用的评论

打开Xcode,将./node_modules/react-native-gesture-handler/ios/RNGestureHandler.xcodeprojLibraries文件夹中

接下来,转到Build Phases > Link Binaries with Libraries ,添加libRNGestureHandler.a

重建您的应用程序。

所有4条评论

我在构建过程中遇到相同的错误和错误。 我在 Windows 10 Insiders 版本上运行,这是来自 cmd 屏幕的消息:

`: app:prepareOrgWebkitAndroidJscR174650Library 更新
: app:prepareS9aReactNativeGestureHandlerUnspecifiedLibrary
: app:prepareS9aReactNativeVectorIconsUnspecifiedLibrary FAILED

FAILURE:构建失败,出现异常。

  • 什么地方出了错:
    任务“: app:prepareS9aReactNativeVectorIconsUnspecifiedLibrary ”的执行失败。

    无法复制 zip 条目 \s9a\node_modulesreact-native-vector-iconsandroid\build\outputs\aarreact-native-vector-icons-release
    .aar!jni/ 到“\s9aandroid\app\build\intermediates\exploded-aar\s9areact-native-vector-icons\unspecified\jni”。

  • 尝试:
    使用 --stacktrace 选项运行以获取堆栈跟踪。 使用 --info 或 --debug 选项运行以获得更多日志输出。

构建失败

总时间:52.237 秒
无法在设备上安装该应用程序,请阅读上面的错误了解详情。
确保您有一个正在运行的 Android 模拟器或已连接的设备
设置你的 Android 开发环境:
https://facebook.github.io/react-native/docs/getting-started.html
`

任何帮助将不胜感激。

如果您还没有尝试过,我通过清理模拟器、重新启动捆绑程序并使用 react-native run-ios 重新安装应用程序来解决此问题。 对于安装,我使用了 react-native 链接并且没有编辑任何其他本机 iOS 文件。 希望这可以帮助。

@johnhaup我认为这里的问题是 NativeModules(来自 react-native)现在支持PanResponse ,而不是RNGestureHandlerModule

打开Xcode,将./node_modules/react-native-gesture-handler/ios/RNGestureHandler.xcodeprojLibraries文件夹中

接下来,转到Build Phases > Link Binaries with Libraries ,添加libRNGestureHandler.a

重建您的应用程序。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

brunolemos picture brunolemos  ·  3评论

Agoujil2saad picture Agoujil2saad  ·  3评论

alexthebake picture alexthebake  ·  3评论

rt2zz picture rt2zz  ·  4评论

chrisdrackett picture chrisdrackett  ·  4评论