React-native-gesture-handler: Can not read property 'State' of undefined when import Swipeable

Created on 28 Jun 2018  路  4Comments  路  Source: software-mansion/react-native-gesture-handler

image

I got this error when import Swipeable following docs

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

my version package : "^1.0.2"

======
After investigate, I found that NativeModules.RNGestureHandlerModule is undefined in GestureHandler.js
const RNGestureHandlerModule = NativeModules.RNGestureHandlerModule;

Most helpful comment

Open Xcode, and add ./node_modules/react-native-gesture-handler/ios/RNGestureHandler.xcodeproj to the Libraries folder

Next, go over to Build Phases > Link Binaries with Libraries, add libRNGestureHandler.a

Rebuild your application.

All 4 comments

I'm getting the same error along with and error from the build procedure. I'm running on a windows 10 insiders edition and this is the message from the cmd screen:

`:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareS9aReactNativeGestureHandlerUnspecifiedLibrary
:app:prepareS9aReactNativeVectorIconsUnspecifiedLibrary FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:prepareS9aReactNativeVectorIconsUnspecifiedLibrary'.

    Could not copy zip entry \s9a\node_modulesreact-native-vector-iconsandroid\build\outputs\aarreact-native-vector-icons-release
    .aar!jni/ to '\s9aandroid\app\build\intermediates\exploded-aar\s9areact-native-vector-icons\unspecified\jni'.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 52.237 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
`

Any help will be greatly appreciated.

In case you haven't tried, I fixed this issue by cleaning my simulator, restarting my bundler, and reinstalling the app with react-native run-ios. For install I used react-native link and did not edit any other native iOS files. Hope this helps.

@johnhaup I think the problem here is NativeModules (which come from react-native) now support PanResponse, not RNGestureHandlerModule

Open Xcode, and add ./node_modules/react-native-gesture-handler/ios/RNGestureHandler.xcodeproj to the Libraries folder

Next, go over to Build Phases > Link Binaries with Libraries, add libRNGestureHandler.a

Rebuild your application.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brentvatne picture brentvatne  路  5Comments

enahum picture enahum  路  4Comments

brentvatne picture brentvatne  路  4Comments

jhalborg picture jhalborg  路  5Comments

jacobrosenskold picture jacobrosenskold  路  3Comments