Skip to content

Commit

Permalink
Fix backButton.color change on mergeOptions (#6145)
Browse files Browse the repository at this point in the history
Co-authored-by: Guy Carmeli <[email protected]>
  • Loading branch information
yogevbd and guyca authored Apr 21, 2020
1 parent 03dd211 commit da0fd19
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 25 deletions.
5 changes: 0 additions & 5 deletions lib/ios/RNNStackPresenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ - (void)applyOptions:(RNNNavigationOptions *)options {

[stack setNavigationBarBlur:[withDefault.topBar.background.blur getWithDefaultValue:NO]];
[stack setNavigationBarClipsToBounds:[withDefault.topBar.background.clipToBounds getWithDefaultValue:NO]];
[stack setBackButtonColor:[withDefault.topBar.backButton.color getWithDefaultValue:nil]];

[stack.view setBackgroundColor:[withDefault.layout.backgroundColor getWithDefaultValue:nil]];
}
Expand Down Expand Up @@ -114,10 +113,6 @@ - (void)mergeOptions:(RNNNavigationOptions *)options resolvedOptions:(RNNNavigat
if (options.topBar.background.blur.hasValue) {
[stack setNavigationBarBlur:[options.topBar.background.blur get]];
}

if (options.topBar.backButton.color.hasValue) {
[stack setBackButtonColor:options.topBar.backButton.color.get];
}

if (options.topBar.background.component.name.hasValue) {
[self setCustomNavigationComponentBackground:options perform:nil];
Expand Down
2 changes: 1 addition & 1 deletion lib/ios/TopBarPresenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ - (void)setBackButtonOptions:(RNNBackButtonOptions *)backButtonOptions {

NSArray* stackChildren = self.navigationController.viewControllers;
UIViewController *lastViewControllerInStack = stackChildren.count > 1 ? stackChildren[stackChildren.count - 2] : self.navigationController.topViewController;
UIBarButtonItem *backItem = lastViewControllerInStack.navigationItem.backBarButtonItem ?: [UIBarButtonItem new];
UIBarButtonItem *backItem = [UIBarButtonItem new];
backItem.accessibilityIdentifier = testID;

icon = color
Expand Down
2 changes: 0 additions & 2 deletions lib/ios/UINavigationController+RNNOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,4 @@

- (void)setNavigationBarClipsToBounds:(BOOL)clipsToBounds;

- (void)setBackButtonColor:(UIColor *)color;

@end
4 changes: 0 additions & 4 deletions lib/ios/UINavigationController+RNNOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ - (void)setNavigationBarBlur:(BOOL)blur {
}
}

- (void)setBackButtonColor:(UIColor *)color {
self.navigationBar.tintColor = color;
}

- (void)setNavigationBarClipsToBounds:(BOOL)clipsToBounds {
self.navigationBar.clipsToBounds = clipsToBounds;
}
Expand Down
13 changes: 0 additions & 13 deletions playground/ios/NavigationTests/RNNStackPresenterTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,6 @@ - (void)setUp {
self.options = [[RNNNavigationOptions alloc] initEmptyOptions];
}

- (void)testApplyOptions_shouldSetBackButtonColor_withDefaultValues {
[[(id)_boundViewController expect] setBackButtonColor:nil];
[self.uut applyOptions:self.options];
[(id)_boundViewController verify];
}

- (void)testApplyOptions_shouldSetBackButtonColor_withColor {
self.options.topBar.backButton.color = [[Color alloc] initWithValue:[UIColor redColor]];
[[(id)_boundViewController expect] setBackButtonColor:[UIColor redColor]];
[self.uut applyOptions:self.options];
[(id)_boundViewController verify];
}

- (void)testApplyOptionsBeforePoppingShouldSetTopBarBackgroundForPoppingViewController {
_options.topBar.background.color = [[Color alloc] initWithValue:[UIColor redColor]];

Expand Down

0 comments on commit da0fd19

Please sign in to comment.