Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: trigger color change on every update #552

Merged
merged 3 commits into from
Jul 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ios/RNSScreenStackHeaderConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ - (void)didUpdateReactSubviews
+ (void)setAnimatedConfig:(UIViewController *)vc withConfig:(RNSScreenStackHeaderConfig *)config
{
UINavigationBar *navbar = ((UINavigationController *)vc.parentViewController).navigationBar;
// It is workaround for loading custom back icon when transitioning from a screen without header to the screen which has one.
// This action fails when navigating to the screen with header for the second time and loads default back button.
// It looks like changing the tint color of navbar triggers an update of the items belonging to it and it seems to load the custom back image
// so we change the tint color's alpha by a very small amount and then set it to the one it should have.
[navbar setTintColor:[config.color colorWithAlphaComponent:CGColorGetAlpha(config.color.CGColor) - 0.01]];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird hack xD

[navbar setTintColor:config.color];

#ifdef __IPHONE_13_0
Expand Down