Last active
January 6, 2017 13:28
-
-
Save gShrey/d711b7a3e2bca6f7f72d0345623f2fbe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
#import "OpenAppSettings.h" | |
@implementation OpenAppSettings | |
RCT_EXPORT_MODULE(); | |
RCT_EXPORT_METHOD(openSettings) | |
{ | |
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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