Browse Source

Add deprecateDrawBehind option (#5934)

* Add deprecateDrawBehind option

* Apply draw behind options when deprecateDrawBehind equals false

Co-authored-by: Guy Carmeli <guyca@users.noreply.github.com>
Yogev Ben David 4 years ago
parent
commit
cab63dacab
No account linked to committer's email address

+ 7
- 0
lib/ios/DeprecationOptions.h View File

@@ -0,0 +1,7 @@
1
+#import "RNNOptions.h"
2
+
3
+@interface DeprecationOptions : RNNOptions
4
+
5
+@property (nonatomic, strong) Bool* deprecateDrawBehind;
6
+
7
+@end

+ 11
- 0
lib/ios/DeprecationOptions.m View File

@@ -0,0 +1,11 @@
1
+#import "DeprecationOptions.h"
2
+
3
+@implementation DeprecationOptions
4
+
5
+- (instancetype)initWithDict:(NSDictionary *)dict {
6
+    self = [super init];
7
+    self.deprecateDrawBehind = [BoolParser parse:dict key:@"deprecateDrawBehind"];
8
+    return self;
9
+}
10
+
11
+@end

+ 6
- 3
lib/ios/RNNComponentPresenter.m View File

@@ -80,8 +80,11 @@
80 80
 	
81 81
 	UIViewController* viewController = self.boundViewController;
82 82
 	RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
83
-    [viewController setDrawBehindTopBar:[withDefault.topBar.drawBehind getWithDefaultValue:NO]];
84
-    [viewController setDrawBehindTabBar:[withDefault.bottomTabs.drawBehind getWithDefaultValue:NO] || ![withDefault.bottomTabs.visible getWithDefaultValue:YES]];
83
+    
84
+	if (![withDefault.deprecations.deprecateDrawBehind getWithDefaultValue:NO]) {
85
+		[viewController setDrawBehindTopBar:[withDefault.topBar.drawBehind getWithDefaultValue:NO]];
86
+		[viewController setDrawBehindTabBar:[withDefault.bottomTabs.drawBehind getWithDefaultValue:NO] || ![withDefault.bottomTabs.visible getWithDefaultValue:YES]];
87
+	}
85 88
     
86 89
 	if ((withDefault.topBar.leftButtons || withDefault.topBar.rightButtons)) {
87 90
 		[_navigationButtons applyLeftButtons:withDefault.topBar.leftButtons rightButtons:withDefault.topBar.rightButtons defaultLeftButtonStyle:withDefault.topBar.leftButtonStyle defaultRightButtonStyle:withDefault.topBar.rightButtonStyle];
@@ -113,7 +116,7 @@
113 116
 		[viewController setSearchBarWithPlaceholder:[options.topBar.searchBarPlaceholder getWithDefaultValue:@""] hideNavBarOnFocusSearchBar:hideNavBarOnFocusSearchBar];
114 117
 	}
115 118
 
116
-	if (options.topBar.drawBehind.hasValue) {
119
+	if (options.topBar.drawBehind.hasValue && ![withDefault.deprecations.deprecateDrawBehind getWithDefaultValue:NO]) {
117 120
 		[viewController setDrawBehindTopBar:options.topBar.drawBehind.get];
118 121
   }
119 122
 

+ 2
- 0
lib/ios/RNNNavigationOptions.h View File

@@ -12,6 +12,7 @@
12 12
 #import "RNNLayoutOptions.h"
13 13
 #import "RNNSplitViewOptions.h"
14 14
 #import "RNNModalOptions.h"
15
+#import "DeprecationOptions.h"
15 16
 
16 17
 extern const NSInteger BLUR_TOPBAR_TAG;
17 18
 
@@ -30,6 +31,7 @@ extern const NSInteger BLUR_TOPBAR_TAG;
30 31
 @property (nonatomic, strong) RNNLayoutOptions* layout;
31 32
 @property (nonatomic, strong) RNNSplitViewOptions* splitView;
32 33
 @property (nonatomic, strong) RNNModalOptions* modal;
34
+@property (nonatomic, strong) DeprecationOptions* deprecations;
33 35
 
34 36
 @property (nonatomic, strong) Bool* popGesture;
35 37
 @property (nonatomic, strong) Image* backgroundImage;

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

@@ -29,6 +29,7 @@
29 29
 	self.preview = [[RNNPreviewOptions alloc] initWithDict:dict[@"preview"]];
30 30
 	self.layout = [[RNNLayoutOptions alloc] initWithDict:dict[@"layout"]];
31 31
     self.modal = [[RNNModalOptions alloc] initWithDict:dict[@"modal"]];
32
+	self.deprecations = [[DeprecationOptions alloc] initWithDict:dict[@"deprecations"]];
32 33
 	
33 34
 	self.popGesture = [[Bool alloc] initWithValue:dict[@"popGesture"]];
34 35
 	

+ 8
- 0
lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj View File

@@ -354,6 +354,8 @@
354 354
 		50F5DFC21F407A8C001A00BC /* RNNBottomTabsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 50F5DFC01F407A8C001A00BC /* RNNBottomTabsController.m */; };
355 355
 		50F5DFC51F407AA0001A00BC /* RNNStackController.h in Headers */ = {isa = PBXBuildFile; fileRef = 50F5DFC31F407AA0001A00BC /* RNNStackController.h */; };
356 356
 		50F5DFC61F407AA0001A00BC /* RNNStackController.m in Sources */ = {isa = PBXBuildFile; fileRef = 50F5DFC41F407AA0001A00BC /* RNNStackController.m */; };
357
+		50FCD83723FC102200000DD0 /* DeprecationOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 50FCD83523FC102200000DD0 /* DeprecationOptions.h */; };
358
+		50FCD83823FC102200000DD0 /* DeprecationOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 50FCD83623FC102200000DD0 /* DeprecationOptions.m */; };
357 359
 		651E1F8A21FD624600DFEA19 /* UISplitViewController+RNNOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 651E1F8921FD624600DFEA19 /* UISplitViewController+RNNOptions.m */; };
358 360
 		651E1F8D21FD642100DFEA19 /* RNNSplitViewControllerPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 651E1F8C21FD642100DFEA19 /* RNNSplitViewControllerPresenter.m */; };
359 361
 		7365071121E4B16F004E020F /* RCTConvert+UIBarButtonSystemItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 7365070F21E4B16F004E020F /* RCTConvert+UIBarButtonSystemItem.h */; };
@@ -823,6 +825,8 @@
823 825
 		50F5DFC01F407A8C001A00BC /* RNNBottomTabsController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNBottomTabsController.m; sourceTree = "<group>"; };
824 826
 		50F5DFC31F407AA0001A00BC /* RNNStackController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNStackController.h; sourceTree = "<group>"; };
825 827
 		50F5DFC41F407AA0001A00BC /* RNNStackController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNStackController.m; sourceTree = "<group>"; };
828
+		50FCD83523FC102200000DD0 /* DeprecationOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeprecationOptions.h; sourceTree = "<group>"; };
829
+		50FCD83623FC102200000DD0 /* DeprecationOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DeprecationOptions.m; sourceTree = "<group>"; };
826 830
 		651E1F8821FD611600DFEA19 /* UISplitViewController+RNNOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UISplitViewController+RNNOptions.h"; sourceTree = "<group>"; };
827 831
 		651E1F8921FD624600DFEA19 /* UISplitViewController+RNNOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UISplitViewController+RNNOptions.m"; sourceTree = "<group>"; };
828 832
 		651E1F8B21FD63F400DFEA19 /* RNNSplitViewControllerPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNSplitViewControllerPresenter.h; sourceTree = "<group>"; };
@@ -1238,6 +1242,8 @@
1238 1242
 				50A246362395399700A192C5 /* RNNModalOptions.m */,
1239 1243
 				50D3A37023B8D77C00717F95 /* SharedElementTransitionOptions.h */,
1240 1244
 				50D3A37123B8D77C00717F95 /* SharedElementTransitionOptions.m */,
1245
+				50FCD83523FC102200000DD0 /* DeprecationOptions.h */,
1246
+				50FCD83623FC102200000DD0 /* DeprecationOptions.m */,
1241 1247
 			);
1242 1248
 			name = Options;
1243 1249
 			sourceTree = "<group>";
@@ -1669,6 +1675,7 @@
1669 1675
 				5038A3B5216DF602009280BC /* UINavigationController+RNNOptions.h in Headers */,
1670 1676
 				50E5F78D223F9FAF002AFEAD /* ElementTransitionOptions.h in Headers */,
1671 1677
 				509416AB23A11CB20036092C /* NullEnum.h in Headers */,
1678
+				50FCD83723FC102200000DD0 /* DeprecationOptions.h in Headers */,
1672 1679
 				E5F6C3A422DB4D0F0093C2CE /* UIColor+RNNUtils.h in Headers */,
1673 1680
 				5038A3C1216E1E66009280BC /* RNNFontAttributesCreator.h in Headers */,
1674 1681
 				5016E8EF20209690009D4F7C /* RNNCustomTitleView.h in Headers */,
@@ -2077,6 +2084,7 @@
2077 2084
 				507F43C61FF4F17C00D9425B /* RNNTopTabsViewController.m in Sources */,
2078 2085
 				50706E6E20CE7CA5003345C3 /* UIImage+tint.m in Sources */,
2079 2086
 				50CED452239F9DFC00C42EE2 /* TopBarPresenter.m in Sources */,
2087
+				50FCD83823FC102200000DD0 /* DeprecationOptions.m in Sources */,
2080 2088
 				50BCB29223F2C7CD00D6C8E5 /* AnchorTransition.m in Sources */,
2081 2089
 				50344D2923A03DB4004B6A7C /* BottomTabsAttachMode.m in Sources */,
2082 2090
 				501224072173592D000F5F98 /* RNNBottomTabsPresenter.m in Sources */,