Skip to content

Instantly share code, notes, and snippets.

@bryanmylee
Last active March 30, 2024 17:53
Show Gist options
  • Save bryanmylee/31b2c9c81b1e1155afeb01ce12b5afd7 to your computer and use it in GitHub Desktop.
Save bryanmylee/31b2c9c81b1e1155afeb01ce12b5afd7 to your computer and use it in GitHub Desktop.
Tamagui Bottom Sheet
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