I'd like to use the shake gesture with React Native. Its currently used for the debug menu and i'm not sure how to override it. Does anyone know if this is possible?
You can disable developer mode and then provide your own shake handler.
https://github.com/facebook/react-native/issues/1054
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.
I think you would then have to implement an Obj-C extension that handles the shake gesture; AFAIK there's no way to do this purely in JavaScript. You may find the code for the Dev Menu a useful guide for this:
https://github.com/facebook/react-native/blob/98263c4f8f6365a8c0c25e5f509928b89d8f1c0c/React/Base/RCTDevMenu.m
1.4m articles
1.4m replys
5 comments
57.0k users