-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🛠 Refactor: Types - Split
RNIModalViewEvents
Summary: Extract types from `RNIModalViewEvents` into their own separate files.
- Loading branch information
1 parent
73fcbaa
commit 16c8fca
Showing
4 changed files
with
192 additions
and
148 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
src/native_components/RNIModalView/RNIModalViewEventData.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import type { CGPoint, CGSize } from 'src/types/NativeTypes'; | ||
|
||
import type { | ||
ModalFocusState, | ||
ModalPresentationState, | ||
} from 'src/types/RNIModalViewRelatedTypes'; | ||
|
||
// 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; | ||
modalID?: string; | ||
}; | ||
|
||
/** Based on `RNIOnModalFocusEventData` */ | ||
export type RNIOnModalFocusEventData = RNIModalBaseEventData & { | ||
senderInfo: RNIModalData; | ||
isInitial: boolean; | ||
}; | ||
|
||
/** Based on `RNIModalSwipeGestureEventData` */ | ||
export type RNIModalSwipeGestureEventData = { | ||
position: CGPoint; | ||
}; | ||
|
||
/** Based on `RNIModalDidSnapEventData` */ | ||
export type RNIModalDidSnapEventData = { | ||
selectedDetentIdentifier?: string; | ||
modalContentSize: CGSize; | ||
}; | ||
|
||
/** Based on RNIModalDidChangeSelectedDetentIdentifierEventData */ | ||
export type RNIModalDidChangeSelectedDetentIdentifierEventData = { | ||
sheetDetentStringPrevious?: string; | ||
sheetDetentStringCurrent?: string; | ||
}; | ||
|
||
/** Based on RNIModalDetentDidComputeEventData */ | ||
export type RNIModalDetentDidComputeEventData = { | ||
maximumDetentValue: number; | ||
computedDetentValue: number; | ||
key: string; | ||
}; |
73 changes: 73 additions & 0 deletions
73
src/native_components/RNIModalView/RNIModalViewEventObjects.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import type { NativeSyntheticEvent } from 'react-native'; | ||
|
||
import type { | ||
RNIModalBaseEventData, | ||
RNIModalDetentDidComputeEventData, | ||
RNIModalDidChangeSelectedDetentIdentifierEventData, | ||
RNIOnModalFocusEventData, | ||
RNIModalDidSnapEventData, | ||
RNIModalSwipeGestureEventData, | ||
} from './RNIModalViewEventData'; | ||
|
||
// Native Event Object | ||
// ------------------- | ||
|
||
export type OnModalWillPresentEventObject = | ||
NativeSyntheticEvent<RNIModalBaseEventData>; | ||
|
||
export type OnModalDidPresentEventObject = | ||
NativeSyntheticEvent<RNIModalBaseEventData>; | ||
|
||
export type OnModalWillDismissEventObject = | ||
NativeSyntheticEvent<RNIModalBaseEventData>; | ||
|
||
export type OnModalDidDismissEventObject = | ||
NativeSyntheticEvent<RNIModalBaseEventData>; | ||
|
||
export type OnModalWillShowEventObject = | ||
NativeSyntheticEvent<RNIModalBaseEventData>; | ||
|
||
export type OnModalDidShowEventObject = | ||
NativeSyntheticEvent<RNIModalBaseEventData>; | ||
|
||
export type OnModalWillHideEventObject = | ||
NativeSyntheticEvent<RNIModalBaseEventData>; | ||
|
||
export type OnModalDidHideEventObject = | ||
NativeSyntheticEvent<RNIModalBaseEventData>; | ||
|
||
export type OnPresentationControllerWillDismissEventObject = | ||
NativeSyntheticEvent<RNIModalBaseEventData>; | ||
|
||
export type OnPresentationControllerDidDismissEventObject = | ||
NativeSyntheticEvent<RNIModalBaseEventData>; | ||
|
||
export type OnPresentationControllerDidAttemptToDismissEventObject = | ||
NativeSyntheticEvent<RNIModalBaseEventData>; | ||
|
||
export type OnModalWillFocusEventObject = | ||
NativeSyntheticEvent<RNIOnModalFocusEventData>; | ||
|
||
export type OnModalDidFocusEventObject = | ||
NativeSyntheticEvent<RNIOnModalFocusEventData>; | ||
|
||
export type OnModalDetentDidComputeEventObject = | ||
NativeSyntheticEvent<RNIModalDetentDidComputeEventData>; | ||
|
||
export type OnModalDidChangeSelectedDetentIdentifierEventObject = | ||
NativeSyntheticEvent<RNIModalDidChangeSelectedDetentIdentifierEventData>; | ||
|
||
export type OnModalWillBlurEventObject = | ||
NativeSyntheticEvent<RNIOnModalFocusEventData>; | ||
|
||
export type OnModalDidBlurEventObject = | ||
NativeSyntheticEvent<RNIOnModalFocusEventData>; | ||
|
||
export type OnModalDidSnapEventObject = | ||
NativeSyntheticEvent<RNIModalDidSnapEventData>; | ||
|
||
export type OnModalSwipeGestureStartEventObject = | ||
NativeSyntheticEvent<RNIModalSwipeGestureEventData>; | ||
|
||
export type OnModalSwipeGestureDidEndEventObject = | ||
NativeSyntheticEvent<RNIModalSwipeGestureEventData>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
export * from './RNIModalView'; | ||
export * from './RNIModalViewEvents'; | ||
export * from './RNIModalViewEventObjects'; | ||
export * from './RNIModalViewEventData'; | ||
export * from './RNIModalViewDeprecatedEvents'; | ||
export * from './RNIModalViewTypes'; |