Skip to content

Commit

Permalink
fix: fix transparent modal when another screen is pushed on top
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 authored and MohamedLamineAllal committed Feb 4, 2022
1 parent 9868318 commit d671b5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion example/src/Screens/StackTransparent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const DialogScreen = ({

return (
<View style={styles.container}>
<Pressable style={styles.backdrop} onPress={() => navigation.goBack()} />
<Pressable style={styles.backdrop} onPress={navigation.goBack} />
<Animated.View
style={[
styles.dialog,
Expand Down
7 changes: 6 additions & 1 deletion packages/stack/src/views/Stack/CardStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,12 @@ export default class CardStack extends React.Component<Props, State> {
if (detachPreviousScreen === false) {
activeScreensLimit++;
} else {
break;
// Check at least last 2 screens before stopping
// This will make sure that screen isn't detached when another screen is animating on top of the transparent one
// For example, (Opaque -> Transparent -> Opaque)
if (i <= scenes.length - 2) {
break;
}
}
}

Expand Down

0 comments on commit d671b5e

Please sign in to comment.