浏览代码

Fix backButton.color change on mergeOptions (#6145)

Co-authored-by: Guy Carmeli <guyca@users.noreply.github.com>
Yogev Ben David 5 年前
父节点
当前提交
da0fd194f8
没有帐户链接到提交者的电子邮件

+ 0
- 5
lib/ios/RNNStackPresenter.m 查看文件

63
     
63
     
64
     [stack setNavigationBarBlur:[withDefault.topBar.background.blur getWithDefaultValue:NO]];
64
     [stack setNavigationBarBlur:[withDefault.topBar.background.blur getWithDefaultValue:NO]];
65
     [stack setNavigationBarClipsToBounds:[withDefault.topBar.background.clipToBounds getWithDefaultValue:NO]];
65
     [stack setNavigationBarClipsToBounds:[withDefault.topBar.background.clipToBounds getWithDefaultValue:NO]];
66
-    [stack setBackButtonColor:[withDefault.topBar.backButton.color getWithDefaultValue:nil]];
67
 	
66
 	
68
 	[stack.view setBackgroundColor:[withDefault.layout.backgroundColor getWithDefaultValue:nil]];
67
 	[stack.view setBackgroundColor:[withDefault.layout.backgroundColor getWithDefaultValue:nil]];
69
 }
68
 }
114
     if (options.topBar.background.blur.hasValue) {
113
     if (options.topBar.background.blur.hasValue) {
115
         [stack setNavigationBarBlur:[options.topBar.background.blur get]];
114
         [stack setNavigationBarBlur:[options.topBar.background.blur get]];
116
     }
115
     }
117
-    
118
-    if (options.topBar.backButton.color.hasValue) {
119
-        [stack setBackButtonColor:options.topBar.backButton.color.get];
120
-    }
121
 
116
 
122
     if (options.topBar.background.component.name.hasValue) {
117
     if (options.topBar.background.component.name.hasValue) {
123
         [self setCustomNavigationComponentBackground:options perform:nil];
118
         [self setCustomNavigationComponentBackground:options perform:nil];

+ 1
- 1
lib/ios/TopBarPresenter.m 查看文件

123
     
123
     
124
     NSArray* stackChildren = self.navigationController.viewControllers;
124
     NSArray* stackChildren = self.navigationController.viewControllers;
125
     UIViewController *lastViewControllerInStack = stackChildren.count > 1 ? stackChildren[stackChildren.count - 2] : self.navigationController.topViewController;
125
     UIViewController *lastViewControllerInStack = stackChildren.count > 1 ? stackChildren[stackChildren.count - 2] : self.navigationController.topViewController;
126
-    UIBarButtonItem *backItem = lastViewControllerInStack.navigationItem.backBarButtonItem ?: [UIBarButtonItem new];
126
+    UIBarButtonItem *backItem = [UIBarButtonItem new];
127
     backItem.accessibilityIdentifier = testID;
127
     backItem.accessibilityIdentifier = testID;
128
 
128
 
129
     icon = color
129
     icon = color

+ 0
- 2
lib/ios/UINavigationController+RNNOptions.h 查看文件

16
 
16
 
17
 - (void)setNavigationBarClipsToBounds:(BOOL)clipsToBounds;
17
 - (void)setNavigationBarClipsToBounds:(BOOL)clipsToBounds;
18
 
18
 
19
-- (void)setBackButtonColor:(UIColor *)color;
20
-
21
 @end
19
 @end

+ 0
- 4
lib/ios/UINavigationController+RNNOptions.m 查看文件

54
 	}
54
 	}
55
 }
55
 }
56
 
56
 
57
-- (void)setBackButtonColor:(UIColor *)color {
58
-	self.navigationBar.tintColor = color;
59
-}
60
-
61
 - (void)setNavigationBarClipsToBounds:(BOOL)clipsToBounds {
57
 - (void)setNavigationBarClipsToBounds:(BOOL)clipsToBounds {
62
 	self.navigationBar.clipsToBounds = clipsToBounds;
58
 	self.navigationBar.clipsToBounds = clipsToBounds;
63
 }
59
 }

+ 0
- 13
playground/ios/NavigationTests/RNNStackPresenterTest.m 查看文件

25
 	self.options = [[RNNNavigationOptions alloc] initEmptyOptions];
25
 	self.options = [[RNNNavigationOptions alloc] initEmptyOptions];
26
 }
26
 }
27
 
27
 
28
-- (void)testApplyOptions_shouldSetBackButtonColor_withDefaultValues {
29
-	[[(id)_boundViewController expect] setBackButtonColor:nil];
30
-	[self.uut applyOptions:self.options];
31
-	[(id)_boundViewController verify];
32
-}
33
-
34
-- (void)testApplyOptions_shouldSetBackButtonColor_withColor {
35
-	self.options.topBar.backButton.color = [[Color alloc] initWithValue:[UIColor redColor]];
36
-	[[(id)_boundViewController expect] setBackButtonColor:[UIColor redColor]];
37
-	[self.uut applyOptions:self.options];
38
-	[(id)_boundViewController verify];
39
-}
40
-
41
 - (void)testApplyOptionsBeforePoppingShouldSetTopBarBackgroundForPoppingViewController {
28
 - (void)testApplyOptionsBeforePoppingShouldSetTopBarBackgroundForPoppingViewController {
42
 	_options.topBar.background.color = [[Color alloc] initWithValue:[UIColor redColor]];
29
 	_options.topBar.background.color = [[Color alloc] initWithValue:[UIColor redColor]];
43
 	
30