Skip to content

Commit c6ec1cd

Browse files
committed
fix: force bottom navigation animation completion
1 parent ff0df54 commit c6ec1cd

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/components/BottomNavigation/BottomNavigationBar.tsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,26 @@ const BottomNavigationBar = <Route extends BaseRoute>({
429429
easing: animationEasing,
430430
})
431431
),
432-
]).start(() => {
433-
// Workaround a bug in native animations where this is reset after first animation
434-
tabsAnims.map((tab, i) => tab.setValue(i === index ? 1 : 0));
435-
436-
// Update the index to change bar's background color and then hide the ripple
432+
]).start((result) => {
433+
// Explicitly finish animation state to avoid RN 0.80 drops leaving tabs half-focused
434+
tabsAnims.forEach((tab, i) => {
435+
tab.stopAnimation();
436+
tab.setValue(i === index ? 1 : 0);
437+
});
438+
439+
indexAnim.stopAnimation();
437440
indexAnim.setValue(index);
441+
442+
rippleAnim.stopAnimation();
438443
rippleAnim.setValue(MIN_RIPPLE_SCALE);
444+
445+
if (result?.finished === false) {
446+
requestAnimationFrame(() => {
447+
tabsAnims.forEach((tab, i) => tab.setValue(i === index ? 1 : 0));
448+
indexAnim.setValue(index);
449+
rippleAnim.setValue(MIN_RIPPLE_SCALE);
450+
});
451+
}
439452
});
440453
},
441454
[

0 commit comments

Comments
 (0)