diff --git a/example/src/examples/ModalSheetViewTest01.tsx b/example/src/examples/ModalSheetViewTest01.tsx index 71f33fb0..0622a4a4 100644 --- a/example/src/examples/ModalSheetViewTest01.tsx +++ b/example/src/examples/ModalSheetViewTest01.tsx @@ -1,6 +1,6 @@ /* eslint-disable react-hooks/exhaustive-deps */ import * as React from 'react'; -import { StyleSheet, Text, TouchableOpacity } from 'react-native'; +import { StyleSheet } from 'react-native'; import { ExampleItemCard, ObjectPropertyDisplay, CardButton, Colors } from 'react-native-ios-utilities'; import { ModalSheetView, ModalSheetViewMainContent, type ModalSheetViewRef } from 'react-native-ios-modal'; @@ -11,6 +11,14 @@ import type { ExampleItemProps } from './SharedExampleTypes'; export function ModalSheetViewTest01(props: ExampleItemProps) { const modalSheetViewRef = React.useRef(null); + const [ + shouldMountRecursiveContent, + setShouldMountRecursiveContent, + ] = React.useState(false); + + const recursionLevel = + props.extraProps?.recursionLevel as any as number ?? 0; + return ( { + setShouldMountRecursiveContent(true); await modalSheetViewRef.current?.presentModal(); console.log( 'ModalSheetViewTest01', - '\n - present modal completed' + '\n - present modal completed', + `\n - recursionLevel: ${recursionLevel}` ); }} /> + + {(recursionLevel != 0) && ( + { + await modalSheetViewRef.current?.dismissModal(); + console.log( + 'ModalSheetViewTest01', + '\n - dismiss modal completed', + `\n - recursionLevel: ${recursionLevel}` + ); + }} + /> + )} + modalSheetViewRef.current = ref} > - - - { - await modalSheetViewRef.current?.dismissModal(); - console.log( - 'ModalSheetViewTest01', - '\n - dismiss modal completed' - ); - }} - /> - + + {shouldMountRecursiveContent && ( + + )} + diff --git a/example/src/examples/SharedExampleTypes.ts b/example/src/examples/SharedExampleTypes.ts index 0c4306b8..0fee3e04 100644 --- a/example/src/examples/SharedExampleTypes.ts +++ b/example/src/examples/SharedExampleTypes.ts @@ -4,4 +4,5 @@ import type { ViewStyle } from "react-native"; export type ExampleItemProps = { index: number; style?: ViewStyle; + extraProps?: Record; }; \ No newline at end of file