Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native shaking gesture not working

Tags:

react-native

After adding this pod to my react-native project (RN 0.42) the shaking gesture doesn't work anymore on iOS. I can't debug my code besides building it in xcode which is very annoying. It really slows down development so it would be appreciated if someone has a solution.

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '8.0'
use_frameworks!

def available_pods
    project ‘rrnf’, 'Debug' => :debug

    react_path = '../node_modules/react-native'
    yoga_path = File.join(react_path, 'ReactCommon/yoga')


    pod 'React', path: react_path, :subspecs => [
    'Core',
    'RCTActionSheet',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
    ]
    pod 'Yoga', :path => yoga_path

    [
    'Firebase',
    'Firebase/Core',
    'Firebase/Auth',
    'Firebase/Storage',
    'Firebase/Database',
    'Firebase/RemoteConfig',
    'Firebase/Messaging'
    ].each do |lib|
        pod lib
    end

    pod 'react-native-camera', path: '../node_modules/react-native-camera'

end

target 'rrnf' do
    available_pods
end

target 'rrnfTests' do
    available_pods
end
like image 754
Jab Avatar asked Mar 21 '17 18:03

Jab


2 Answers

I know this is an old question, but I could not find a solution anywhere.

And I got temporary solution for this.

  1. Find RCTDefines.h in your React Pod directory

(Pods > Development Pods > React > Core > Base > RCTDefines.h)

enter image description here

  1. Find #define RCT_DEV

You can find this explanation.

The RCT_DEV macro can be used to enable or disable development tools such as the debug executors, dev menu, red box, etc.

So, turn on RCT_DEV flag to 1.

#define RCT_DEV 1

Also, this flag is used for DevSupport. So, you need to turn on these two flag.

#define RCT_ENABLE_INSPECTOR 1

#define ENABLE_PACKAGER_CONNECTION 1

Final code looks like this.

final

like image 53
Changnam Hong Avatar answered Nov 15 '22 03:11

Changnam Hong


This awnser solved my problem How do i use the iOS shake gesture with react native?

Adding RCT_DEV=0 to the preprocessor macros did fix the shaking gesture.

You can either change the value [of RCT_DEV] in RCTDefines.h, or in the build settings for the React lib project, search for "Preprocessor Macros" and add RCT_DEV=0 to the section where DEBUG=1 is currently defined.

like image 44
Jab Avatar answered Nov 15 '22 03:11

Jab