Skip to content

ExpandableOverlay - add migrateDialog prop #2635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/incubator/expandableOverlay/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import React, {useCallback, useState, forwardRef, PropsWithChildren, useImperati
import TouchableOpacity, {TouchableOpacityProps} from '../../components/touchableOpacity';
import View from '../../components/view';
import Modal, {ModalProps, ModalTopBarProps} from '../../components/modal';
import Dialog, {DialogProps} from '../../components/dialog';
import DialogOld, {DialogProps as DialogPropsOld} from '../../components/dialog';
import DialogNew, {DialogProps as DialogPropsNew} from '../Dialog';
import {Colors} from 'style';

export interface ExpandableOverlayMethods {
Expand Down Expand Up @@ -33,7 +34,11 @@ export type ExpandableOverlayProps = TouchableOpacityProps &
/**
* The props to pass to the dialog expandable container
*/
dialogProps?: DialogProps;
dialogProps?: DialogPropsOld | DialogPropsNew;
/**
* Migrate the Dialog to DialogNew (make sure you use only new props in dialogProps)
*/
migrateDialog?: boolean;
/**
* Whether to render a modal top bar (relevant only for modal)
*/
Expand All @@ -59,6 +64,7 @@ const ExpandableOverlay = (props: ExpandableOverlayProps, ref: any) => {
useDialog,
modalProps,
dialogProps,
migrateDialog,
showTopBar,
topBarProps,
renderCustomOverlay,
Expand Down Expand Up @@ -103,7 +109,9 @@ const ExpandableOverlay = (props: ExpandableOverlayProps, ref: any) => {
};

const renderDialog = () => {
const Dialog = migrateDialog ? DialogNew : DialogOld;
return (
// @ts-expect-error
<Dialog testID={`${testID}.overlay`} {...dialogProps} visible={visible} onDismiss={closeExpandable}>
{expandableContent}
</Dialog>
Expand Down