Skip to content

Commit

Permalink
🛠 Refactor: Types - Extract RNIModalData
Browse files Browse the repository at this point in the history
Summary: Extract `RNIModalData` type from `src/types/RNIModalTypes` to `src/native_components/RNIModalView/RNIModalViewEventData`.
  • Loading branch information
dominicstop committed May 5, 2023
1 parent 3af9dfa commit f7023ed
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 31 deletions.
32 changes: 1 addition & 31 deletions src/native_components/RNIModalView/RNIModalViewEventData.ts
Original file line number Diff line number Diff line change
@@ -1,39 +1,9 @@
import type { CGPoint, CGSize } from 'src/types/NativeTypes';

import type {
ModalFocusState,
ModalPresentationState,
} from 'src/types/RNIModalTypes';
import type { RNIModalData } from 'src/types/RNIModalTypes';

// Event Object Types
// ------------------

/** Based on `RNIModalData` */
export type RNIModalData = {
modalNativeID: string;
modalIndex: number;
modalIndexPrev: 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 RNIModalBaseEventData = RNIModalData & {
reactTag: number;
Expand Down
26 changes: 26 additions & 0 deletions src/types/RNIModalTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,29 @@ export type ModalPresentationState =
| 'DISMISSING_UNKNOWN'
| 'DISMISS_GESTURE_CANCELLING'
| 'DISMISSED';

/** Based on `RNIModalData` */
export type RNIModalData = {
modalNativeID: string;
modalIndex: number;
modalIndexPrev: 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;
};

0 comments on commit f7023ed

Please sign in to comment.