Skip to content

Commit

Permalink
🛠 Refactor: Types - Replace TUI Prefix
Browse files Browse the repository at this point in the history
Related:
* `TODO:2023-05-03-20-17-56` - Refactor: Types - Typescript type names should match native type names that they are representing.

Summary: Replace `TUI` prefix w/ `UI`.
  • Loading branch information
dominicstop committed May 3, 2023
1 parent e628209 commit ab5dea0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions example/src/examples/Test01.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import { CardBody, CardButton, CardTitle } from '../components/Card';

import {
ModalView,
TUIModalPresentationStyle,
UIModalPresentationStyle,
UIModalPresentationStyles,
} from 'react-native-ios-modal';

import { ObjectPropertyDisplay } from '../components/ObjectPropertyDisplay';

const availablePresentationStyles = Object.keys(
UIModalPresentationStyles
) as Array<TUIModalPresentationStyle>;
) as Array<UIModalPresentationStyle>;

const totalPresentationStylesCount = availablePresentationStyles.length ?? 0;

Expand Down
12 changes: 6 additions & 6 deletions src/constants/Enums.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { TUIBlurEffectStyles } from 'src/types/NativeTypes';
import type { UIBlurEffectStyle } from 'src/types/NativeTypes';

import type {
TUIModalPresentationStyle,
TUIModalTransitionStyle,
UIModalPresentationStyle,
UIModalTransitionStyle,
} from 'src/types/NativeTypes';

export const UIBlurEffectStyles: {
[T in TUIBlurEffectStyles]: T;
[T in UIBlurEffectStyle]: T;
} = {
// Adaptable Styles
systemUltraThinMaterial: 'systemUltraThinMaterial',
Expand Down Expand Up @@ -39,7 +39,7 @@ export const UIBlurEffectStyles: {
};

export const UIModalPresentationStyles: {
[T in TUIModalPresentationStyle]: T;
[T in UIModalPresentationStyle]: T;
} = {
automatic: 'automatic',
fullScreen: 'fullScreen',
Expand All @@ -59,7 +59,7 @@ export const UIModalPresentationStyles: {
};

export const UIModalTransitionStyles: {
[T in TUIModalTransitionStyle]: T;
[T in UIModalTransitionStyle]: T;
} = {
coverVertical: 'coverVertical',
crossDissolve: 'crossDissolve',
Expand Down
24 changes: 12 additions & 12 deletions src/native_components/RNIModalView/RNIModalViewTypes.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { ViewProps } from 'react-native';

import type {
TUIModalPresentationStyle,
TUIModalTransitionStyle,
TUISheetPresentationControllerDetents,
TUIBlurEffectStyles,
UIModalPresentationStyle,
UIModalTransitionStyle,
UISheetPresentationControllerDetents,
UIBlurEffectStyle,
} from 'src/types/NativeTypes';

import type { RNIModalCustomSheetDetent } from 'src/types/RNIModalTypes';
Expand Down Expand Up @@ -48,13 +48,13 @@ export type RNIModalViewBaseProps = {

isModalBGBlurred?: boolean;
isModalBGTransparent?: boolean;
modalBGBlurEffectStyle?: TUIBlurEffectStyles;
modalBGBlurEffectStyle?: UIBlurEffectStyle;

// Props - Presentation/Transition
// -------------------------------

modalTransitionStyle?: TUIModalTransitionStyle;
modalPresentationStyle?: TUIModalPresentationStyle;
modalTransitionStyle?: UIModalTransitionStyle;
modalPresentationStyle?: UIModalPresentationStyle;

hideNonVisibleModals?: boolean;
presentViaMount?: boolean;
Expand All @@ -66,7 +66,7 @@ export type RNIModalViewBaseProps = {
// ---------------------

modalSheetDetents?: Array<
TUISheetPresentationControllerDetents | RNIModalCustomSheetDetent
UISheetPresentationControllerDetents | RNIModalCustomSheetDetent
>;

sheetPrefersScrollingExpandsWhenScrolledToEdge?: boolean;
Expand All @@ -78,12 +78,12 @@ export type RNIModalViewBaseProps = {
sheetPreferredCornerRadius?: number;

sheetLargestUndimmedDetentIdentifier?: UnionWithAutoComplete<
TUISheetPresentationControllerDetents,
UISheetPresentationControllerDetents,
string
>;

sheetSelectedDetentIdentifier?: UnionWithAutoComplete<
TUISheetPresentationControllerDetents,
UISheetPresentationControllerDetents,
string
>;

Expand Down Expand Up @@ -124,6 +124,6 @@ export type RNIModalViewBaseProps = {
export type RNIModalViewProps = Partial<ViewProps> & RNIModalViewBaseProps;

export type RNIModalViewConstantMap = ViewManagerConstantMap<{
availableBlurEffectStyles: TUIBlurEffectStyles[];
availablePresentationStyles: TUIModalPresentationStyle[];
availableBlurEffectStyles: UIBlurEffectStyle[];
availablePresentationStyles: UIModalPresentationStyle[];
}>;
8 changes: 4 additions & 4 deletions src/types/NativeTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ export type CGPoint = {
y: number;
};

export type TUIModalTransitionStyle =
export type UIModalTransitionStyle =
| 'coverVertical'
| 'flipHorizontal'
| 'crossDissolve'
| 'partialCurl';

export type TUIModalPresentationStyle =
export type UIModalPresentationStyle =
| 'automatic'
| 'none'
| 'fullScreen'
Expand All @@ -30,12 +30,12 @@ export type TUIModalPresentationStyle =
| 'blurOverFullScreen';

/** Maps to `UISheetPresentationController.Detents` */
export type TUISheetPresentationControllerDetents =
export type UISheetPresentationControllerDetents =
| 'medium'
| 'large';

/** Maps to `UIBlurEffect.Style` */
export type TUIBlurEffectStyles =
export type UIBlurEffectStyle =
| 'systemUltraThinMaterial'
| 'systemThinMaterial'
| 'systemMaterial'
Expand Down

0 comments on commit ab5dea0

Please sign in to comment.