Skip to content

Commit ac5fcf6

Browse files
committed
fix(bottom-tabs,iOS): regression in JS tab change - wrong signal sent to controller (#19)
## Description software-mansion/react-native-screens-labs@6576ef2 introduced a regression causing js tab change to not work. ## Changes This PR restores correct behaviour on focus change. ## Test code and steps to reproduce `TestBottomTabs` ## Checklist - [x] Included code example that can be used to test this change - [ ] Ensured that CI passes
1 parent ebda803 commit ac5fcf6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ios/bottom-tabs/RNSBottomTabsScreenComponentView.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ - (void)updateProps:(const facebook::react::Props::Shared &)props
122122

123123
if (newComponentProps.isFocused != oldComponentProps.isFocused) {
124124
_isSelectedScreen = newComponentProps.isFocused;
125-
tabItemNeedsAppearanceUpdate = true;
125+
[_controller tabScreenFocusHasChanged];
126126
}
127127

128128
if (newComponentProps.badgeValue != oldComponentProps.badgeValue) {

ios/bottom-tabs/RNSTabBarController.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ - (void)setNeedsUpdateOfTabBarAppearance:(bool)needsUpdateOfTabBarAppearance
4949

5050
- (void)reactMountingTransactionWillMount
5151
{
52+
NSLog(@"TabBarCtrl mountintTransactionWillMount");
5253
}
5354

5455
- (void)reactMountingTransactionDidMount
5556
{
57+
NSLog(@"TabBarCtrl mountintTransactionDidMount running updates");
5658
[self updateReactChildrenControllersIfNeeded];
5759
[self updateSelectedViewControllerIfNeeded];
5860
[self updateTabBarAppearanceIfNeeded];
@@ -69,6 +71,7 @@ - (void)updateReactChildrenControllersIfNeeded
6971

7072
- (void)updateReactChildrenControllers
7173
{
74+
NSLog(@"TabBarCtrl updateReactChildrenControllers");
7275
_needsUpdateOfReactChildrenControllers = false;
7376

7477
if (_tabScreenControllers == nil) {
@@ -88,6 +91,7 @@ - (void)updateSelectedViewControllerIfNeeded
8891

8992
- (void)updateSelectedViewController
9093
{
94+
NSLog(@"TabBarCtrl updateSelectedViewController");
9195
_needsUpdateOfSelectedTab = false;
9296

9397
#if !defined(NDEBUG)
@@ -122,6 +126,7 @@ - (void)updateTabBarAppearanceIfNeeded
122126

123127
- (void)updateTabBarAppearance
124128
{
129+
NSLog(@"TabBarCtrl updateTabBarAppearance");
125130
_needsUpdateOfTabBarAppearance = false;
126131

127132
UIView *_Nullable maybeHostView = [self.view superview];

0 commit comments

Comments
 (0)