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

Conversation

WoLewicki
Copy link
Member

@WoLewicki WoLewicki commented Jul 1, 2020

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. Should resolve #550.

@@ -119,6 +119,8 @@ - (void)didUpdateReactSubviews
+ (void)setAnimatedConfig:(UIViewController *)vc withConfig:(RNSScreenStackHeaderConfig *)config
{
UINavigationBar *navbar = ((UINavigationController *)vc.parentViewController).navigationBar;
// really weird, but triggering the change of color resolves issue with custom back image, so we change it by a really small value and then back to the right one
[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

@WoLewicki WoLewicki merged commit 5b926a4 into master Jul 28, 2020
@WoLewicki WoLewicki deleted the @wolewicki/fix-custom-back-image branch July 28, 2020 14:43
WoLewicki added a commit that referenced this pull request Jan 19, 2021
The change introduced in #552 brakes the behavior of headerRight (see Test748 without the change in native code) in iOS 14, and the bug, that #552 fixed, is not present anymore in iOS 14.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

backButtonImage is not working on iPhone 11 Pro max & iPhone XS
2 participants