Skip to content

Instantly share code, notes, and snippets.

@gShrey
Last active January 6, 2017 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gShrey/d711b7a3e2bca6f7f72d0345623f2fbe to your computer and use it in GitHub Desktop.
Save gShrey/d711b7a3e2bca6f7f72d0345623f2fbe to your computer and use it in GitHub Desktop.
#import <UIKit/UIKit.h>
#import "OpenAppSettings.h"
@implementation OpenAppSettings
RCT_EXPORT_MODULE();
RCT_EXPORT_METHOD(openSettings)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
@end
import { NativeModules,Platform } from 'react-native';
var OpenAppSettings = NativeModules.OpenAppSettings;
//if module doesn't exist.
var openSettingsFn = ()=>{
}
if(OpenAppSettings && typeof OpenAppSettings.openSettings == "function")
{
openSettingsFn = OpenAppSettings.openSettings;
}
//call openSettingsFn() at some event to trigger native call.
#import "RCTBridgeModule.h"
#ifndef OpenAppSettings_h
#define OpenAppSettings_h
@interface OpenAppSettings : NSObject <RCTBridgeModule>
@end
#endif /* OpenAppSettings_h */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment