@@ -569,12 +569,15 @@ const BottomNavigationBar = <Route extends BaseRoute>({
569569 outputRange : [ 1 , 0 ] ,
570570 } ) ;
571571
572- const v3ActiveOpacity = focused ? 1 : 0 ;
573- const v3InactiveOpacity = shifting
574- ? inactiveOpacity
575- : focused
576- ? 0
577- : 1 ;
572+ const getActiveOpacity = ( ) => {
573+ if ( shiftingAndLabeled ) return activeOpacity ;
574+ return focused ? 1 : 0 ;
575+ } ;
576+
577+ const getInactiveOpacity = ( ) => {
578+ if ( shiftingAndLabeled ) return inactiveOpacity ;
579+ return focused ? 0 : 1 ;
580+ } ;
578581
579582 // Scale horizontally the outline pill
580583 const outlineScale = focused
@@ -608,7 +611,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
608611 : 0 ,
609612 } ;
610613
611- const isLegacyOrV3Shifting = shifting && labeled ;
614+ const shiftingAndLabeled = shifting && labeled ;
612615
613616 return renderTouchable ( {
614617 key : route . key ,
@@ -628,14 +631,14 @@ const BottomNavigationBar = <Route extends BaseRoute>({
628631 pointerEvents = "none"
629632 style = {
630633 labeled
631- ? styles . v3TouchableContainer
632- : styles . v3NoLabelContainer
634+ ? styles . touchableContainer
635+ : styles . noLabelContainer
633636 }
634637 >
635638 < Animated . View
636639 style = { [
637640 styles . iconContainer ,
638- isLegacyOrV3Shifting && {
641+ shiftingAndLabeled && {
639642 transform : [ { translateY } ] ,
640643 } ,
641644 ] }
@@ -660,9 +663,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
660663 style = { [
661664 styles . iconWrapper ,
662665 {
663- opacity : isLegacyOrV3Shifting
664- ? activeOpacity
665- : v3ActiveOpacity ,
666+ opacity : getActiveOpacity ( ) ,
666667 } ,
667668 ] }
668669 >
@@ -684,9 +685,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
684685 style = { [
685686 styles . iconWrapper ,
686687 {
687- opacity : isLegacyOrV3Shifting
688- ? inactiveOpacity
689- : v3InactiveOpacity ,
688+ opacity : getInactiveOpacity ( ) ,
690689 } ,
691690 ] }
692691 >
@@ -724,9 +723,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
724723 style = { [
725724 styles . labelWrapper ,
726725 {
727- opacity : isLegacyOrV3Shifting
728- ? activeOpacity
729- : v3ActiveOpacity ,
726+ opacity : getActiveOpacity ( ) ,
730727 } ,
731728 ] }
732729 >
@@ -757,9 +754,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
757754 style = { [
758755 styles . labelWrapper ,
759756 {
760- opacity : isLegacyOrV3Shifting
761- ? inactiveOpacity
762- : v3InactiveOpacity ,
757+ opacity : getInactiveOpacity ( ) ,
763758 } ,
764759 ] }
765760 >
@@ -863,11 +858,11 @@ const styles = StyleSheet.create({
863858 position : 'absolute' ,
864859 left : 0 ,
865860 } ,
866- v3TouchableContainer : {
861+ touchableContainer : {
867862 paddingTop : 12 ,
868863 paddingBottom : 16 ,
869864 } ,
870- v3NoLabelContainer : {
865+ noLabelContainer : {
871866 height : 80 ,
872867 justifyContent : 'center' ,
873868 alignItems : 'center' ,
0 commit comments