Browse Source

Add overlay.handleKeyboardEvents options (#5002)

Yogev Ben David 5 years ago
parent
commit
e9ca247a52
No account linked to committer's email address

+ 6
- 1
lib/ios/RNNCommandsHandler.m View File

@@ -301,7 +301,12 @@ static NSString* const setDefaultOptions	= @"setDefaultOptions";
301 301
 	[overlayVC renderTreeAndWait:NO perform:^{
302 302
 		UIWindow* overlayWindow = [[RNNOverlayWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
303 303
 		overlayWindow.rootViewController = overlayVC;
304
-		[_overlayManager showOverlayWindow:overlayWindow];
304
+		if ([overlayVC.resolveOptions.overlay.handleKeyboardEvents getWithDefaultValue:NO]) {
305
+			[_overlayManager showOverlayWindowAsKeyWindow:overlayWindow];
306
+		} else {
307
+			[_overlayManager showOverlayWindow:overlayWindow];
308
+		}
309
+		
305 310
 		[_eventEmitter sendOnNavigationCommandCompletion:showOverlay commandId:commandId params:@{@"layout": layout}];
306 311
 		completion();
307 312
 	}];

+ 1
- 0
lib/ios/RNNOverlayManager.h View File

@@ -5,6 +5,7 @@
5 5
 @interface RNNOverlayManager : NSObject
6 6
 
7 7
 - (void)showOverlayWindow:(UIWindow*)viewController;
8
+- (void)showOverlayWindowAsKeyWindow:(UIWindow *)overlayWindow;
8 9
 - (void)dismissOverlay:(UIViewController*)viewController;
9 10
 
10 11
 @property (nonatomic, retain) NSMutableArray* overlayWindows;

+ 5
- 0
lib/ios/RNNOverlayManager.m View File

@@ -19,6 +19,11 @@
19 19
 	[overlayWindow setHidden: NO];
20 20
 }
21 21
 
22
+- (void)showOverlayWindowAsKeyWindow:(RNNOverlayWindow *)overlayWindow {
23
+	[self showOverlayWindow:overlayWindow];
24
+	[overlayWindow makeKeyWindow];
25
+}
26
+
22 27
 - (void)dismissOverlay:(UIViewController*)viewController {
23 28
 	RNNOverlayWindow* overlayWindow = [self findWindowByRootViewController:viewController];
24 29
 	[overlayWindow.previousWindow makeKeyWindow];

+ 1
- 0
lib/ios/RNNOverlayOptions.h View File

@@ -3,5 +3,6 @@
3 3
 @interface RNNOverlayOptions : RNNOptions
4 4
 
5 5
 @property (nonatomic, strong) Bool* interceptTouchOutside;
6
+@property (nonatomic, strong) Bool* handleKeyboardEvents;
6 7
 
7 8
 @end

+ 1
- 0
lib/ios/RNNOverlayOptions.m View File

@@ -7,6 +7,7 @@
7 7
 	self = [super init];
8 8
 	
9 9
 	self.interceptTouchOutside = [BoolParser parse:dict key:@"interceptTouchOutside"];
10
+	self.handleKeyboardEvents = [BoolParser parse:dict key:@"handleKeyboardEvents"];
10 11
 	
11 12
 	return self;
12 13
 }