Skip to content

Commit

Permalink
fix: RESIZE should never animate the content opacity
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Dec 28, 2020
1 parent d5e3437 commit 2470ccc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
27 changes: 27 additions & 0 deletions pages/fixtures/experiments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,32 @@ function Nine() {
)
}

function Ten() {
const [open, setOpen] = useState(false)

return (
<>
<Button onClick={() => setOpen(true)}>10</Button>
<BottomSheet
open={open}
onDismiss={() => setOpen(false)}
defaultSnap={({ snapPoints }) => Math.max(...snapPoints)}
snapPoints={({ minHeight, maxHeight }) =>
[maxHeight, maxHeight * 0.7, maxHeight * 0.3].map((v) =>
Math.min(v, minHeight)
)
}
>
<SheetContent>
<Expandable>
<div className="bg-gray-200 block rounded-md h-screen w-full my-10" />
</Expandable>
</SheetContent>
</BottomSheet>
</>
)
}

export default function ExperimentsFixturePage() {
return (
<Container
Expand All @@ -405,6 +431,7 @@ export default function ExperimentsFixturePage() {
<Seven />
<Eight />
<Nine />
<Ten />
</Container>
)
}
4 changes: 2 additions & 2 deletions src/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,12 @@ export const BottomSheet = React.forwardRef<
const snap = findSnapRef.current(heightRef.current)
heightRef.current = snap
lastSnapRef.current = snap

await asyncSet({
y: snap,
ready: 1,
maxHeight: maxHeightRef.current,
maxSnap: maxSnapRef.current,
minSnap: defaultSnapRef.current,
minSnap: minSnapRef.current,
immediate: prefersReducedMotion.current,
})
}, [asyncSet, lastSnapRef, prefersReducedMotion]),
Expand Down

0 comments on commit 2470ccc

Please sign in to comment.