Selaa lähdekoodia

fix overlay options bug

yogevbd 6 vuotta sitten
vanhempi
commit
fc493775eb

+ 11
- 2
lib/ios/RNNOverlayManager.m Näytä tiedosto

@@ -1,9 +1,11 @@
1 1
 #import "RNNOverlayManager.h"
2 2
 #import "RNNErrorHandler.h"
3
+#import "RNNOverlayWindow.h"
3 4
 
4 5
 @implementation RNNOverlayManager {
5 6
 	NSMutableDictionary* _overlayDict;
6 7
 	RNNStore* _store;
8
+	RNNOverlayWindow *_overlayWindow;
7 9
 }
8 10
 
9 11
 - (instancetype)initWithStore:(RNNStore *)store {
@@ -17,7 +19,11 @@
17 19
 
18 20
 - (void)showOverlay:(RNNRootViewController *)viewController completion:(RNNTransitionCompletionBlock)completion {
19 21
 	[self cacheOverlay:viewController];
20
-	[[[UIApplication sharedApplication] keyWindow] addSubview:viewController.view];
22
+	_overlayWindow = [[RNNOverlayWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
23
+	[_overlayWindow setWindowLevel:UIWindowLevelNormal];
24
+	[_overlayWindow setRootViewController:viewController];
25
+	[_overlayWindow makeKeyAndVisible];
26
+	
21 27
 	completion();
22 28
 }
23 29
 
@@ -38,7 +44,10 @@
38 44
 }
39 45
 
40 46
 - (void)removeCachedOverlay:(RNNRootViewController*)viewController {
41
-	[viewController.view removeFromSuperview];
47
+	[_overlayWindow setRootViewController:nil];
48
+	[_overlayWindow resignKeyWindow];
49
+	_overlayWindow = nil;
50
+	
42 51
 	[_overlayDict removeObjectForKey:viewController.componentId];
43 52
 	[_store removeComponent:viewController.componentId];
44 53
 }

+ 5
- 0
lib/ios/RNNOverlayWindow.h Näytä tiedosto

@@ -0,0 +1,5 @@
1
+#import <UIKit/UIKit.h>
2
+
3
+@interface RNNOverlayWindow : UIWindow
4
+
5
+@end

+ 15
- 0
lib/ios/RNNOverlayWindow.m Näytä tiedosto

@@ -0,0 +1,15 @@
1
+#import "RNNOverlayWindow.h"
2
+
3
+@implementation RNNOverlayWindow
4
+
5
+- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
6
+	UIView *hitTestResult = [super hitTest:point withEvent:event];
7
+	
8
+	if ([hitTestResult isKindOfClass:[UIWindow class]]) {
9
+		return nil;
10
+	}
11
+	
12
+	return hitTestResult;
13
+}
14
+
15
+@end

+ 8
- 0
lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj Näytä tiedosto

@@ -112,6 +112,8 @@
112 112
 		507F44201FFA8A8800D9425B /* RNNRootViewProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 507F441F1FFA8A8800D9425B /* RNNRootViewProtocol.h */; };
113 113
 		50887C1520ECC5C200D06111 /* RNNButtonOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 50887C1320ECC5C200D06111 /* RNNButtonOptions.h */; };
114 114
 		50887C1620ECC5C200D06111 /* RNNButtonOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 50887C1420ECC5C200D06111 /* RNNButtonOptions.m */; };
115
+		50887CA920F26BFE00D06111 /* RNNOverlayWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 50887CA720F26BFD00D06111 /* RNNOverlayWindow.m */; };
116
+		50887CAA20F26BFE00D06111 /* RNNOverlayWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 50887CA820F26BFE00D06111 /* RNNOverlayWindow.h */; };
115 117
 		50A00C37200F84D6000F01A6 /* RNNOverlayOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 50A00C35200F84D6000F01A6 /* RNNOverlayOptions.h */; };
116 118
 		50A00C38200F84D6000F01A6 /* RNNOverlayOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 50A00C36200F84D6000F01A6 /* RNNOverlayOptions.m */; };
117 119
 		50BE951220B5A787004F5DF5 /* RNNStatusBarOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 50BE951020B5A787004F5DF5 /* RNNStatusBarOptions.m */; };
@@ -332,6 +334,8 @@
332 334
 		507F441F1FFA8A8800D9425B /* RNNRootViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNRootViewProtocol.h; sourceTree = "<group>"; };
333 335
 		50887C1320ECC5C200D06111 /* RNNButtonOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNButtonOptions.h; sourceTree = "<group>"; };
334 336
 		50887C1420ECC5C200D06111 /* RNNButtonOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNButtonOptions.m; sourceTree = "<group>"; };
337
+		50887CA720F26BFD00D06111 /* RNNOverlayWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNOverlayWindow.m; sourceTree = "<group>"; };
338
+		50887CA820F26BFE00D06111 /* RNNOverlayWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNOverlayWindow.h; sourceTree = "<group>"; };
335 339
 		50A00C35200F84D6000F01A6 /* RNNOverlayOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNOverlayOptions.h; sourceTree = "<group>"; };
336 340
 		50A00C36200F84D6000F01A6 /* RNNOverlayOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNOverlayOptions.m; sourceTree = "<group>"; };
337 341
 		50BE951020B5A787004F5DF5 /* RNNStatusBarOptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNStatusBarOptions.m; sourceTree = "<group>"; };
@@ -667,6 +671,8 @@
667 671
 				507F441F1FFA8A8800D9425B /* RNNRootViewProtocol.h */,
668 672
 				E33AC1FF20B5BA0B0090DB8A /* RNNSplitViewController.m */,
669 673
 				E33AC20120B5BA550090DB8A /* RNNSplitViewController.h */,
674
+				50887CA820F26BFE00D06111 /* RNNOverlayWindow.h */,
675
+				50887CA720F26BFD00D06111 /* RNNOverlayWindow.m */,
670 676
 			);
671 677
 			name = Controllers;
672 678
 			sourceTree = "<group>";
@@ -878,6 +884,7 @@
878 884
 				50570B262061473D006A1B5C /* RNNTitleOptions.h in Headers */,
879 885
 				504AFE741FFFF0540076E904 /* RNNTopTabsOptions.h in Headers */,
880 886
 				E8E5182E1F83A48B000467AC /* RNNTransitionStateHolder.h in Headers */,
887
+				50887CAA20F26BFE00D06111 /* RNNOverlayWindow.h in Headers */,
881 888
 				507E7D57201DDD3000444E6C /* RNNAnimationOptions.h in Headers */,
882 889
 				2DCD9195200014A900EDC75D /* RNNBridgeManager.h in Headers */,
883 890
 				7B1126A91E2D2B6C00F9B03B /* RNNControllerFactory.h in Headers */,
@@ -1041,6 +1048,7 @@
1041 1048
 				504AFE651FFE53070076E904 /* RNNOptions.m in Sources */,
1042 1049
 				263905BA1E4C6F440023D7D3 /* RCCDrawerController.m in Sources */,
1043 1050
 				50F5DFC21F407A8C001A00BC /* RNNTabBarController.m in Sources */,
1051
+				50887CA920F26BFE00D06111 /* RNNOverlayWindow.m in Sources */,
1044 1052
 				263905BC1E4C6F440023D7D3 /* RCCDrawerHelper.m in Sources */,
1045 1053
 				4534E72620CB6724009F8185 /* RNNLargeTitleOptions.m in Sources */,
1046 1054
 				507E7D58201DDD3000444E6C /* RNNAnimationOptions.m in Sources */,