-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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 Apple TV TabBarIOS issue (#15081) #15093
Conversation
@@ -175,6 +175,18 @@ - (void)setItemPositioning:(UITabBarItemPositioning)itemPositioning | |||
|
|||
#pragma mark - UITabBarControllerDelegate | |||
|
|||
#if TARGET_OS_TV | |||
|
|||
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(nonnull UIViewController *)viewController |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didSelectViewController
seems to work fine on iOS too... if desired, we could just use this method for both iOS and tvOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'd prefer that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Removed unrelated Danger warning. |
Hmm, this may cause subtle differences. It seems like before we actually rejected all calls to |
Wow... so JS could actually select a different tab from the one the user picked? Interesting! Since tvOS tab bar works very differently, I'd suggest that we go back to my original commit that just fixes tvOS and leaves iOS behavior unchanged. |
Well the idea is that TabBarItemIOS is a controlled component: all state changes need to come from JS and not from native. I'm not sure why this doesn't work correctly on tvOS. |
In tvOS testing, I find that the way the tab bar works is very different. If you use the TV remote to navigate from one tab bar item to the next, the new tab bar item is highlighted BEFORE |
This reverts commit 77231c0.
Ok, makes sense. It does mean it's possible for JS state and native state to go out of sync though. One way classes like RCTTextView solve this is by accepting the native state change, and having the JS side immediately call setNativeProps with the desired state (even if it's the same as the old one). |
@javache has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@javache has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
I tried to merge this pull request into the Facebook internal repo but some checks failed. To unblock yourself please check the following: Does this pull request pass all open source tests on GitHub? If not please fix those. Does the code still apply cleanly on top of GitHub master? If not can please rebase. In all other cases this means some internal test failed, for example a part of a fb app won't work with this pull request. I've added the Import Failed label to this pull request so it is easy for someone at fb to find the pull request and check what failed. If you don't see anyone comment in a few days feel free to comment mentioning one of the core contributors to the project so they get a notification. |
@shergin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@hramos has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Did additional testing of the issue... this patch is part of the solution, but some additional changes are needed. Closing this, and will submit the complete fix later. |
Motivation
Fix flickering in TabBarIOS on Apple TV... issue #15081
Test plan
Existing CI should still pass. Issue is resolved when testing the example code in #15081 .