Skip to content

Commit

Permalink
⭐️ Impl: Types - Add ModalViewEventEmitter
Browse files Browse the repository at this point in the history
TODO:2023-03-04-04-20-46 - Library Typescript Re-Write
  • Loading branch information
dominicstop committed Mar 3, 2023
1 parent d1dde2c commit bfef8d9
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/components/ModalView/ModalViewEmitter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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 {
onModalBlur = 'onModalBlur',
onModalFocus = 'onModalFocus',
onModalShow = 'onModalShow',
onModalDismiss = 'onModalDismiss',
onModalDidDismiss = 'onModalDidDismiss',
onModalWillDismiss = 'onModalWillDismiss',
onModalAttemptDismiss = 'onModalAttemptDismiss',
}

export type ModalViewEmitterEventMap =
// prettier-ignore
KeyMapType<ModalViewEmitterEvents, {
onModalBlur: OnModalBlurEventObject['nativeEvent'];
onModalFocus: OnModalFocusEventObject['nativeEvent'];
onModalShow: OnModalShowEventObject['nativeEvent'];
onModalDismiss: OnModalDismissEventObject['nativeEvent'];
onModalDidDismiss: OnModalDidDismissEventObject['nativeEvent'];
onModalWillDismiss: OnModalWillDismissEventObject['nativeEvent'];
onModalAttemptDismiss: OnModalAttemptDismissEventObject['nativeEvent'];
}
>;

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

0 comments on commit bfef8d9

Please sign in to comment.