From 57c146eb7e85f55115b3e054d07c1a8b5482e7af Mon Sep 17 00:00:00 2001 From: Dominic Go Date: Sat, 28 Sep 2024 10:31:13 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=AB=20Update:=20`ModalSheetView.presen?= =?UTF-8?q?tModal`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ModalSheetView/ModalSheetView.tsx | 17 +++++++++++++---- .../ModalSheetView/ModalSheetViewTypes.tsx | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/components/ModalSheetView/ModalSheetView.tsx b/src/components/ModalSheetView/ModalSheetView.tsx index 70dd1d3d..e0f85a1d 100644 --- a/src/components/ModalSheetView/ModalSheetView.tsx +++ b/src/components/ModalSheetView/ModalSheetView.tsx @@ -60,10 +60,19 @@ export const ModalSheetView = React.forwardRef< })); }; - await nativeRef.current.presentModal({ - isAnimated: true, - ...commandArgs, - }); + const eventEmitter = nativeRef.current!.getEventEmitter(); + + await Promise.all([ + nativeRef.current.presentModal({ + isAnimated: true, + ...commandArgs, + }), + new Promise(resolve => { + eventEmitter.once('onModalDidShow', () => { + resolve(); + }); + }), + ]); }, dismissModal: async (commandArgs) => { if(nativeRef.current == null) { diff --git a/src/components/ModalSheetView/ModalSheetViewTypes.tsx b/src/components/ModalSheetView/ModalSheetViewTypes.tsx index b2e62d87..5ea0e2d9 100644 --- a/src/components/ModalSheetView/ModalSheetViewTypes.tsx +++ b/src/components/ModalSheetView/ModalSheetViewTypes.tsx @@ -8,6 +8,7 @@ import type { RNIModalSheetViewProps, RNIModalSheetViewRef } from "../../native_ type ModalSheetViewRefInherited = Pick; type ModalSheetViewRefInheritedRaw = Pick