()
| 11 | import { withModalProvider } from './withModalProvider'; |
| 12 | |
| 13 | const StackExample = () => { |
| 14 | // hooks |
| 15 | const { dismiss, dismissAll } = useBottomSheetModal(); |
| 16 | |
| 17 | // refs |
| 18 | const bottomSheetModalARef = useRef<BottomSheetModal>(null); |
| 19 | const bottomSheetModalBRef = useRef<BottomSheetModal>(null); |
| 20 | const bottomSheetModalCRef = useRef<BottomSheetModal>(null); |
| 21 | |
| 22 | // variables |
| 23 | const snapPoints = useMemo(() => ['25%', '50%'], []); |
| 24 | |
| 25 | // callbacks |
| 26 | const handlePresentAPress = useCallback(() => { |
| 27 | if (bottomSheetModalARef.current) { |
| 28 | bottomSheetModalARef.current.present(); |
| 29 | } |
| 30 | }, []); |
| 31 | const handleDismissAPress = useCallback(() => { |
| 32 | if (bottomSheetModalARef.current) { |
| 33 | bottomSheetModalARef.current.dismiss(); |
| 34 | } |
| 35 | }, []); |
| 36 | const handlePresentBPress = useCallback(() => { |
| 37 | if (bottomSheetModalBRef.current) { |
| 38 | bottomSheetModalBRef.current.present(); |
| 39 | } |
| 40 | }, []); |
| 41 | const handleDismissBPress = useCallback(() => { |
| 42 | if (bottomSheetModalBRef.current) { |
| 43 | bottomSheetModalBRef.current.dismiss(); |
| 44 | } |
| 45 | }, []); |
| 46 | const handlePresentCPress = useCallback(() => { |
| 47 | if (bottomSheetModalCRef.current) { |
| 48 | bottomSheetModalCRef.current.present(); |
| 49 | } |
| 50 | }, []); |
| 51 | const handleDismissCPress = useCallback(() => { |
| 52 | if (bottomSheetModalCRef.current) { |
| 53 | bottomSheetModalCRef.current.dismiss(); |
| 54 | } |
| 55 | }, []); |
| 56 | const handleDismissAllPress = useCallback(() => { |
| 57 | dismissAll(); |
| 58 | }, [dismissAll]); |
| 59 | const handleDismissByHookPress = useCallback(() => { |
| 60 | dismiss('A'); |
| 61 | }, [dismiss]); |
| 62 | |
| 63 | // renders |
| 64 | const renderHeaderHandle = useCallback( |
| 65 | (title: string) => (props: BottomSheetHandleProps) => ( |
| 66 | <HeaderHandle {...props}>{title}</HeaderHandle> |
| 67 | ), |
| 68 | [] |
| 69 | ); |
| 70 | const renderBottomSheetContent = useCallback( |
nothing calls this directly
no test coverage detected