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