Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions RCTBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ @implementation RCTBrowser

RCT_EXPORT_MODULE()

RCT_EXPORT_METHOD(presentUrl:(NSString *)url withOptions:(NSDictionary *)options) {
RCT_EXPORT_METHOD(presentUrl:(NSString *)url
withOptions:(NSDictionary *)options
modalCompletion:(RCTResponseSenderBlock)modalCompletionHandler) {

TOWebViewController *webVC = [[TOWebViewController alloc] initWithURLString:url];

Expand All @@ -31,8 +33,6 @@ @implementation RCTBrowser
webVC.disableContextualPopupMenu = ([obj isEqual: @(YES)]);
} else if ([key isEqualToString:@"hideWebViewBoundaries"]) {
webVC.hideWebViewBoundaries = ([obj isEqual: @(YES)]);
} else if ([key isEqualToString:@"modalCompletionHandler"]) {
// TODO: turn this into a callback
} else if ([key isEqualToString:@"shouldStartLoadRequestHandler"]) {
// TODO: turn this into a callback
} else if ([key isEqualToString:@"buttonTintColor"]) {
Expand All @@ -42,6 +42,10 @@ @implementation RCTBrowser
}
}];

webVC.modalCompletionHandler = ^(void) {
modalCompletionHandler(@[[NSNull null]]);
};

UIViewController *rootVC = [[UIApplication sharedApplication] keyWindow].rootViewController;
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:webVC];

Expand Down
6 changes: 5 additions & 1 deletion index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ var Browser = NativeModules.Browser;

var RCTBrowserExport = {
open: function(url, options={}) {
Browser.presentUrl(url, options);
Browser.presentUrl(url, options, function(err) {
if (options.modalCompletionHandler) {
options.modalCompletionHandler();
}
});
},
};

Expand Down