Skip to content

Commit

Permalink
fix: android elevation issue (#3617)
Browse files Browse the repository at this point in the history
Co-authored-by: Tomasz Janiczek <[email protected]>
  • Loading branch information
tjaniczek and Tomasz Janiczek authored Feb 6, 2023
1 parent e4aefd0 commit 6a863cd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/BottomNavigation/BottomNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ const BottomNavigation = ({
}

if (index !== navigationState.index) {
prevNavigationState.current = navigationState;
onIndexChange(index);
}
};
Expand All @@ -613,6 +614,7 @@ const BottomNavigation = ({
(route) => route.key === key
);

prevNavigationState.current = navigationState;
onIndexChange(index);
},
[navigationState.routes, onIndexChange]
Expand Down Expand Up @@ -694,6 +696,12 @@ const BottomNavigation = ({
}

const focused = navigationState.index === index;
const previouslyFocused =
prevNavigationState.current?.index === index;
const countAlphaOffscreen =
sceneAnimationEnabled && (focused || previouslyFocused);
const renderToHardwareTextureAndroid =
sceneAnimationEnabled && focused;

const opacity = sceneAnimationEnabled
? tabsPositionAnims[index].interpolate({
Expand Down Expand Up @@ -743,9 +751,9 @@ const BottomNavigation = ({
>
<Animated.View
{...(Platform.OS === 'android' && {
needsOffscreenAlphaCompositing: sceneAnimationEnabled,
needsOffscreenAlphaCompositing: countAlphaOffscreen,
})}
renderToHardwareTextureAndroid={sceneAnimationEnabled}
renderToHardwareTextureAndroid={renderToHardwareTextureAndroid}
style={[
styles.content,
{
Expand Down

0 comments on commit 6a863cd

Please sign in to comment.