import { ChevronDown, ChevronUp } from '@tamagui/lucide-icons-2'
import type { SheetProps } from '@tamagui/sheet'
import { Sheet } from '@tamagui/sheet'
import React, { memo } from 'react'
import { Button, H2, Input, Paragraph, XStack, YStack } from 'tamagui'
const spModes = ['percent', 'constant', 'fit', 'mixed'] as const
export const SheetDemo = () => {
const [position, setPosition] = React.useState(0)
const [open, setOpen] = React.useState(false)
const [modal, setModal] = React.useState(true)
const [innerOpen, setInnerOpen] = React.useState(false)
const [snapPointsMode, setSnapPointsMode] =
React.useState<(typeof spModes)[number]>('percent')
const [mixedFitDemo, setMixedFitDemo] = React.useState(false)
const isPercent = snapPointsMode === 'percent'
const isConstant = snapPointsMode === 'constant'
const isFit = snapPointsMode === 'fit'
const isMixed = snapPointsMode === 'mixed'
const snapPoints = isPercent
? [85, 50, 25]
: isConstant
? [256, 190]
: isFit
? undefined
: mixedFitDemo
? ['fit', 110]
: ['80%', 256, 190]
return (
<>
{isMixed ? (
) : (
{`Snap Points: ${isFit ? '(none)' : JSON.stringify(snapPoints)}`}
)}
>
)
}
// in general good to memoize the contents to avoid expensive renders during animations
const SheetContents = memo(
({ modal, isPercent, innerOpen, setInnerOpen, setOpen }: any) => {
return (
<>