Skip to content

Commit 685a997

Browse files
committed
fix: bottom navigation shifting={false} active pill display
When the bottom nav has the attribute shifting={false} the pill shape is misformed on the active tabs. On clicking around this seems inconsistent. (See #4819) This appears to be because the animated view is added / removed as the tab is focused causing the animation to not play or half play. Since it starts at 0.5 scaleX this appears to the user as a squashed pill shape. The intended animation is to expand out from the center. This commit fixes this by ensuring the animation is always present and simply varies the outputRange of the animation depending on the focused state.
1 parent ff0df54 commit 685a997

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/components/BottomNavigation/BottomNavigationBar.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -671,12 +671,10 @@ const BottomNavigationBar = <Route extends BaseRoute>({
671671
: 1;
672672

673673
// Scale horizontally the outline pill
674-
const outlineScale = focused
675-
? active.interpolate({
676-
inputRange: [0, 1],
677-
outputRange: [0.5, 1],
678-
})
679-
: 0;
674+
const outlineScale = active.interpolate({
675+
inputRange: [0, 1],
676+
outputRange: focused ? [0.5, 1] : [0, 0],
677+
});
680678

681679
const badge = getBadge({ route });
682680

@@ -740,7 +738,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
740738
},
741739
]}
742740
>
743-
{isV3 && focused && (
741+
{isV3 && (
744742
<Animated.View
745743
style={[
746744
styles.outline,

0 commit comments

Comments
 (0)