Sunday, February 17, 2019

null is not an object (evaluating 'RNGestureHandlerModule.State')

Recently I have installed React Navigation 3.X in my React Native project and got this error. The main difference between this version with previous one is you have to install another library
(react-native-gesture-handler) with it. And according to error the problem is with this library. (Image 1)
Image 1 RNGestureHandler Error

I followed the React Navigation documentation thoroughly but did not work. Each and every time I was getting the same error. After some moment finally I solved it. Let me show you how I have solved this error. Here my project name is RNNavigation. Just follow the steps below.


Step 1: From iOS folder open your .xcodeproj in Xcode (In my case RNNavigation.xcodeproj) .

Step 2 : From XCode’s Navigation Panel select your project (RNNavigation). Then select same named target. After selecting General tab find out “Linked Frameworks and Libraries”. (Image 2)

Image 2 Opening Project in XCode

Step 3: There you can see that RNGesture Library (libRNGestureHandler.a) was inactive. Just remove it from there. (Image 3).

Step 4: Again from XCode’s Navigation Panel expand the “Library” folder and find out “RNGestureHandler.xcodeproj”. Expand this project. You will find a folder named “Products” there. In this folder you will find “libRNGestureHandler.a” (Image 4)

Image 3 Removing RNGestureHandler Library
Image 4  Looking for the RNGestureHandler Library

Step 5: Drag and drop this library into “Linked Frameworks and Libraries”. (Image 5)

Image 5 Adding RNGestureHandler in the Project

Step 6: Build your Xcode project. After that close XCode. If your Packager is running close it too. Uninstall the app from device / simulator. Now reinstall it. It will work like a charm. (Image 6)

Image 6 App is working smoothly

2 comments: