Files
otunes/patches/react-native-screens@4.30.0.patch

59 lines
3.5 KiB
Diff

diff --git a/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/appearance/TabsAppearanceApplicator.kt b/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/appearance/TabsAppearanceApplicator.kt
index cbe9b978ced6972a51bc5235b47a58dd55836351..b7063502332a7d1da5cb58ea8738670a9d3f5e87 100644
--- a/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/appearance/TabsAppearanceApplicator.kt
+++ b/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/appearance/TabsAppearanceApplicator.kt
@@ -186,16 +186,24 @@ internal class TabsAppearanceApplicator(
val rippleColor =
tabBarAppearance?.tabBarItemRippleColor
?: resolveColorAttr(context, R.attr.itemRippleColor)
- bottomNavigationView.itemRippleColor = ColorStateList.valueOf(rippleColor)
+ // Material recreates the ripple drawable on these setters, even when
+ // values are unchanged. Preserve an in-flight press across tab updates.
+ if (bottomNavigationView.itemRippleColor?.defaultColor != rippleColor) {
+ bottomNavigationView.itemRippleColor = ColorStateList.valueOf(rippleColor)
+ }
// Active Indicator
val activeIndicatorColor =
tabBarAppearance?.tabBarItemActiveIndicatorColor
?: resolveColorAttr(context, R.attr.colorSecondaryContainer)
- bottomNavigationView.isItemActiveIndicatorEnabled =
- tabBarAppearance?.tabBarItemActiveIndicatorEnabled ?: true
- bottomNavigationView.itemActiveIndicatorColor = ColorStateList.valueOf(activeIndicatorColor)
+ val activeIndicatorEnabled = tabBarAppearance?.tabBarItemActiveIndicatorEnabled ?: true
+ if (bottomNavigationView.isItemActiveIndicatorEnabled != activeIndicatorEnabled) {
+ bottomNavigationView.isItemActiveIndicatorEnabled = activeIndicatorEnabled
+ }
+ if (bottomNavigationView.itemActiveIndicatorColor?.defaultColor != activeIndicatorColor) {
+ bottomNavigationView.itemActiveIndicatorColor = ColorStateList.valueOf(activeIndicatorColor)
+ }
}
fun updateFontStyles(
diff --git a/ios/tabs/host/RNSTabBarController.mm b/ios/tabs/host/RNSTabBarController.mm
index bc9c64436da76959ecdc22539b94ce459e1e4ed2..8fb814a2a8f9b669419d59620e8082c2e01943fa 100644
--- a/ios/tabs/host/RNSTabBarController.mm
+++ b/ios/tabs/host/RNSTabBarController.mm
@@ -354,6 +354,8 @@ static void rns_pushViewController(__unsafe_unretained id self,
[self updateTabBarA11yIfNeeded];
[self updateProminentIdentifierIfNeeded];
[self updateOrientationIfNeeded];
+ // Allow app-owned sidebar groups to be restored after router tab reconciliation.
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"oTunesTabsDidUpdate" object:self];
}
/**
@@ -415,8 +417,9 @@ static void rns_pushViewController(__unsafe_unretained id self,
- (void)userDidSelectViewController:(nonnull UIViewController *)viewController
{
// At this moment the `UITabBarController` model is already updated.
- RCTAssert(self.selectedViewController == viewController,
- @"[RNScreens] Expected UIKit to update selectedViewController");
+ // A tab group exposes its root controller here, while selectedTab is the selected leaf.
+ RCTAssert([self effectiveSelectedViewController] == viewController,
+ @"[RNScreens] Expected UIKit to update the effective selection");
if (![self usesUITabAPI] && [self isSelectedViewControllerTheMoreNavigationController]) {
[self disableNavigationBarInMoreNavigationController];