Skip to content

Commit

Permalink
💫 Update: ModalSheetView.presentModal
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed Sep 28, 2024
1 parent 0fac24c commit 57c146e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/components/ModalSheetView/ModalSheetView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>(resolve => {
eventEmitter.once('onModalDidShow', () => {
resolve();
});
}),
]);
},
dismissModal: async (commandArgs) => {
if(nativeRef.current == null) {
Expand Down
1 change: 1 addition & 0 deletions src/components/ModalSheetView/ModalSheetViewTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type { RNIModalSheetViewProps, RNIModalSheetViewRef } from "../../native_
type ModalSheetViewRefInherited = Pick<RNIModalSheetViewRef,
| 'getCachedModalMetrics'
| 'getModalMetrics'
| 'getEventEmitter'
>;

type ModalSheetViewRefInheritedRaw = Pick<RNIModalSheetViewRef,
Expand Down

0 comments on commit 57c146e

Please sign in to comment.