diff --git a/src/components/ModalSheetView/ModalSheetView.tsx b/src/components/ModalSheetView/ModalSheetView.tsx index 7b5b21c9..58f43e58 100644 --- a/src/components/ModalSheetView/ModalSheetView.tsx +++ b/src/components/ModalSheetView/ModalSheetView.tsx @@ -41,6 +41,9 @@ export const ModalSheetView = React.forwardRef< ...commandArgs, }); }, + getCachedModalMetrics: () => { + return nativeRef.current?.getCachedModalMetrics(); + }, getModalMetrics: async () => { if(nativeRef.current == null) { throw Error("Unable to get ref to native sheet"); diff --git a/src/components/ModalSheetView/ModalSheetViewTypes.tsx b/src/components/ModalSheetView/ModalSheetViewTypes.tsx index 2b4bdc72..11df65e9 100644 --- a/src/components/ModalSheetView/ModalSheetViewTypes.tsx +++ b/src/components/ModalSheetView/ModalSheetViewTypes.tsx @@ -6,6 +6,7 @@ import type { RNIModalSheetViewProps, RNIModalSheetViewRef } from "../../native_ type ModalSheetViewRefInherited = Pick; diff --git a/src/native_components/RNIModalSheetVIew/RNIModalSheetView.tsx b/src/native_components/RNIModalSheetVIew/RNIModalSheetView.tsx index e3e8bae1..a45b383d 100644 --- a/src/native_components/RNIModalSheetVIew/RNIModalSheetView.tsx +++ b/src/native_components/RNIModalSheetVIew/RNIModalSheetView.tsx @@ -13,6 +13,11 @@ export const RNIModalSheetView = React.forwardRef< >((props, ref) => { const [viewID, setViewID] = React.useState(); const [reactTag, setReactTag] = React.useState(); + + const [ + cachedModalMetrics, + setCachedModalMetrics + ] = React.useState(); React.useImperativeHandle(ref, () => ({ getReactTag: () => { @@ -41,6 +46,9 @@ export const RNIModalSheetView = React.forwardRef< /* commandArgs: */ commandArgs, ); }, + getCachedModalMetrics: () => { + return cachedModalMetrics; + }, getModalMetrics: async () => { if(viewID == null) return; const module = Helpers.getRNIUtilitiesModule(); @@ -51,6 +59,7 @@ export const RNIModalSheetView = React.forwardRef< /* commandArgs: */ {}, ); + setCachedModalMetrics(result as any); return result as any; }, })); diff --git a/src/native_components/RNIModalSheetVIew/RNIModalSheetViewTypes.ts b/src/native_components/RNIModalSheetVIew/RNIModalSheetViewTypes.ts index 050f8712..d525e66f 100644 --- a/src/native_components/RNIModalSheetVIew/RNIModalSheetViewTypes.ts +++ b/src/native_components/RNIModalSheetVIew/RNIModalSheetViewTypes.ts @@ -19,6 +19,7 @@ export type RNIModalSheetViewRef = { isAnimated: boolean; }) => Promise; + getCachedModalMetrics: () => ModalMetrics | undefined; getModalMetrics: () => Promise; };