Shaking on a physical device can be hard sometimes, especially when the device and the cable have been connected hardly (for some problem by charge socket or cable).
It happened to me several times, when I wanted to shake my connection lost.
Is there any way for simulating the shake gesture on physical devices?
I was struggling with the same problem that i found these solutions :
------------------FOR ANDROID DEVICES------------------
after running your app on physical device or emulator , run this command to see the dev menu:
adb shell input keyevent KEYCODE_MENU
--------------------FOR IOS DEVICES-------------------------
you can easily add the shake gesture to the assistive touch and while your app running you can click on that on debug menu will be shown , if you wonder how to activate it check the link
--------FOR BOTH FROM INSIDE THE CODES---------
import React from 'react';
import {
View,
PanResponder,
NativeModules,
} from 'react-native';
const DevMenuTrigger = ({children}) => {
const {DevMenu} = NativeModules;
const panResponder = PanResponder.create({
onStartShouldSetPanResponder: (evt, gestureState) => {
if (gestureState.numberActiveTouches === 3) {
DevMenu.show();
}
},
});
return <View style={{flex: 1}} {...panResponder.panHandlers}>{children}</View>;
};
AppRegistry.registerComponent('myApp', (): any => <DevMenuTrigger><MyApp></DevMenuTrigger>);