Skip to content

Commit 9bf2be2

Browse files
authored
ExpandableOverlay - add migrateDialog (#2635)
1 parent 00ecaea commit 9bf2be2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/incubator/expandableOverlay/index.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import React, {useCallback, useState, forwardRef, PropsWithChildren, useImperati
33
import TouchableOpacity, {TouchableOpacityProps} from '../../components/touchableOpacity';
44
import View from '../../components/view';
55
import Modal, {ModalProps, ModalTopBarProps} from '../../components/modal';
6-
import Dialog, {DialogProps} from '../../components/dialog';
6+
import DialogOld, {DialogProps as DialogPropsOld} from '../../components/dialog';
7+
import DialogNew, {DialogProps as DialogPropsNew} from '../Dialog';
78
import {Colors} from 'style';
89

910
export interface ExpandableOverlayMethods {
@@ -33,7 +34,11 @@ export type ExpandableOverlayProps = TouchableOpacityProps &
3334
/**
3435
* The props to pass to the dialog expandable container
3536
*/
36-
dialogProps?: DialogProps;
37+
dialogProps?: DialogPropsOld | DialogPropsNew;
38+
/**
39+
* Migrate the Dialog to DialogNew (make sure you use only new props in dialogProps)
40+
*/
41+
migrateDialog?: boolean;
3742
/**
3843
* Whether to render a modal top bar (relevant only for modal)
3944
*/
@@ -59,6 +64,7 @@ const ExpandableOverlay = (props: ExpandableOverlayProps, ref: any) => {
5964
useDialog,
6065
modalProps,
6166
dialogProps,
67+
migrateDialog,
6268
showTopBar,
6369
topBarProps,
6470
renderCustomOverlay,
@@ -103,7 +109,9 @@ const ExpandableOverlay = (props: ExpandableOverlayProps, ref: any) => {
103109
};
104110

105111
const renderDialog = () => {
112+
const Dialog = migrateDialog ? DialogNew : DialogOld;
106113
return (
114+
// @ts-expect-error
107115
<Dialog testID={`${testID}.overlay`} {...dialogProps} visible={visible} onDismiss={closeExpandable}>
108116
{expandableContent}
109117
</Dialog>

0 commit comments

Comments
 (0)