Browse Source

Layout background color (#5946)

* Apply layout.backgroundColor on parent view controllers

* Add layout.componentBackgroundColor

* Remove drawBehind deprecation
Yogev Ben David 4 years ago
parent
commit
950642d48b
No account linked to committer's email address

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

2
 
2
 
3
 @interface DeprecationOptions : RNNOptions
3
 @interface DeprecationOptions : RNNOptions
4
 
4
 
5
-@property (nonatomic, strong) Bool* deprecateDrawBehind;
6
-
7
 @end
5
 @end

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

4
 
4
 
5
 - (instancetype)initWithDict:(NSDictionary *)dict {
5
 - (instancetype)initWithDict:(NSDictionary *)dict {
6
     self = [super init];
6
     self = [super init];
7
-    self.deprecateDrawBehind = [BoolParser parse:dict key:@"deprecateDrawBehind"];
8
     return self;
7
     return self;
9
 }
8
 }
10
 
9
 

+ 5
- 0
lib/ios/RNNBottomTabsPresenter.m View File

25
     [bottomTabs setTabBarHideShadow:[withDefault.bottomTabs.hideShadow getWithDefaultValue:NO]];
25
     [bottomTabs setTabBarHideShadow:[withDefault.bottomTabs.hideShadow getWithDefaultValue:NO]];
26
     [bottomTabs setTabBarStyle:[RCTConvert UIBarStyle:[withDefault.bottomTabs.barStyle getWithDefaultValue:@"default"]]];
26
     [bottomTabs setTabBarStyle:[RCTConvert UIBarStyle:[withDefault.bottomTabs.barStyle getWithDefaultValue:@"default"]]];
27
     [bottomTabs setTabBarVisible:[withDefault.bottomTabs.visible getWithDefaultValue:YES] animated:[withDefault.bottomTabs.animate getWithDefaultValue:NO]];
27
     [bottomTabs setTabBarVisible:[withDefault.bottomTabs.visible getWithDefaultValue:YES] animated:[withDefault.bottomTabs.animate getWithDefaultValue:NO]];
28
+    [bottomTabs.view setBackgroundColor:[withDefault.layout.backgroundColor getWithDefaultValue:nil]];
28
 }
29
 }
29
 
30
 
30
 - (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)currentOptions {
31
 - (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigationOptions *)currentOptions {
68
             [bottomTabs setTabBarVisible:options.bottomTabs.visible.get animated:NO];
69
             [bottomTabs setTabBarVisible:options.bottomTabs.visible.get animated:NO];
69
         }
70
         }
70
     }
71
     }
72
+    
73
+    if (options.layout.backgroundColor.hasValue) {
74
+        [bottomTabs.view setBackgroundColor:options.layout.backgroundColor.get];
75
+    }
71
 }
76
 }
72
 
77
 
73
 - (void)viewDidLayoutSubviews {
78
 - (void)viewDidLayoutSubviews {

+ 15
- 15
lib/ios/RNNComponentPresenter.m View File

59
 	[viewController setStatusBarStyle:[withDefault.statusBar.style getWithDefaultValue:@"default"] animated:[withDefault.statusBar.animate getWithDefaultValue:YES]];
59
 	[viewController setStatusBarStyle:[withDefault.statusBar.style getWithDefaultValue:@"default"] animated:[withDefault.statusBar.animate getWithDefaultValue:YES]];
60
 	[viewController setBackButtonVisible:[withDefault.topBar.backButton.visible getWithDefaultValue:YES]];
60
 	[viewController setBackButtonVisible:[withDefault.topBar.backButton.visible getWithDefaultValue:YES]];
61
 	[viewController setInterceptTouchOutside:[withDefault.overlay.interceptTouchOutside getWithDefaultValue:YES]];
61
 	[viewController setInterceptTouchOutside:[withDefault.overlay.interceptTouchOutside getWithDefaultValue:YES]];
62
-
63
-	if (withDefault.layout.backgroundColor.hasValue) {
64
-		[viewController setBackgroundColor:withDefault.layout.backgroundColor.get];
65
-	}
66
-
62
+    
63
+    if (@available(iOS 13.0, *)) {
64
+        [viewController setBackgroundColor:[withDefault.layout.componentBackgroundColor getWithDefaultValue:UIColor.systemBackgroundColor]];
65
+    } else {
66
+        [viewController setBackgroundColor:[withDefault.layout.componentBackgroundColor getWithDefaultValue:viewController.view.backgroundColor]];
67
+    }
68
+    
67
 	if (withDefault.topBar.searchBar.hasValue) {
69
 	if (withDefault.topBar.searchBar.hasValue) {
68
 		BOOL hideNavBarOnFocusSearchBar = YES;
70
 		BOOL hideNavBarOnFocusSearchBar = YES;
69
 		if (withDefault.topBar.hideNavBarOnFocusSearchBar.hasValue) {
71
 		if (withDefault.topBar.hideNavBarOnFocusSearchBar.hasValue) {
81
 	UIViewController* viewController = self.boundViewController;
83
 	UIViewController* viewController = self.boundViewController;
82
 	RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
84
 	RNNNavigationOptions *withDefault = [options withDefault:[self defaultOptions]];
83
     
85
     
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
-	}
86
+	[viewController setDrawBehindTopBar:[withDefault.topBar.drawBehind getWithDefaultValue:NO]];
87
+    [viewController setDrawBehindTabBar:[withDefault.bottomTabs.drawBehind getWithDefaultValue:NO] || ![withDefault.bottomTabs.visible getWithDefaultValue:YES]];
88
     
88
     
89
 	if ((withDefault.topBar.leftButtons || withDefault.topBar.rightButtons)) {
89
 	if ((withDefault.topBar.leftButtons || withDefault.topBar.rightButtons)) {
90
 		[_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];
116
 		[viewController setSearchBarWithPlaceholder:[options.topBar.searchBarPlaceholder getWithDefaultValue:@""] hideNavBarOnFocusSearchBar:hideNavBarOnFocusSearchBar];
116
 		[viewController setSearchBarWithPlaceholder:[options.topBar.searchBarPlaceholder getWithDefaultValue:@""] hideNavBarOnFocusSearchBar:hideNavBarOnFocusSearchBar];
117
 	}
117
 	}
118
 
118
 
119
-	if (options.topBar.drawBehind.hasValue && ![withDefault.deprecations.deprecateDrawBehind getWithDefaultValue:NO]) {
119
+	if (options.topBar.drawBehind.hasValue) {
120
 		[viewController setDrawBehindTopBar:options.topBar.drawBehind.get];
120
 		[viewController setDrawBehindTopBar:options.topBar.drawBehind.get];
121
   }
121
   }
122
 
122
 
127
 	if (options.topBar.largeTitle.visible.hasValue) {
127
 	if (options.topBar.largeTitle.visible.hasValue) {
128
 		[viewController setTopBarPrefersLargeTitle:options.topBar.largeTitle.visible.get];
128
 		[viewController setTopBarPrefersLargeTitle:options.topBar.largeTitle.visible.get];
129
 	}
129
 	}
130
-
130
+    
131
+    if (options.layout.componentBackgroundColor.hasValue) {
132
+        [viewController setBackgroundColor:options.layout.componentBackgroundColor.get];
133
+    }
134
+    
131
 	if (options.bottomTab.badgeColor.hasValue) {
135
 	if (options.bottomTab.badgeColor.hasValue) {
132
 		[viewController setTabBarItemBadgeColor:options.bottomTab.badgeColor.get];
136
 		[viewController setTabBarItemBadgeColor:options.bottomTab.badgeColor.get];
133
 	}
137
 	}
134
 	
138
 	
135
-	if (options.layout.backgroundColor.hasValue) {
136
-		[viewController setBackgroundColor:options.layout.backgroundColor.get];
137
-	}
138
-	
139
 	if (options.bottomTab.visible.hasValue) {
139
 	if (options.bottomTab.visible.hasValue) {
140
 		[viewController.tabBarController setCurrentTabIndex:[viewController.tabBarController.viewControllers indexOfObject:viewController]];
140
 		[viewController.tabBarController setCurrentTabIndex:[viewController.tabBarController.viewControllers indexOfObject:viewController]];
141
 	}
141
 	}

+ 1
- 0
lib/ios/RNNLayoutOptions.h View File

3
 @interface RNNLayoutOptions : RNNOptions
3
 @interface RNNLayoutOptions : RNNOptions
4
 
4
 
5
 @property (nonatomic, strong) Color* backgroundColor;
5
 @property (nonatomic, strong) Color* backgroundColor;
6
+@property (nonatomic, strong) Color* componentBackgroundColor;
6
 @property (nonatomic, strong) Text* direction;
7
 @property (nonatomic, strong) Text* direction;
7
 @property (nonatomic, strong) id orientation;
8
 @property (nonatomic, strong) id orientation;
8
 
9
 

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

8
 	self = [super init];
8
 	self = [super init];
9
 	
9
 	
10
 	self.backgroundColor = [ColorParser parse:dict key:@"backgroundColor"];
10
 	self.backgroundColor = [ColorParser parse:dict key:@"backgroundColor"];
11
+    self.componentBackgroundColor = [ColorParser parse:dict key:@"componentBackgroundColor"];
11
 	self.direction = [TextParser parse:dict key:@"direction"];
12
 	self.direction = [TextParser parse:dict key:@"direction"];
12
 	self.orientation = dict[@"orientation"];
13
 	self.orientation = dict[@"orientation"];
13
 
14
 

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

41
 		[sideMenu side:MMDrawerSideRight visible:withDefault.sideMenu.right.visible.get];
41
 		[sideMenu side:MMDrawerSideRight visible:withDefault.sideMenu.right.visible.get];
42
 		[withDefault.sideMenu.right.visible consume];
42
 		[withDefault.sideMenu.right.visible consume];
43
 	}
43
 	}
44
+    
45
+    [sideMenu.view setBackgroundColor:[withDefault.layout.backgroundColor getWithDefaultValue:nil]];
44
 }
46
 }
45
 
47
 
46
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions {
48
 - (void)applyOptionsOnInit:(RNNNavigationOptions *)initialOptions {
108
 	if (options.sideMenu.animationType.hasValue) {
110
 	if (options.sideMenu.animationType.hasValue) {
109
 		[sideMenu setAnimationType:options.sideMenu.animationType.get];
111
 		[sideMenu setAnimationType:options.sideMenu.animationType.get];
110
 	}
112
 	}
113
+    
114
+    if (options.layout.backgroundColor.hasValue) {
115
+        [sideMenu.view setBackgroundColor:options.layout.backgroundColor.get];
116
+    }
111
 }
117
 }
112
 
118
 
113
 @end
119
 @end

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

65
     [stack setNavigationBarLargeTitleVisible:[withDefault.topBar.largeTitle.visible getWithDefaultValue:NO]];
65
     [stack setNavigationBarLargeTitleVisible:[withDefault.topBar.largeTitle.visible getWithDefaultValue:NO]];
66
     [stack setNavigationBarClipsToBounds:[withDefault.topBar.background.clipToBounds getWithDefaultValue:NO]];
66
     [stack setNavigationBarClipsToBounds:[withDefault.topBar.background.clipToBounds getWithDefaultValue:NO]];
67
     [stack setBackButtonColor:[withDefault.topBar.backButton.color getWithDefaultValue:nil]];
67
     [stack setBackButtonColor:[withDefault.topBar.backButton.color getWithDefaultValue:nil]];
68
+	
69
+	[stack.view setBackgroundColor:[withDefault.layout.backgroundColor getWithDefaultValue:nil]];
68
 }
70
 }
69
 
71
 
70
 - (void)applyOptionsOnViewDidLayoutSubviews:(RNNNavigationOptions *)options {
72
 - (void)applyOptionsOnViewDidLayoutSubviews:(RNNNavigationOptions *)options {
128
     if (options.topBar.background.component.name.hasValue) {
130
     if (options.topBar.background.component.name.hasValue) {
129
         [self setCustomNavigationComponentBackground:options perform:nil];
131
         [self setCustomNavigationComponentBackground:options perform:nil];
130
     }
132
     }
133
+	
134
+	if (options.layout.backgroundColor.hasValue) {
135
+		[stack.view setBackgroundColor:options.layout.backgroundColor.get];
136
+	}
131
     
137
     
132
     RNNNavigationOptions * withDefault = (RNNNavigationOptions *) [[options mergeInOptions:resolvedOptions] withDefault:[self defaultOptions]];
138
     RNNNavigationOptions * withDefault = (RNNNavigationOptions *) [[options mergeInOptions:resolvedOptions] withDefault:[self defaultOptions]];
133
     [_topBarPresenter mergeOptions:options.topBar withDefault:withDefault.topBar];
139
     [_topBarPresenter mergeOptions:options.topBar withDefault:withDefault.topBar];

+ 2
- 18
lib/src/commands/Deprecations.ts View File

1
-import isEqual from 'lodash/isEqual';
2
-import once from 'lodash/once';
3
-import { Platform } from 'react-native';
4
 
1
 
5
 export class Deprecations {
2
 export class Deprecations {
6
-  private deprecateDrawBehind = once((parentOptions: object) => {
7
-    this.warnDeprecatedOption('drawBehind', 'Please use SafeAreaView, or ScrollView and set drawBehind true in default options. For more information see https://github.com/wix/react-native-navigation/issues/5913', parentOptions);
8
-  });
3
+  public onProcessOptions(_key: string, _parentOptions: Record<string, any>) {
9
 
4
 
10
-  public onProcessOptions(key: string, parentOptions: Record<string, any>) {
11
-    if (isEqual(key, 'drawBehind') && Platform.OS === 'ios') {
12
-      this.deprecateDrawBehind(parentOptions);
13
-    }
14
   }
5
   }
15
 
6
 
16
-  public onProcessDefaultOptions(key: string, parentOptions: Record<string, any>) {
17
-    if (isEqual(key, 'drawBehind') && Platform.OS === 'ios' && parentOptions[key] === false) {
18
-      this.deprecateDrawBehind(parentOptions);
19
-    }
20
-  }
7
+  public onProcessDefaultOptions(_key: string, _parentOptions: Record<string, any>) {
21
 
8
 
22
-  private warnDeprecatedOption(key: string, message: string, parentOptions: object) {
23
-    // tslint:disable-next-line:no-console
24
-    console.warn(`${key} is deprecated. ${message}`, parentOptions);
25
   }
9
   }
26
 }
10
 }

+ 1
- 1
playground/ios/NavigationIOS12Tests/RNNRootViewControllerTest.m View File

132
 
132
 
133
 -(void)testbackgroundColor_validColor{
133
 -(void)testbackgroundColor_validColor{
134
 	UIColor* inputColor = [RCTConvert UIColor:@(0xFFFF0000)];
134
 	UIColor* inputColor = [RCTConvert UIColor:@(0xFFFF0000)];
135
-	self.options.layout.backgroundColor = [[Color alloc] initWithValue:inputColor];
135
+	self.options.layout.componentBackgroundColor = [[Color alloc] initWithValue:inputColor];
136
 	[self.uut viewWillAppear:false];
136
 	[self.uut viewWillAppear:false];
137
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
137
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
138
 	XCTAssertTrue([self.uut.view.backgroundColor isEqual:expectedColor]);
138
 	XCTAssertTrue([self.uut.view.backgroundColor isEqual:expectedColor]);

+ 7
- 2
playground/ios/NavigationTests/RNNRootViewControllerTest.m View File

130
 	XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
130
 	XCTAssertTrue([self.uut.navigationController.navigationBar.standardAppearance.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
131
 }
131
 }
132
 
132
 
133
-- (void)testbackgroundColor_validColor{
133
+- (void)testBackgroundColor_validColor {
134
 	UIColor* inputColor = [RCTConvert UIColor:@(0xFFFF0000)];
134
 	UIColor* inputColor = [RCTConvert UIColor:@(0xFFFF0000)];
135
-	self.options.layout.backgroundColor = [[Color alloc] initWithValue:inputColor];
135
+	self.options.layout.componentBackgroundColor = [[Color alloc] initWithValue:inputColor];
136
 	[self.uut viewWillAppear:false];
136
 	[self.uut viewWillAppear:false];
137
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
137
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
138
 	XCTAssertTrue([self.uut.view.backgroundColor isEqual:expectedColor]);
138
 	XCTAssertTrue([self.uut.view.backgroundColor isEqual:expectedColor]);
139
 }
139
 }
140
 
140
 
141
+- (void)testDefaultBackgroundColor {
142
+	[self.uut viewWillAppear:false];
143
+	XCTAssertTrue([self.uut.view.backgroundColor isEqual:UIColor.systemBackgroundColor]);
144
+}
145
+
141
 - (void)testTopBarTextFontFamily_validFont{
146
 - (void)testTopBarTextFontFamily_validFont{
142
 	NSString* inputFont = @"HelveticaNeue";
147
 	NSString* inputFont = @"HelveticaNeue";
143
 	__unused RNNStackController* nav = [self createNavigationController];
148
 	__unused RNNStackController* nav = [self createNavigationController];

+ 35
- 27
playground/ios/NavigationTests/RNNSideMenuPresenterTest.m View File

7
 
7
 
8
 @property (nonatomic, strong) RNNSideMenuPresenter *uut;
8
 @property (nonatomic, strong) RNNSideMenuPresenter *uut;
9
 @property (nonatomic, strong) RNNNavigationOptions *options;
9
 @property (nonatomic, strong) RNNNavigationOptions *options;
10
-@property (nonatomic, strong) id bindedViewController;
10
+@property (nonatomic, strong) id boundViewController;
11
 
11
 
12
 @end
12
 @end
13
 
13
 
16
 - (void)setUp {
16
 - (void)setUp {
17
     [super setUp];
17
     [super setUp];
18
 	self.uut = [[RNNSideMenuPresenter alloc] init];
18
 	self.uut = [[RNNSideMenuPresenter alloc] init];
19
-	self.bindedViewController = [OCMockObject partialMockForObject:[RNNSideMenuController new]];
20
-    [self.uut bindViewController:self.bindedViewController];
19
+	self.boundViewController = [OCMockObject partialMockForObject:[RNNSideMenuController new]];
20
+    [self.uut bindViewController:self.boundViewController];
21
 	self.options = [[RNNNavigationOptions alloc] initEmptyOptions];
21
 	self.options = [[RNNNavigationOptions alloc] initEmptyOptions];
22
 }
22
 }
23
 
23
 
24
 - (void)testApplyOptionsShouldSetDefaultValues {
24
 - (void)testApplyOptionsShouldSetDefaultValues {
25
-	[[self.bindedViewController expect] side:MMDrawerSideLeft enabled:YES];
26
-	[[self.bindedViewController expect] side:MMDrawerSideRight enabled:YES];
27
-	[[self.bindedViewController expect] setShouldStretchLeftDrawer:YES];
28
-	[[self.bindedViewController expect] setShouldStretchRightDrawer:YES];
29
-	[[self.bindedViewController expect] setAnimationVelocityLeft:840.0f];
30
-	[[self.bindedViewController expect] setAnimationVelocityRight:840.0f];
31
-	[[self.bindedViewController reject] side:MMDrawerSideLeft width:0];
32
-	[[self.bindedViewController reject] side:MMDrawerSideRight width:0];
33
-  	[[self.bindedViewController expect] setAnimationType:nil];
25
+	[[self.boundViewController expect] side:MMDrawerSideLeft enabled:YES];
26
+	[[self.boundViewController expect] side:MMDrawerSideRight enabled:YES];
27
+	[[self.boundViewController expect] setShouldStretchLeftDrawer:YES];
28
+	[[self.boundViewController expect] setShouldStretchRightDrawer:YES];
29
+	[[self.boundViewController expect] setAnimationVelocityLeft:840.0f];
30
+	[[self.boundViewController expect] setAnimationVelocityRight:840.0f];
31
+	[[self.boundViewController reject] side:MMDrawerSideLeft width:0];
32
+	[[self.boundViewController reject] side:MMDrawerSideRight width:0];
33
+  	[[self.boundViewController expect] setAnimationType:nil];
34
     
34
     
35
 	[self.uut applyOptions:self.options];
35
 	[self.uut applyOptions:self.options];
36
 
36
 
37
-	[self.bindedViewController verify];
37
+	[self.boundViewController verify];
38
 }
38
 }
39
 
39
 
40
 - (void)testApplyOptionsShouldSetInitialValues {
40
 - (void)testApplyOptionsShouldSetInitialValues {
45
 	self.options.sideMenu.right.animationVelocity = [[Double alloc] initWithValue:@(100.0f)];
45
 	self.options.sideMenu.right.animationVelocity = [[Double alloc] initWithValue:@(100.0f)];
46
 	self.options.sideMenu.left.animationVelocity = [[Double alloc] initWithValue:@(100.0f)];
46
 	self.options.sideMenu.left.animationVelocity = [[Double alloc] initWithValue:@(100.0f)];
47
 	
47
 	
48
-	[[self.bindedViewController expect] side:MMDrawerSideLeft enabled:NO];
49
-	[[self.bindedViewController expect] side:MMDrawerSideRight enabled:NO];
50
-	[[self.bindedViewController expect] setShouldStretchLeftDrawer:NO];
51
-	[[self.bindedViewController expect] setShouldStretchRightDrawer:NO];
52
-	[[self.bindedViewController expect] setAnimationVelocityLeft:100.0f];
53
-	[[self.bindedViewController expect] setAnimationVelocityRight:100.0f];
48
+	[[self.boundViewController expect] side:MMDrawerSideLeft enabled:NO];
49
+	[[self.boundViewController expect] side:MMDrawerSideRight enabled:NO];
50
+	[[self.boundViewController expect] setShouldStretchLeftDrawer:NO];
51
+	[[self.boundViewController expect] setShouldStretchRightDrawer:NO];
52
+	[[self.boundViewController expect] setAnimationVelocityLeft:100.0f];
53
+	[[self.boundViewController expect] setAnimationVelocityRight:100.0f];
54
 	
54
 	
55
 	[self.uut applyOptions:self.options];
55
 	[self.uut applyOptions:self.options];
56
 	
56
 	
57
-	[self.bindedViewController verify];
57
+	[self.boundViewController verify];
58
 }
58
 }
59
 
59
 
60
 - (void)testApplyOptionsOnInitShouldSetWidthOptions {
60
 - (void)testApplyOptionsOnInitShouldSetWidthOptions {
61
 	self.options.sideMenu.right.width = [[Double alloc] initWithValue:@(100.0f)];
61
 	self.options.sideMenu.right.width = [[Double alloc] initWithValue:@(100.0f)];
62
 	self.options.sideMenu.left.width = [[Double alloc] initWithValue:@(100.0f)];
62
 	self.options.sideMenu.left.width = [[Double alloc] initWithValue:@(100.0f)];
63
 
63
 
64
-	[[self.bindedViewController expect] side:MMDrawerSideLeft width:100.0f];
65
-	[[self.bindedViewController expect] side:MMDrawerSideRight width:100.0f];
64
+	[[self.boundViewController expect] side:MMDrawerSideLeft width:100.0f];
65
+	[[self.boundViewController expect] side:MMDrawerSideRight width:100.0f];
66
 	
66
 	
67
 	[self.uut applyOptionsOnInit:self.options];
67
 	[self.uut applyOptionsOnInit:self.options];
68
 	
68
 	
69
-	[self.bindedViewController verify];
69
+	[self.boundViewController verify];
70
 }
70
 }
71
 
71
 
72
 - (void)testApplyOptionsOnInitShouldSetDefaultDrawerGestureMode {
72
 - (void)testApplyOptionsOnInitShouldSetDefaultDrawerGestureMode {
73
-	[[self.bindedViewController expect] setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
73
+	[[self.boundViewController expect] setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
74
 	[self.uut applyOptionsOnInit:self.options];
74
 	[self.uut applyOptionsOnInit:self.options];
75
-	[self.bindedViewController verify];
75
+	[self.boundViewController verify];
76
 }
76
 }
77
 
77
 
78
 - (void)testApplyOptionsOnInitShouldSetBezelDrawerGestureMode {
78
 - (void)testApplyOptionsOnInitShouldSetBezelDrawerGestureMode {
79
 	self.options.sideMenu.openGestureMode = [[SideMenuOpenMode alloc] initWithValue:@(MMOpenDrawerGestureModeNone)];
79
 	self.options.sideMenu.openGestureMode = [[SideMenuOpenMode alloc] initWithValue:@(MMOpenDrawerGestureModeNone)];
80
-	[[self.bindedViewController expect] setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeNone];
80
+	[[self.boundViewController expect] setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeNone];
81
 	[self.uut applyOptionsOnInit:self.options];
81
 	[self.uut applyOptionsOnInit:self.options];
82
-	[self.bindedViewController verify];
82
+	[self.boundViewController verify];
83
+}
84
+
85
+- (void)testBackgroundColor_validColor {
86
+	UIColor* inputColor = [RCTConvert UIColor:@(0xFFFF0000)];
87
+	self.options.layout.backgroundColor = [[Color alloc] initWithValue:inputColor];
88
+	[self.uut applyOptions:self.options];
89
+	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
90
+	XCTAssertTrue([((UIViewController *)self.boundViewController).view.backgroundColor isEqual:expectedColor]);
83
 }
91
 }
84
 
92
 
85
 @end
93
 @end

+ 8
- 0
playground/ios/NavigationTests/RNNStackPresenterTest.m View File

106
 	XCTAssertTrue([self.boundViewController.navigationBar.standardAppearance.backIndicatorImage isEqual:image]);
106
 	XCTAssertTrue([self.boundViewController.navigationBar.standardAppearance.backIndicatorImage isEqual:image]);
107
 }
107
 }
108
 
108
 
109
+- (void)testBackgroundColor_validColor {
110
+	UIColor* inputColor = [RCTConvert UIColor:@(0xFFFF0000)];
111
+	self.options.layout.backgroundColor = [[Color alloc] initWithValue:inputColor];
112
+	[self.uut applyOptions:self.options];
113
+	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
114
+	XCTAssertTrue([self.boundViewController.view.backgroundColor isEqual:expectedColor]);
115
+}
116
+
109
 @end
117
 @end

+ 8
- 0
playground/ios/NavigationTests/RNNTabBarPresenterTest.m View File

92
     [uut verify];
92
     [uut verify];
93
 }
93
 }
94
 
94
 
95
+- (void)testBackgroundColor_validColor {
96
+	UIColor* inputColor = [RCTConvert UIColor:@(0xFFFF0000)];
97
+	self.options.layout.backgroundColor = [[Color alloc] initWithValue:inputColor];
98
+	[self.uut applyOptions:self.options];
99
+	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
100
+	XCTAssertTrue([((UIViewController *)self.boundViewController).view.backgroundColor isEqual:expectedColor]);
101
+}
102
+
95
 @end
103
 @end