File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,9 @@ @implementation RCTBrowser
6
6
7
7
RCT_EXPORT_MODULE ()
8
8
9
- RCT_EXPORT_METHOD(presentUrl:(NSString *)url withOptions:(NSDictionary *)options) {
9
+ RCT_EXPORT_METHOD(presentUrl:(NSString *)url
10
+ withOptions:(NSDictionary *)options
11
+ modalCompletion:(RCTResponseSenderBlock)modalCompletionHandler) {
10
12
11
13
TOWebViewController *webVC = [[TOWebViewController alloc ] initWithURLString: url];
12
14
@@ -31,8 +33,6 @@ @implementation RCTBrowser
31
33
webVC.disableContextualPopupMenu = ([obj isEqual: @(YES )]);
32
34
} else if ([key isEqualToString: @" hideWebViewBoundaries" ]) {
33
35
webVC.hideWebViewBoundaries = ([obj isEqual: @(YES )]);
34
- } else if ([key isEqualToString: @" modalCompletionHandler" ]) {
35
- // TODO: turn this into a callback
36
36
} else if ([key isEqualToString: @" shouldStartLoadRequestHandler" ]) {
37
37
// TODO: turn this into a callback
38
38
} else if ([key isEqualToString: @" buttonTintColor" ]) {
@@ -42,6 +42,10 @@ @implementation RCTBrowser
42
42
}
43
43
}];
44
44
45
+ webVC.modalCompletionHandler = ^(void ) {
46
+ modalCompletionHandler (@[[NSNull null ]]);
47
+ };
48
+
45
49
UIViewController *rootVC = [[UIApplication sharedApplication ] keyWindow ].rootViewController ;
46
50
UINavigationController *nav = [[UINavigationController alloc ] initWithRootViewController: webVC];
47
51
Original file line number Diff line number Diff line change @@ -10,7 +10,11 @@ var Browser = NativeModules.Browser;
10
10
11
11
var RCTBrowserExport = {
12
12
open : function ( url , options = { } ) {
13
- Browser . presentUrl ( url , options ) ;
13
+ Browser . presentUrl ( url , options , function ( err ) {
14
+ if ( options . modalCompletionHandler ) {
15
+ options . modalCompletionHandler ( ) ;
16
+ }
17
+ } ) ;
14
18
} ,
15
19
} ;
16
20
You can’t perform that action at this time.
0 commit comments