@@ -569,12 +569,15 @@ const BottomNavigationBar = <Route extends BaseRoute>({
569
569
outputRange : [ 1 , 0 ] ,
570
570
} ) ;
571
571
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
+ } ;
578
581
579
582
// Scale horizontally the outline pill
580
583
const outlineScale = focused
@@ -608,7 +611,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
608
611
: 0 ,
609
612
} ;
610
613
611
- const isLegacyOrV3Shifting = shifting && labeled ;
614
+ const shiftingAndLabeled = shifting && labeled ;
612
615
613
616
return renderTouchable ( {
614
617
key : route . key ,
@@ -628,14 +631,14 @@ const BottomNavigationBar = <Route extends BaseRoute>({
628
631
pointerEvents = "none"
629
632
style = {
630
633
labeled
631
- ? styles . v3TouchableContainer
632
- : styles . v3NoLabelContainer
634
+ ? styles . touchableContainer
635
+ : styles . noLabelContainer
633
636
}
634
637
>
635
638
< Animated . View
636
639
style = { [
637
640
styles . iconContainer ,
638
- isLegacyOrV3Shifting && {
641
+ shiftingAndLabeled && {
639
642
transform : [ { translateY } ] ,
640
643
} ,
641
644
] }
@@ -660,9 +663,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
660
663
style = { [
661
664
styles . iconWrapper ,
662
665
{
663
- opacity : isLegacyOrV3Shifting
664
- ? activeOpacity
665
- : v3ActiveOpacity ,
666
+ opacity : getActiveOpacity ( ) ,
666
667
} ,
667
668
] }
668
669
>
@@ -684,9 +685,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
684
685
style = { [
685
686
styles . iconWrapper ,
686
687
{
687
- opacity : isLegacyOrV3Shifting
688
- ? inactiveOpacity
689
- : v3InactiveOpacity ,
688
+ opacity : getInactiveOpacity ( ) ,
690
689
} ,
691
690
] }
692
691
>
@@ -724,9 +723,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
724
723
style = { [
725
724
styles . labelWrapper ,
726
725
{
727
- opacity : isLegacyOrV3Shifting
728
- ? activeOpacity
729
- : v3ActiveOpacity ,
726
+ opacity : getActiveOpacity ( ) ,
730
727
} ,
731
728
] }
732
729
>
@@ -757,9 +754,7 @@ const BottomNavigationBar = <Route extends BaseRoute>({
757
754
style = { [
758
755
styles . labelWrapper ,
759
756
{
760
- opacity : isLegacyOrV3Shifting
761
- ? inactiveOpacity
762
- : v3InactiveOpacity ,
757
+ opacity : getInactiveOpacity ( ) ,
763
758
} ,
764
759
] }
765
760
>
@@ -863,11 +858,11 @@ const styles = StyleSheet.create({
863
858
position : 'absolute' ,
864
859
left : 0 ,
865
860
} ,
866
- v3TouchableContainer : {
861
+ touchableContainer : {
867
862
paddingTop : 12 ,
868
863
paddingBottom : 16 ,
869
864
} ,
870
- v3NoLabelContainer : {
865
+ noLabelContainer : {
871
866
height : 80 ,
872
867
justifyContent : 'center' ,
873
868
alignItems : 'center' ,
0 commit comments