@@ -568,12 +568,15 @@ const BottomNavigationBar = <Route extends BaseRoute>({
568568 outputRange : [ 1 , 0 ] ,
569569 } ) ;
570570
571- const v3ActiveOpacity = focused ? 1 : 0 ;
572- const v3InactiveOpacity = shifting
573- ? inactiveOpacity
574- : focused
575- ? 0
576- : 1 ;
571+ const getActiveOpacity = ( ) => {
572+ if ( shiftingAndLabeled ) return activeOpacity ;
573+ return focused ? 1 : 0 ;
574+ } ;
575+
576+ const getInactiveOpacity = ( ) => {
577+ if ( shiftingAndLabeled ) return inactiveOpacity ;
578+ return focused ? 0 : 1 ;
579+ } ;
577580
578581 // Scale horizontally the outline pill
579582 const outlineScale = focused
@@ -607,7 +610,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
607610 : 0 ,
608611 } ;
609612
610- const isLegacyOrV3Shifting = shifting && labeled ;
613+ const shiftingAndLabeled = shifting && labeled ;
611614
612615 return renderTouchable ( {
613616 key : route . key ,
@@ -627,14 +630,14 @@ const BottomNavigationBar = <Route extends BaseRoute>({
627630 pointerEvents = "none"
628631 style = {
629632 labeled
630- ? styles . v3TouchableContainer
631- : styles . v3NoLabelContainer
633+ ? styles . touchableContainer
634+ : styles . noLabelContainer
632635 }
633636 >
634637 < Animated . View
635638 style = { [
636639 styles . iconContainer ,
637- isLegacyOrV3Shifting && {
640+ shiftingAndLabeled && {
638641 transform : [ { translateY } ] ,
639642 } ,
640643 ] }
@@ -659,9 +662,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
659662 style = { [
660663 styles . iconWrapper ,
661664 {
662- opacity : isLegacyOrV3Shifting
663- ? activeOpacity
664- : v3ActiveOpacity ,
665+ opacity : getActiveOpacity ( ) ,
665666 } ,
666667 ] }
667668 >
@@ -683,9 +684,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
683684 style = { [
684685 styles . iconWrapper ,
685686 {
686- opacity : isLegacyOrV3Shifting
687- ? inactiveOpacity
688- : v3InactiveOpacity ,
687+ opacity : getInactiveOpacity ( ) ,
689688 } ,
690689 ] }
691690 >
@@ -723,9 +722,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
723722 style = { [
724723 styles . labelWrapper ,
725724 {
726- opacity : isLegacyOrV3Shifting
727- ? activeOpacity
728- : v3ActiveOpacity ,
725+ opacity : getActiveOpacity ( ) ,
729726 } ,
730727 ] }
731728 >
@@ -756,9 +753,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
756753 style = { [
757754 styles . labelWrapper ,
758755 {
759- opacity : isLegacyOrV3Shifting
760- ? inactiveOpacity
761- : v3InactiveOpacity ,
756+ opacity : getInactiveOpacity ( ) ,
762757 } ,
763758 ] }
764759 >
@@ -862,11 +857,11 @@ const styles = StyleSheet.create({
862857 position : 'absolute' ,
863858 left : 0 ,
864859 } ,
865- v3TouchableContainer : {
860+ touchableContainer : {
866861 paddingTop : 12 ,
867862 paddingBottom : 16 ,
868863 } ,
869- v3NoLabelContainer : {
864+ noLabelContainer : {
870865 height : 80 ,
871866 justifyContent : 'center' ,
872867 alignItems : 'center' ,
0 commit comments