Last active
March 30, 2024 17:53
-
-
Save bryanmylee/31b2c9c81b1e1155afeb01ce12b5afd7 to your computer and use it in GitHub Desktop.
Tamagui Bottom Sheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Anchor, Button, H1, Paragraph, Separator, Sheet, Theme, XStack, YStack} from '@slipbox/ui'; | |
import {ChevronDown, ChevronUp} from '@tamagui/lucide-icons'; | |
import {useState} from 'react'; | |
function SheetDemo() { | |
const [open, setOpen] = useState(false); | |
const [position, setPosition] = useState(0); | |
return ( | |
<> | |
<Button | |
size="$6" | |
icon={open ? ChevronDown : ChevronUp} | |
circular | |
onPress={() => setOpen((x) => !x)} | |
/> | |
<Sheet | |
modal | |
open={open} | |
onOpenChange={setOpen} | |
snapPoints={[80]} | |
position={position} | |
onPositionChange={setPosition} | |
dismissOnSnapToBottom | |
> | |
<Sheet.Overlay /> | |
<Sheet.Frame ai="center" jc="center"> | |
<Sheet.Handle /> | |
<Button | |
size="$6" | |
circular | |
icon={ChevronDown} | |
onPress={() => { | |
setOpen(false); | |
}} | |
/> | |
</Sheet.Frame> | |
</Sheet> | |
</> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment