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

34 lines
2.1 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(