Skip to content

Instantly share code, notes, and snippets.

@duytq94
Last active March 28, 2020 14:01
Show Gist options
  • Save duytq94/9df1a0b08d69f2c95dd258932957cc2c to your computer and use it in GitHub Desktop.
Save duytq94/9df1a0b08d69f2c95dd258932957cc2c to your computer and use it in GitHub Desktop.
// If TestConnectNative is an package from npm, you can think this is index.js file
import {NativeModules, Platform} from 'react-native';
const testConnectNative = NativeModules.TestConnectNative;
const TestConnectNative = {
sendMessage: msg => {
testConnectNative.sendMessageToNative(msg);
},
sendCallback: callback => {
testConnectNative.sendCallbackToNative(callback);
},
exitRN: tag => {
if (Platform.OS === 'ios') {
testConnectNative.dismissPresentedViewController(tag);
} else {
testConnectNative.finishActivity();
}
},
};
export default TestConnectNative;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment