ソースを参照

Add window.backgroundColor option (#5942)

Yogev Ben David 4 年 前
コミット
c99ecf9b14
No account linked to committer's email address

+ 6
- 0
lib/ios/RNNBasePresenter.m ファイルの表示

@@ -51,6 +51,8 @@
51 51
     if (@available(iOS 13.0, *)) {
52 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 58
 - (void)applyOptionsOnViewDidLayoutSubviews:(RNNNavigationOptions *)options {
@@ -165,6 +167,10 @@
165 167
         UITabBarItem *tabItem = [RNNTabBarItemCreator updateTabBarItem:viewController.tabBarItem bottomTabOptions:withDefault.bottomTab];
166 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 176
 - (void)renderComponents:(RNNNavigationOptions *)options perform:(RNNReactViewReadyCompletionBlock)readyBlock {

+ 2
- 0
lib/ios/RNNNavigationOptions.h ファイルの表示

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

+ 1
- 0
lib/ios/RNNNavigationOptions.m ファイルの表示

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

+ 8
- 0
lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj ファイルの表示

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

+ 7
- 0
lib/ios/WindowOptions.h ファイルの表示

@@ -0,0 +1,7 @@
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 ファイルの表示

@@ -0,0 +1,11 @@
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