Bläddra i källkod

refactored navigation options

yogevbd 7 år sedan
förälder
incheckning
0016d21df5

+ 0
- 6
lib/ios/RNNBottomTabOptions.m Visa fil

@@ -34,12 +34,6 @@
34 34
 	[self resetOptions];
35 35
 }
36 36
 
37
--(void)mergeWith:(NSDictionary *)otherOptions {
38
-	for (id key in otherOptions) {
39
-		[self setValue:[otherOptions objectForKey:key] forKey:key];
40
-	}
41
-}
42
-
43 37
 -(void)resetOptions {
44 38
 	self.title = nil;
45 39
 	self.badge = nil;

+ 0
- 5
lib/ios/RNNBottomTabsOptions.m Visa fil

@@ -37,9 +37,4 @@ extern const NSInteger BLUR_TOPBAR_TAG;
37 37
 	self.currentTabIndex = nil;
38 38
 }
39 39
 
40
--(void)mergeWith:(NSDictionary *)otherOptions {
41
-	for (id key in otherOptions) {
42
-		[self setValue:[otherOptions objectForKey:key] forKey:key];
43
-	}
44
-}
45 40
 @end

+ 0
- 2
lib/ios/RNNControllerFactory.m Visa fil

@@ -164,9 +164,7 @@
164 164
 
165 165
 - (UIViewController *)createOverlay:(NSDictionary*)layout {
166 166
 	UIViewController *vc = [self fromTree:layout];
167
-	NSDictionary* options = layout[@"data"][@"options"];
168 167
 	RCTRootView* rootView = (RCTRootView*)vc.view;
169
-	rootView.passThroughTouches = ![options[@"interceptTouches"] boolValue];
170 168
 	rootView.backgroundColor = [UIColor clearColor];
171 169
 	CGSize availableSize = UIApplication.sharedApplication.delegate.window.bounds.size;
172 170
 	rootView.frame = CGRectMake(0, 0, availableSize.width, availableSize.height);

+ 2
- 0
lib/ios/RNNNavigationOptions.h Visa fil

@@ -5,6 +5,7 @@
5 5
 #import "RNNSideMenuOptions.h"
6 6
 #import "RNNTopTabOptions.h"
7 7
 #import "RNNTopTabsOptions.h"
8
+#import "RNNOverlayOptions.h"
8 9
 
9 10
 extern const NSInteger BLUR_STATUS_TAG;
10 11
 extern const NSInteger BLUR_TOPBAR_TAG;
@@ -18,6 +19,7 @@ extern const NSInteger TOP_BAR_TRANSPARENT_TAG;
18 19
 @property (nonatomic, strong) RNNTopTabsOptions* topTabs;
19 20
 @property (nonatomic, strong) RNNTopTabOptions* topTab;
20 21
 @property (nonatomic, strong) RNNSideMenuOptions* sideMenu;
22
+@property (nonatomic, strong) RNNOverlayOptions* overlay;
21 23
 
22 24
 @property (nonatomic, strong) RNNNavigationOptions* defaultOptions;
23 25
 

+ 3
- 1
lib/ios/RNNNavigationOptions.m Visa fil

@@ -30,7 +30,8 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
30 30
 	self.backgroundImage = [RCTConvert UIImage:[options objectForKey:@"backgroundImage"]];
31 31
 	self.rootBackgroundImage = [RCTConvert UIImage:[options objectForKey:@"rootBackgroundImage"]];
32 32
 	self.bottomTab = [[RNNBottomTabOptions alloc] initWithDict:[options objectForKey:@"bottomTab"]];
33
-    
33
+	self.overlay = [[RNNOverlayOptions alloc] initWithDict:[options objectForKey:@"overlay"]];
34
+	
34 35
 	return self;
35 36
 }
36 37
 
@@ -53,6 +54,7 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
53 54
 	[self.topTab applyOn:viewController];
54 55
 	[self.bottomTab applyOn:viewController];
55 56
 	[self.sideMenu applyOn:viewController];
57
+	[self.overlay applyOn:viewController];
56 58
 	[self applyOtherOptionsOn:viewController];
57 59
 }
58 60
 

+ 7
- 0
lib/ios/RNNOverlayOptions.h Visa fil

@@ -0,0 +1,7 @@
1
+#import "RNNOptions.h"
2
+
3
+@interface RNNOverlayOptions : RNNOptions
4
+
5
+@property (nonatomic) BOOL interceptTouches;
6
+
7
+@end

+ 11
- 0
lib/ios/RNNOverlayOptions.m Visa fil

@@ -0,0 +1,11 @@
1
+#import "RNNOverlayOptions.h"
2
+#import <React/RCTRootView.h>
3
+
4
+@implementation RNNOverlayOptions
5
+
6
+- (void)applyOn:(UIViewController *)viewController {
7
+	RCTRootView* rootView = (RCTRootView*)viewController.view;
8
+	rootView.passThroughTouches = !self.interceptTouches;
9
+}
10
+
11
+@end

+ 0
- 5
lib/ios/RNNTopTabOptions.m Visa fil

@@ -9,10 +9,5 @@
9 9
 	}
10 10
 }
11 11
 
12
--(void)mergeWith:(NSDictionary *)otherOptions {
13
-	for (id key in otherOptions) {
14
-		[self setValue:[otherOptions objectForKey:key] forKey:key];
15
-	}
16
-}
17 12
 @end
18 13
 

+ 8
- 0
lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj Visa fil

@@ -76,6 +76,8 @@
76 76
 		507F43F81FF525B500D9425B /* RNNSegmentedControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 507F43F61FF525B500D9425B /* RNNSegmentedControl.h */; };
77 77
 		507F43F91FF525B500D9425B /* RNNSegmentedControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 507F43F71FF525B500D9425B /* RNNSegmentedControl.m */; };
78 78
 		507F44201FFA8A8800D9425B /* RNNRootViewProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 507F441F1FFA8A8800D9425B /* RNNRootViewProtocol.h */; };
79
+		50A00C37200F84D6000F01A6 /* RNNOverlayOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 50A00C35200F84D6000F01A6 /* RNNOverlayOptions.h */; };
80
+		50A00C38200F84D6000F01A6 /* RNNOverlayOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 50A00C36200F84D6000F01A6 /* RNNOverlayOptions.m */; };
79 81
 		50CB3B691FDE911400AA153B /* RNNSideMenuOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 50CB3B671FDE911400AA153B /* RNNSideMenuOptions.h */; };
80 82
 		50CB3B6A1FDE911400AA153B /* RNNSideMenuOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 50CB3B681FDE911400AA153B /* RNNSideMenuOptions.m */; };
81 83
 		50D031342005149000386B3D /* RNNOverlayManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 50D031322005149000386B3D /* RNNOverlayManager.h */; };
@@ -243,6 +245,8 @@
243 245
 		507F43F61FF525B500D9425B /* RNNSegmentedControl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNSegmentedControl.h; sourceTree = "<group>"; };
244 246
 		507F43F71FF525B500D9425B /* RNNSegmentedControl.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNSegmentedControl.m; sourceTree = "<group>"; };
245 247
 		507F441F1FFA8A8800D9425B /* RNNRootViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNRootViewProtocol.h; sourceTree = "<group>"; };
248
+		50A00C35200F84D6000F01A6 /* RNNOverlayOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNOverlayOptions.h; sourceTree = "<group>"; };
249
+		50A00C36200F84D6000F01A6 /* RNNOverlayOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNOverlayOptions.m; sourceTree = "<group>"; };
246 250
 		50CB3B671FDE911400AA153B /* RNNSideMenuOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNSideMenuOptions.h; sourceTree = "<group>"; };
247 251
 		50CB3B681FDE911400AA153B /* RNNSideMenuOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNSideMenuOptions.m; sourceTree = "<group>"; };
248 252
 		50D031322005149000386B3D /* RNNOverlayManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNOverlayManager.h; sourceTree = "<group>"; };
@@ -455,6 +459,8 @@
455 459
 				504AFE731FFFF0540076E904 /* RNNTopTabsOptions.m */,
456 460
 				50CB3B671FDE911400AA153B /* RNNSideMenuOptions.h */,
457 461
 				50CB3B681FDE911400AA153B /* RNNSideMenuOptions.m */,
462
+				50A00C35200F84D6000F01A6 /* RNNOverlayOptions.h */,
463
+				50A00C36200F84D6000F01A6 /* RNNOverlayOptions.m */,
458 464
 			);
459 465
 			name = Options;
460 466
 			sourceTree = "<group>";
@@ -663,6 +669,7 @@
663 669
 				263905BB1E4C6F440023D7D3 /* RCCDrawerHelper.h in Headers */,
664 670
 				263905CC1E4C6F440023D7D3 /* SidebarWunderlistAnimation.h in Headers */,
665 671
 				507F43F41FF4FCFE00D9425B /* HMSegmentedControl.h in Headers */,
672
+				50A00C37200F84D6000F01A6 /* RNNOverlayOptions.h in Headers */,
666 673
 				7B4928081E70415400555040 /* RNNCommandsHandler.h in Headers */,
667 674
 				263905AE1E4C6F440023D7D3 /* MMDrawerBarButtonItem.h in Headers */,
668 675
 				50F5DFC11F407A8C001A00BC /* RNNTabBarController.h in Headers */,
@@ -862,6 +869,7 @@
862 869
 				E8A430121F9CB87B00B61A20 /* RNNAnimatedView.m in Sources */,
863 870
 				507F43F51FF4FCFE00D9425B /* HMSegmentedControl.m in Sources */,
864 871
 				507F43C61FF4F17C00D9425B /* RNNTopTabsViewController.m in Sources */,
872
+				50A00C38200F84D6000F01A6 /* RNNOverlayOptions.m in Sources */,
865 873
 				50EB93421FE14A3E00BD8EEE /* RNNBottomTabOptions.m in Sources */,
866 874
 				E8367B811F7A8A4700675C05 /* VICMAImageView.m in Sources */,
867 875
 				A7626C011FC5796200492FB8 /* RNNBottomTabsOptions.m in Sources */,

+ 5
- 1
playground/src/screens/OptionsScreen.js Visa fil

@@ -198,7 +198,11 @@ class OptionsScreen extends Component {
198 198
     Navigation.showOverlay({
199 199
       component: {
200 200
         name: 'navigation.playground.CustomDialog',
201
-        options: { interceptTouches }
201
+        options: {
202
+          overlay: {
203
+            interceptTouches
204
+          }
205
+        }
202 206
       }
203 207
     });
204 208
   }