Skip to content

Commit

Permalink
⭐️ Impl: Add ModalViewEmitterDeprecated
Browse files Browse the repository at this point in the history
Related:
* `TODO:2023-03-04-13-15-11` - Refactor: Update Modal Events
* `TODO:2023-03-30-15-53-01` - Add `deprecated` suffix to deprecated events.

Summary: Move deprecated events in `ModalViewEmitter ` to `ModalViewEmitterDeprecated`, and update exports.
  • Loading branch information
dominicstop committed Apr 14, 2023
1 parent f5483ff commit 7fa4a18
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/components/ModalView/ModalViewEmitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,16 @@ import type { LayoutChangeEvent } from 'react-native';
import type { TSEventEmitter } from '@dominicstop/ts-event-emitter';

import type {
OnModalBlurEventObject,
OnModalFocusEventObject,
OnModalShowEventObject,
OnModalDismissEventObject,
OnModalDidDismissEventObject,
OnModalWillDismissEventObject,
OnModalAttemptDismissEventObject,
} from 'src/native_components/RNIModalView';

import type { KeyMapType } from '../../types/UtilityTypes';

export enum ModalViewEmitterEvents {
// `RNIModalView` Events
onModalBlur = 'onModalBlur',
onModalFocus = 'onModalFocus',
onModalShow = 'onModalShow',
onModalDismiss = 'onModalDismiss',
onModalDidDismiss = 'onModalDidDismiss',
onModalWillDismiss = 'onModalWillDismiss',
onModalAttemptDismiss = 'onModalAttemptDismiss',

onLayoutModalContentContainer = 'onLayoutModalContentContainer',
}
Expand All @@ -33,13 +23,8 @@ export type ModalViewEmitterEventMap =
// prettier-ignore
KeyMapType<ModalViewEmitterEvents, {
// `RNIModalView` Events
onModalBlur: OnModalBlurEventObject['nativeEvent'];
onModalFocus: OnModalFocusEventObject['nativeEvent'];
onModalShow: OnModalShowEventObject['nativeEvent'];
onModalDismiss: OnModalDismissEventObject['nativeEvent'];
onModalDidDismiss: OnModalDidDismissEventObject['nativeEvent'];
onModalWillDismiss: OnModalWillDismissEventObject['nativeEvent'];
onModalAttemptDismiss: OnModalAttemptDismissEventObject['nativeEvent'];

onLayoutModalContentContainer: LayoutChangeEvent['nativeEvent'];
}
Expand Down
51 changes: 51 additions & 0 deletions src/components/ModalView/ModalViewEmitterDeprecated.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import type { LayoutChangeEvent } from 'react-native';
import type { TSEventEmitter } from '@dominicstop/ts-event-emitter';

import type {
OnModalBlurEventObject,
OnModalFocusEventObject,
OnModalShowEventObject,
OnModalDismissEventObject,
OnModalDidDismissEventObject,
OnModalWillDismissEventObject,
OnModalAttemptDismissEventObject,
} from 'src/native_components/RNIModalView';

import type { KeyMapType } from '../../types/UtilityTypes';

export enum ModalViewEmitterEventsDeprecated {
// `RNIModalView` Events
onModalBlur = 'onModalBlur',
onModalFocus = 'onModalFocus',
onModalShow = 'onModalShow',
onModalDismiss = 'onModalDismiss',
onModalDidDismiss = 'onModalDidDismiss',
onModalWillDismiss = 'onModalWillDismiss',
onModalAttemptDismiss = 'onModalAttemptDismiss',

onLayoutModalContentContainer = 'onLayoutModalContentContainer',
}

// TODO: See TODO:20230-03-04-12-58-40 - Refactor: Types -
// Remove KeyMapType Usage
//
export type ModalViewEmitterEventMapDeprecated =
// prettier-ignore
KeyMapType<ModalViewEmitterEventsDeprecated, {
// `RNIModalView` Events
onModalBlur: OnModalBlurEventObject['nativeEvent'];
onModalFocus: OnModalFocusEventObject['nativeEvent'];
onModalShow: OnModalShowEventObject['nativeEvent'];
onModalDismiss: OnModalDismissEventObject['nativeEvent'];
onModalDidDismiss: OnModalDidDismissEventObject['nativeEvent'];
onModalWillDismiss: OnModalWillDismissEventObject['nativeEvent'];
onModalAttemptDismiss: OnModalAttemptDismissEventObject['nativeEvent'];

onLayoutModalContentContainer: LayoutChangeEvent['nativeEvent'];
}
>;

export type ModalViewEventEmitterDeprecated = TSEventEmitter<
ModalViewEmitterEventsDeprecated,
ModalViewEmitterEventMapDeprecated
>;
1 change: 1 addition & 0 deletions src/components/ModalView/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './ModalView';
export * from './ModalViewTypes';
export * from './ModalViewEmitter';
export * from './ModalViewEmitterDeprecated';

0 comments on commit 7fa4a18

Please sign in to comment.