From 49754e1d156b3e88ed25b6063e6dbc7a21a2dc14 Mon Sep 17 00:00:00 2001 From: Dominic Go Date: Thu, 3 Oct 2024 05:31:24 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20Refactor:=20Rename=20to=20`Modal?= =?UTF-8?q?SheetContent`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/src/examples/ModalSheetViewTest01.tsx | 6 +++--- example/src/examples/ModalSheetViewTest02.tsx | 6 +++--- example/src/examples/ModalSheetViewTest03.tsx | 6 +++--- .../ModalSheetContent.tsx} | 6 +++--- .../ModalSheetContentTypes.tsx} | 10 +++++----- .../ModalSheetMainContent.tsx | 20 +++++++++++++++++++ .../ModalSheetMainContentTypes.ts | 13 ++++++++++++ .../ModalSheetView/ModalSheetView.tsx | 4 ++-- .../ModalSheetViewMainContent.tsx | 20 ------------------- .../ModalSheetViewMainContentTypes.ts | 13 ------------ src/index.ts | 4 ++-- 11 files changed, 54 insertions(+), 54 deletions(-) rename src/components/{ModalSheetViewContent/ModalSheetViewContent.tsx => ModalSheetContent/ModalSheetContent.tsx} (91%) rename src/components/{ModalSheetViewContent/ModalSheetViewContentTypes.tsx => ModalSheetContent/ModalSheetContentTypes.tsx} (69%) create mode 100644 src/components/ModalSheetContent/ModalSheetMainContent.tsx create mode 100644 src/components/ModalSheetContent/ModalSheetMainContentTypes.ts delete mode 100644 src/components/ModalSheetViewContent/ModalSheetViewMainContent.tsx delete mode 100644 src/components/ModalSheetViewContent/ModalSheetViewMainContentTypes.ts diff --git a/example/src/examples/ModalSheetViewTest01.tsx b/example/src/examples/ModalSheetViewTest01.tsx index f50d18ae..e753ff8d 100644 --- a/example/src/examples/ModalSheetViewTest01.tsx +++ b/example/src/examples/ModalSheetViewTest01.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import { StyleSheet } from 'react-native'; import { ExampleItemCard, ObjectPropertyDisplay, CardButton, Colors } from 'react-native-ios-utilities'; -import { ModalSheetView, ModalSheetViewContext, ModalSheetViewMainContent, type ModalSheetViewRef } from 'react-native-ios-modal'; +import { ModalSheetView, ModalSheetViewContext, ModalSheetMainContent, type ModalSheetViewRef } from 'react-native-ios-modal'; import type { ExampleItemProps } from './SharedExampleTypes'; import type { ModalMetrics } from '../../../src/types/ModalMetrics'; @@ -260,7 +260,7 @@ export function ModalSheetViewTest01(props: ExampleItemProps) { ); }} > - @@ -278,7 +278,7 @@ export function ModalSheetViewTest01(props: ExampleItemProps) { /> )} - + ); diff --git a/example/src/examples/ModalSheetViewTest02.tsx b/example/src/examples/ModalSheetViewTest02.tsx index 7196977e..69de4d4a 100644 --- a/example/src/examples/ModalSheetViewTest02.tsx +++ b/example/src/examples/ModalSheetViewTest02.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import { StyleSheet } from 'react-native'; import { ExampleItemCard, ObjectPropertyDisplay, CardButton, Colors } from 'react-native-ios-utilities'; -import { ModalSheetView, ModalSheetViewContext, ModalSheetViewMainContent, useModalSheetViewEvents, type ModalSheetViewRef, type OnModalFocusChangeEventPayload } from 'react-native-ios-modal'; +import { ModalSheetView, ModalSheetViewContext, ModalSheetMainContent, useModalSheetViewEvents, type ModalSheetViewRef, type OnModalFocusChangeEventPayload } from 'react-native-ios-modal'; import type { ExampleItemProps } from './SharedExampleTypes'; import type { OnModalSheetStateWillChangeEventPayload } from '../../../src/native_components/RNIModalSheetVIew'; @@ -36,7 +36,7 @@ function ModalContent(props: { }); return ( - - + ); }; diff --git a/example/src/examples/ModalSheetViewTest03.tsx b/example/src/examples/ModalSheetViewTest03.tsx index abba41ab..aa5a57f0 100644 --- a/example/src/examples/ModalSheetViewTest03.tsx +++ b/example/src/examples/ModalSheetViewTest03.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import { StyleSheet } from 'react-native'; import { ExampleItemCard, CardButton, Colors } from 'react-native-ios-utilities'; -import { ModalSheetView, ModalSheetViewContext, ModalSheetViewMainContent, useModalSheetViewEvents, type ModalSheetViewRef } from 'react-native-ios-modal'; +import { ModalSheetView, ModalSheetViewContext, ModalSheetMainContent, useModalSheetViewEvents, type ModalSheetViewRef } from 'react-native-ios-modal'; import { LogListDisplay, type LogListDisplayRef } from '../components/LogListDisplay'; import type { ExampleItemProps } from './SharedExampleTypes'; @@ -65,7 +65,7 @@ function ModalContent(props: { }); return ( - - + ); }; diff --git a/src/components/ModalSheetViewContent/ModalSheetViewContent.tsx b/src/components/ModalSheetContent/ModalSheetContent.tsx similarity index 91% rename from src/components/ModalSheetViewContent/ModalSheetViewContent.tsx rename to src/components/ModalSheetContent/ModalSheetContent.tsx index dbef4d85..97f0a933 100644 --- a/src/components/ModalSheetViewContent/ModalSheetViewContent.tsx +++ b/src/components/ModalSheetContent/ModalSheetContent.tsx @@ -4,12 +4,12 @@ import { StyleSheet, View, type StyleProp, type ViewStyle } from 'react-native'; import { RNIWrapperView, type StateViewID } from 'react-native-ios-utilities'; import { DEFAULT_SHEET_CONTENT_ENTRY } from '../ModalSheetView/ModalSheetContentMap'; -import type { ModalSheetViewContentProps } from './ModalSheetViewContentTypes'; +import type { ModalSheetContentProps } from './ModalSheetContentTypes'; import { IS_USING_NEW_ARCH } from '../../constants/LibEnv'; -export function ModalSheetViewContent( - props: React.PropsWithChildren +export function ModalSheetContent( + props: React.PropsWithChildren ) { const [viewID, setViewID] = React.useState(); diff --git a/src/components/ModalSheetViewContent/ModalSheetViewContentTypes.tsx b/src/components/ModalSheetContent/ModalSheetContentTypes.tsx similarity index 69% rename from src/components/ModalSheetViewContent/ModalSheetViewContentTypes.tsx rename to src/components/ModalSheetContent/ModalSheetContentTypes.tsx index 035ad8fc..f3667154 100644 --- a/src/components/ModalSheetViewContent/ModalSheetViewContentTypes.tsx +++ b/src/components/ModalSheetContent/ModalSheetContentTypes.tsx @@ -5,20 +5,20 @@ import type { RNIModalSheetViewProps } from "../../native_components/RNIModalShe import type { ModalSheetContentMap } from "../ModalSheetView/ModalSheetContentMap"; -export type ModalSheetViewContentInheritedProps = Pick & Pick; -export type ModalSheetViewContentBaseProps = { +export type ModalSheetContentBaseProps = { contentContainerStyle?: ViewStyle; isParentDetached?: boolean; modalSheetContentMap?: ModalSheetContentMap; shouldMountModalContent?: boolean; }; -export type ModalSheetViewContentProps = - & ModalSheetViewContentInheritedProps - & ModalSheetViewContentBaseProps; \ No newline at end of file +export type ModalSheetContentProps = + & ModalSheetContentInheritedProps + & ModalSheetContentBaseProps; \ No newline at end of file diff --git a/src/components/ModalSheetContent/ModalSheetMainContent.tsx b/src/components/ModalSheetContent/ModalSheetMainContent.tsx new file mode 100644 index 00000000..edb464c4 --- /dev/null +++ b/src/components/ModalSheetContent/ModalSheetMainContent.tsx @@ -0,0 +1,20 @@ +import * as React from 'react'; + +import { ModalSheetContent } from './ModalSheetContent'; +import type { ModalSheetMainContentProps } from './ModalSheetMainContentTypes'; +import { ModalSheetViewNativeIDKeys } from '../ModalSheetView/ModalSheetViewNativeIDKeys'; + + +export function ModalSheetMainContent( + props: React.PropsWithChildren +) { + const { children, ...otherProps } = props; + return ( + + {children} + + ); +}; \ No newline at end of file diff --git a/src/components/ModalSheetContent/ModalSheetMainContentTypes.ts b/src/components/ModalSheetContent/ModalSheetMainContentTypes.ts new file mode 100644 index 00000000..483716ab --- /dev/null +++ b/src/components/ModalSheetContent/ModalSheetMainContentTypes.ts @@ -0,0 +1,13 @@ +import type { ModalSheetContentProps } from './ModalSheetContentTypes'; + + +export type ModalSheetMainContentInheritedProps = Pick; + +export type ModalSheetMainContentBaseProps = { +}; + +export type ModalSheetMainContentProps = + & ModalSheetMainContentInheritedProps + & ModalSheetMainContentBaseProps; \ No newline at end of file diff --git a/src/components/ModalSheetView/ModalSheetView.tsx b/src/components/ModalSheetView/ModalSheetView.tsx index e2530000..574cbcdc 100644 --- a/src/components/ModalSheetView/ModalSheetView.tsx +++ b/src/components/ModalSheetView/ModalSheetView.tsx @@ -9,7 +9,7 @@ import type { ModalSheetContentMap } from './ModalSheetContentMap'; import { DEFAULT_MODAL_SHEET_VIEW_METRICS } from './ModalSheetViewConstants'; -import type { ModalSheetViewContentProps } from '../ModalSheetViewContent/ModalSheetViewContentTypes'; +import type { ModalSheetContentProps } from '../ModalSheetContent/ModalSheetContentTypes'; import type { RNIModalSheetStateMetrics } from '../../types/RNIModalSheetStateMetrics'; import { ModalSheetViewContext, type ModalSheetViewContextType } from '../../context/ModalSheetViewContext'; @@ -123,7 +123,7 @@ export const ModalSheetView = React.forwardRef< const children = React.Children.map(props.children, (child) => { return React.cloneElement( - child as React.ReactElement, + child as React.ReactElement, { modalSheetContentMap, shouldMountModalContent: shouldMountModalContents, diff --git a/src/components/ModalSheetViewContent/ModalSheetViewMainContent.tsx b/src/components/ModalSheetViewContent/ModalSheetViewMainContent.tsx deleted file mode 100644 index a7acdb21..00000000 --- a/src/components/ModalSheetViewContent/ModalSheetViewMainContent.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import * as React from 'react'; - -import { ModalSheetViewContent } from './ModalSheetViewContent'; -import type { ModalSheetViewMainContentProps } from './ModalSheetViewMainContentTypes'; -import { ModalSheetViewNativeIDKeys } from '../ModalSheetView/ModalSheetViewNativeIDKeys'; - - -export function ModalSheetViewMainContent( - props: React.PropsWithChildren -) { - const { children, ...otherProps } = props; - return ( - - {children} - - ); -}; \ No newline at end of file diff --git a/src/components/ModalSheetViewContent/ModalSheetViewMainContentTypes.ts b/src/components/ModalSheetViewContent/ModalSheetViewMainContentTypes.ts deleted file mode 100644 index 714cf859..00000000 --- a/src/components/ModalSheetViewContent/ModalSheetViewMainContentTypes.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { ModalSheetViewContentProps } from './ModalSheetViewContentTypes'; - - -export type ModalSheetViewMainContentInheritedProps = Pick; - -export type ModalSheetViewMainContentBaseProps = { -}; - -export type ModalSheetViewMainContentProps = - & ModalSheetViewMainContentInheritedProps - & ModalSheetViewMainContentBaseProps; \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 9a14971e..6a4f2aba 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,8 +2,8 @@ export * from './components/ModalSheetView/ModalSheetView'; export * from './components/ModalSheetView/ModalSheetViewTypes'; -export * from './components/ModalSheetViewContent/ModalSheetViewMainContent'; -export * from './components/ModalSheetViewContent/ModalSheetViewContentTypes'; +export * from './components/ModalSheetContent/ModalSheetMainContent'; +export * from './components/ModalSheetContent/ModalSheetContentTypes'; export * from './context/ModalSheetViewContext'; export * from './hooks/useModalSheetViewEvents';