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

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

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
 	
80
 	
81
 	UIViewController* viewController = self.boundViewController;
81
 	UIViewController* viewController = self.boundViewController;
82
 	RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
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
 	if ((withDefault.topBar.leftButtons || withDefault.topBar.rightButtons)) {
89
 	if ((withDefault.topBar.leftButtons || withDefault.topBar.rightButtons)) {
87
 		[_navigationButtons applyLeftButtons:withDefault.topBar.leftButtons rightButtons:withDefault.topBar.rightButtons defaultLeftButtonStyle:withDefault.topBar.leftButtonStyle defaultRightButtonStyle:withDefault.topBar.rightButtonStyle];
90
 		[_navigationButtons applyLeftButtons:withDefault.topBar.leftButtons rightButtons:withDefault.topBar.rightButtons defaultLeftButtonStyle:withDefault.topBar.leftButtonStyle defaultRightButtonStyle:withDefault.topBar.rightButtonStyle];
113
 		[viewController setSearchBarWithPlaceholder:[options.topBar.searchBarPlaceholder getWithDefaultValue:@""] hideNavBarOnFocusSearchBar:hideNavBarOnFocusSearchBar];
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
 		[viewController setDrawBehindTopBar:options.topBar.drawBehind.get];
120
 		[viewController setDrawBehindTopBar:options.topBar.drawBehind.get];
118
   }
121
   }
119
 
122
 

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

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

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

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

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

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