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
 	[overlayVC renderTreeAndWait:NO perform:^{
301
 	[overlayVC renderTreeAndWait:NO perform:^{
302
 		UIWindow* overlayWindow = [[RNNOverlayWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
302
 		UIWindow* overlayWindow = [[RNNOverlayWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
303
 		overlayWindow.rootViewController = overlayVC;
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
 		[_eventEmitter sendOnNavigationCommandCompletion:showOverlay commandId:commandId params:@{@"layout": layout}];
310
 		[_eventEmitter sendOnNavigationCommandCompletion:showOverlay commandId:commandId params:@{@"layout": layout}];
306
 		completion();
311
 		completion();
307
 	}];
312
 	}];

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

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

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

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

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

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

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

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