diff --git a/src/index.ts b/src/index.ts index c20320d6..4f0db48d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,3 +10,4 @@ export * from './native_modules/RNIModalViewModule'; export * from './types/UIModalTypes'; export * from './types/UIBlurEffectStyles'; +export * from './types/RNIModalViewRelatedTypes'; diff --git a/src/native_components/RNIModalView/RNIModalViewEvents.ts b/src/native_components/RNIModalView/RNIModalViewEvents.ts index 59d3e4a5..901bb8bb 100644 --- a/src/native_components/RNIModalView/RNIModalViewEvents.ts +++ b/src/native_components/RNIModalView/RNIModalViewEvents.ts @@ -1,17 +1,47 @@ import type { NativeSyntheticEvent } from 'react-native'; +import type { + ModalFocusState, + ModalPresentationState, +} from 'src/types/RNIModalViewRelatedTypes'; + // Event Object Types // ------------------ /** * Based on `RNIModalData` */ -export type RNIModalData = {}; +export type RNIModalData = { + modalNativeID: string; + modalIndex: number; + currentModalIndex: number; + modalFocusState: ModalFocusState; + modalFocusStatePref: ModalFocusState; + wasBlurCancelled: boolean; + wasFocusCancelled: boolean; + modalPresentationState: ModalPresentationState; + modalPresentationStatePrev: ModalPresentationState; + isInitialPresent: boolean; + wasCancelledPresent: boolean; + wasCancelledDismiss: boolean; + wasCancelledDismissViaGesture: boolean; + isModalPresented: boolean; + isModalInFocus: boolean; + computedIsModalInFocus: boolean; + computedIsModalPresented: boolean; + computedModalIndex: number; + computedViewControllerIndex: number; + computedCurrentModalIndex: number; + synthesizedWindowID?: string; +}; /** * Based on `RNIModalBaseEventData` */ -export type RNIModalBaseEvent = RNIModalData & {}; +export type RNIModalBaseEvent = RNIModalData & { + reactTag: number; + modalID?: string; +}; /** * Based on `RNIOnModalFocusEventData` diff --git a/src/types/RNIModalViewRelatedTypes.ts b/src/types/RNIModalViewRelatedTypes.ts new file mode 100644 index 00000000..4e5e6c08 --- /dev/null +++ b/src/types/RNIModalViewRelatedTypes.ts @@ -0,0 +1,20 @@ +/** Maps to `RNIModalFocusState` */ +export type ModalFocusState = + | 'INITIAL' + | 'FOCUSING' + | 'FOCUSED' + | 'BLURRING' + | 'BLURRED'; + +/** Maps to `RNIModalPresentationState` */ +export type ModalPresentationState = + | 'INITIAL' + | 'PRESENTING_PROGRAMMATIC' + | 'PRESENTING_UNKNOWN' + | 'PRESENTED' + | 'PRESENTED_UNKNOWN' + | 'DISMISSING_GESTURE' + | 'DISMISSING_PROGRAMMATIC' + | 'DISMISSING_UNKNOWN' + | 'DISMISS_GESTURE_CANCELLING' + | 'DISMISSED';