Browse Source

Add window.backgroundColor option (#5942)

Yogev Ben David 4 years ago
parent
commit
c99ecf9b14
No account linked to committer's email address

+ 6
- 0
lib/ios/RNNBasePresenter.m View File

51
     if (@available(iOS 13.0, *)) {
51
     if (@available(iOS 13.0, *)) {
52
         viewController.modalInPresentation = ![withDefault.modal.swipeToDismiss getWithDefaultValue:YES];
52
         viewController.modalInPresentation = ![withDefault.modal.swipeToDismiss getWithDefaultValue:YES];
53
     }
53
     }
54
+	
55
+	UIApplication.sharedApplication.delegate.window.backgroundColor = [withDefault.window.backgroundColor getWithDefaultValue:nil];
54
 }
56
 }
55
 
57
 
56
 - (void)applyOptionsOnViewDidLayoutSubviews:(RNNNavigationOptions *)options {
58
 - (void)applyOptionsOnViewDidLayoutSubviews:(RNNNavigationOptions *)options {
165
         UITabBarItem *tabItem = [RNNTabBarItemCreator updateTabBarItem:viewController.tabBarItem bottomTabOptions:withDefault.bottomTab];
167
         UITabBarItem *tabItem = [RNNTabBarItemCreator updateTabBarItem:viewController.tabBarItem bottomTabOptions:withDefault.bottomTab];
166
         viewController.tabBarItem = tabItem;
168
         viewController.tabBarItem = tabItem;
167
     }
169
     }
170
+	
171
+	if (options.window.backgroundColor.hasValue) {
172
+		UIApplication.sharedApplication.delegate.window.backgroundColor = withDefault.window.backgroundColor.get;
173
+	}
168
 }
174
 }
169
 
175
 
170
 - (void)renderComponents:(RNNNavigationOptions *)options perform:(RNNReactViewReadyCompletionBlock)readyBlock {
176
 - (void)renderComponents:(RNNNavigationOptions *)options perform:(RNNReactViewReadyCompletionBlock)readyBlock {

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

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

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

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
 	self.deprecations = [[DeprecationOptions alloc] initWithDict:dict[@"deprecations"]];
33
+	self.window = [[WindowOptions alloc] initWithDict:dict[@"window"]];
33
 	
34
 	
34
 	self.popGesture = [[Bool alloc] initWithValue:dict[@"popGesture"]];
35
 	self.popGesture = [[Bool alloc] initWithValue:dict[@"popGesture"]];
35
 	
36
 	

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

271
 		50A00C38200F84D6000F01A6 /* RNNOverlayOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 50A00C36200F84D6000F01A6 /* RNNOverlayOptions.m */; };
271
 		50A00C38200F84D6000F01A6 /* RNNOverlayOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 50A00C36200F84D6000F01A6 /* RNNOverlayOptions.m */; };
272
 		50A246372395399700A192C5 /* RNNModalOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 50A246352395399700A192C5 /* RNNModalOptions.h */; };
272
 		50A246372395399700A192C5 /* RNNModalOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 50A246352395399700A192C5 /* RNNModalOptions.h */; };
273
 		50A246382395399700A192C5 /* RNNModalOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 50A246362395399700A192C5 /* RNNModalOptions.m */; };
273
 		50A246382395399700A192C5 /* RNNModalOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 50A246362395399700A192C5 /* RNNModalOptions.m */; };
274
+		50A4962323FD51B900F4816D /* WindowOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 50A4962123FD51B900F4816D /* WindowOptions.h */; };
275
+		50A4962423FD51B900F4816D /* WindowOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 50A4962223FD51B900F4816D /* WindowOptions.m */; };
274
 		50A5628A23DDAB5A0027C219 /* TransitionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 50A5628823DDAB5A0027C219 /* TransitionDelegate.h */; };
276
 		50A5628A23DDAB5A0027C219 /* TransitionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 50A5628823DDAB5A0027C219 /* TransitionDelegate.h */; };
275
 		50A5628B23DDAB5A0027C219 /* TransitionDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 50A5628923DDAB5A0027C219 /* TransitionDelegate.m */; };
277
 		50A5628B23DDAB5A0027C219 /* TransitionDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 50A5628923DDAB5A0027C219 /* TransitionDelegate.m */; };
276
 		50A5628E23DDAB6F0027C219 /* ModalTransitionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 50A5628C23DDAB6F0027C219 /* ModalTransitionDelegate.h */; };
278
 		50A5628E23DDAB6F0027C219 /* ModalTransitionDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 50A5628C23DDAB6F0027C219 /* ModalTransitionDelegate.h */; };
741
 		50A00C36200F84D6000F01A6 /* RNNOverlayOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNOverlayOptions.m; sourceTree = "<group>"; };
743
 		50A00C36200F84D6000F01A6 /* RNNOverlayOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNOverlayOptions.m; sourceTree = "<group>"; };
742
 		50A246352395399700A192C5 /* RNNModalOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNModalOptions.h; sourceTree = "<group>"; };
744
 		50A246352395399700A192C5 /* RNNModalOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNModalOptions.h; sourceTree = "<group>"; };
743
 		50A246362395399700A192C5 /* RNNModalOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNModalOptions.m; sourceTree = "<group>"; };
745
 		50A246362395399700A192C5 /* RNNModalOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNModalOptions.m; sourceTree = "<group>"; };
746
+		50A4962123FD51B900F4816D /* WindowOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WindowOptions.h; sourceTree = "<group>"; };
747
+		50A4962223FD51B900F4816D /* WindowOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WindowOptions.m; sourceTree = "<group>"; };
744
 		50A5628823DDAB5A0027C219 /* TransitionDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TransitionDelegate.h; sourceTree = "<group>"; };
748
 		50A5628823DDAB5A0027C219 /* TransitionDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TransitionDelegate.h; sourceTree = "<group>"; };
745
 		50A5628923DDAB5A0027C219 /* TransitionDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TransitionDelegate.m; sourceTree = "<group>"; };
749
 		50A5628923DDAB5A0027C219 /* TransitionDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TransitionDelegate.m; sourceTree = "<group>"; };
746
 		50A5628C23DDAB6F0027C219 /* ModalTransitionDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ModalTransitionDelegate.h; sourceTree = "<group>"; };
750
 		50A5628C23DDAB6F0027C219 /* ModalTransitionDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ModalTransitionDelegate.h; sourceTree = "<group>"; };
1180
 			children = (
1184
 			children = (
1181
 				504AFE621FFE53070076E904 /* RNNOptions.h */,
1185
 				504AFE621FFE53070076E904 /* RNNOptions.h */,
1182
 				504AFE631FFE53070076E904 /* RNNOptions.m */,
1186
 				504AFE631FFE53070076E904 /* RNNOptions.m */,
1187
+				50A4962123FD51B900F4816D /* WindowOptions.h */,
1188
+				50A4962223FD51B900F4816D /* WindowOptions.m */,
1183
 				4534E72320CB6724009F8185 /* RNNLargeTitleOptions.h */,
1189
 				4534E72320CB6724009F8185 /* RNNLargeTitleOptions.h */,
1184
 				4534E72420CB6724009F8185 /* RNNLargeTitleOptions.m */,
1190
 				4534E72420CB6724009F8185 /* RNNLargeTitleOptions.m */,
1185
 				E83BAD691F27362500A9F3DD /* RNNNavigationOptions.h */,
1191
 				E83BAD691F27362500A9F3DD /* RNNNavigationOptions.h */,
1644
 				26916C981E4B9E7700D13680 /* RNNReactRootViewCreator.h in Headers */,
1650
 				26916C981E4B9E7700D13680 /* RNNReactRootViewCreator.h in Headers */,
1645
 				5012241A21736678000F5F98 /* Image.h in Headers */,
1651
 				5012241A21736678000F5F98 /* Image.h in Headers */,
1646
 				506A2B1420973DFD00F43A95 /* RNNErrorHandler.h in Headers */,
1652
 				506A2B1420973DFD00F43A95 /* RNNErrorHandler.h in Headers */,
1653
+				50A4962323FD51B900F4816D /* WindowOptions.h in Headers */,
1647
 				50A5628A23DDAB5A0027C219 /* TransitionDelegate.h in Headers */,
1654
 				50A5628A23DDAB5A0027C219 /* TransitionDelegate.h in Headers */,
1648
 				503A8A0923BB86200094D1C4 /* TimeIntervalParser.h in Headers */,
1655
 				503A8A0923BB86200094D1C4 /* TimeIntervalParser.h in Headers */,
1649
 				263905B01E4C6F440023D7D3 /* MMDrawerController+Subclass.h in Headers */,
1656
 				263905B01E4C6F440023D7D3 /* MMDrawerController+Subclass.h in Headers */,
2009
 				5038A3BA216DFCFD009280BC /* UITabBarController+RNNOptions.m in Sources */,
2016
 				5038A3BA216DFCFD009280BC /* UITabBarController+RNNOptions.m in Sources */,
2010
 				5030B62123D5B4CB008F1642 /* LNInterpolable.m in Sources */,
2017
 				5030B62123D5B4CB008F1642 /* LNInterpolable.m in Sources */,
2011
 				50A246382395399700A192C5 /* RNNModalOptions.m in Sources */,
2018
 				50A246382395399700A192C5 /* RNNModalOptions.m in Sources */,
2019
+				50A4962423FD51B900F4816D /* WindowOptions.m in Sources */,
2012
 				50E38DDE23A7A306009817F6 /* AnimatedImageView.m in Sources */,
2020
 				50E38DDE23A7A306009817F6 /* AnimatedImageView.m in Sources */,
2013
 				263905B21E4C6F440023D7D3 /* MMDrawerController.m in Sources */,
2021
 				263905B21E4C6F440023D7D3 /* MMDrawerController.m in Sources */,
2014
 				50644A2120E11A720026709C /* Constants.m in Sources */,
2022
 				50644A2120E11A720026709C /* Constants.m in Sources */,

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

1
+#import "RNNOptions.h"
2
+
3
+@interface WindowOptions : RNNOptions
4
+
5
+@property (nonatomic, strong) Color* backgroundColor;
6
+
7
+@end

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

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