Skip to content

Commit

Permalink
🛠 Refactor: Rename to ModalSheetContent
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed Oct 2, 2024
1 parent fb21d5c commit 49754e1
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 54 deletions.
6 changes: 3 additions & 3 deletions example/src/examples/ModalSheetViewTest01.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -260,7 +260,7 @@ export function ModalSheetViewTest01(props: ExampleItemProps) {
);
}}
>
<ModalSheetViewMainContent
<ModalSheetMainContent
contentContainerStyle={styles.modalContent}
>
<React.Fragment>
Expand All @@ -278,7 +278,7 @@ export function ModalSheetViewTest01(props: ExampleItemProps) {
/>
)}
</React.Fragment>
</ModalSheetViewMainContent>
</ModalSheetMainContent>
</ModalSheetView>
</ExampleItemCard>
);
Expand Down
6 changes: 3 additions & 3 deletions example/src/examples/ModalSheetViewTest02.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -36,7 +36,7 @@ function ModalContent(props: {
});

return (
<ModalSheetViewMainContent
<ModalSheetMainContent
// temp fix
{...{...props}}
contentContainerStyle={styles.modalContentContainer}
Expand Down Expand Up @@ -113,7 +113,7 @@ function ModalContent(props: {
recursionLevel={recursionLevel + 1}
/>
</ModalSheetView>
</ModalSheetViewMainContent>
</ModalSheetMainContent>
);
};

Expand Down
6 changes: 3 additions & 3 deletions example/src/examples/ModalSheetViewTest03.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -65,7 +65,7 @@ function ModalContent(props: {
});

return (
<ModalSheetViewMainContent
<ModalSheetMainContent
// temp fix
{...{...props}}
contentContainerStyle={styles.modalContentContainer}
Expand Down Expand Up @@ -108,7 +108,7 @@ function ModalContent(props: {
recursionLevel={recursionLevel + 1}
/>
</ModalSheetView>
</ModalSheetViewMainContent>
</ModalSheetMainContent>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ModalSheetViewContentProps>
export function ModalSheetContent(
props: React.PropsWithChildren<ModalSheetContentProps>
) {
const [viewID, setViewID] = React.useState<StateViewID>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ import type { RNIModalSheetViewProps } from "../../native_components/RNIModalShe
import type { ModalSheetContentMap } from "../ModalSheetView/ModalSheetContentMap";


export type ModalSheetViewContentInheritedProps = Pick<RNIModalSheetViewProps,
export type ModalSheetContentInheritedProps = Pick<RNIModalSheetViewProps,
| 'shouldEnableDebugBackgroundColors'
> & Pick<RNIWrapperViewProps,
| 'onDidSetViewID'
| 'nativeID'
>;

export type ModalSheetViewContentBaseProps = {
export type ModalSheetContentBaseProps = {
contentContainerStyle?: ViewStyle;
isParentDetached?: boolean;
modalSheetContentMap?: ModalSheetContentMap;
shouldMountModalContent?: boolean;
};

export type ModalSheetViewContentProps =
& ModalSheetViewContentInheritedProps
& ModalSheetViewContentBaseProps;
export type ModalSheetContentProps =
& ModalSheetContentInheritedProps
& ModalSheetContentBaseProps;
20 changes: 20 additions & 0 deletions src/components/ModalSheetContent/ModalSheetMainContent.tsx
Original file line number Diff line number Diff line change
@@ -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<ModalSheetMainContentProps>
) {
const { children, ...otherProps } = props;
return (
<ModalSheetContent
{...otherProps}
nativeID={ModalSheetViewNativeIDKeys.mainSheetContent}
>
{children}
</ModalSheetContent>
);
};
13 changes: 13 additions & 0 deletions src/components/ModalSheetContent/ModalSheetMainContentTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { ModalSheetContentProps } from './ModalSheetContentTypes';


export type ModalSheetMainContentInheritedProps = Pick<ModalSheetContentProps,
| 'contentContainerStyle'
>;

export type ModalSheetMainContentBaseProps = {
};

export type ModalSheetMainContentProps =
& ModalSheetMainContentInheritedProps
& ModalSheetMainContentBaseProps;
4 changes: 2 additions & 2 deletions src/components/ModalSheetView/ModalSheetView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -123,7 +123,7 @@ export const ModalSheetView = React.forwardRef<

const children = React.Children.map(props.children, (child) => {
return React.cloneElement(
child as React.ReactElement<ModalSheetViewContentProps>,
child as React.ReactElement<ModalSheetContentProps>,
{
modalSheetContentMap,
shouldMountModalContent: shouldMountModalContents,
Expand Down
20 changes: 0 additions & 20 deletions src/components/ModalSheetViewContent/ModalSheetViewMainContent.tsx

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 49754e1

Please sign in to comment.