Skip to content

Commit 54f4907

Browse files
authored
fix missing dialog props (such as onShow) (#1715)
* fix missing dialog props (such as onShow) * use modalProps instead of 'others' * typing
1 parent 8ab1d18 commit 54f4907

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

generatedTypes/src/components/dialog/index.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import { StyleProp, ViewStyle, ModalPropsIOS, AccessibilityProps } from 'react-native';
33
import { AlignmentModifiers } from '../../commons/modifiers';
4+
import { ModalProps } from '../modal';
45
import { PanningDirections } from '../panningViews/panningProvider';
56
interface RNPartialProps extends Pick<ModalPropsIOS, 'supportedOrientations'>, Pick<AccessibilityProps, 'accessibilityLabel'> {
67
}
@@ -53,6 +54,10 @@ export interface DialogProps extends AlignmentModifiers, RNPartialProps {
5354
* The props that will be passed to the pannable header
5455
*/
5556
pannableHeaderProps?: any;
57+
/**
58+
* Additional props for the modal.
59+
*/
60+
modalProps?: ModalProps;
5661
/**
5762
* The Dialog`s container style
5863
*/

src/components/dialog/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {StyleSheet, StyleProp, ViewStyle, ModalPropsIOS, AccessibilityProps} fro
44
import {Colors} from '../../style';
55
import {AlignmentModifiers, extractAlignmentsValues} from '../../commons/modifiers';
66
import {Constants, asBaseComponent} from '../../commons/new';
7-
import Modal from '../modal';
7+
import Modal, {ModalProps} from '../modal';
88
import View from '../view';
99
import PanListenerView from '../panningViews/panListenerView';
1010
import DialogDismissibleView from './DialogDismissibleView';
@@ -70,6 +70,10 @@ export interface DialogProps extends AlignmentModifiers, RNPartialProps {
7070
* The props that will be passed to the pannable header
7171
*/
7272
pannableHeaderProps?: any;
73+
/**
74+
* Additional props for the modal.
75+
*/
76+
modalProps?: ModalProps;
7377
/**
7478
* The Dialog`s container style
7579
*/
@@ -246,7 +250,7 @@ class Dialog extends Component<DialogProps, DialogState> {
246250

247251
render = () => {
248252
const {modalVisibility} = this.state;
249-
const {testID, supportedOrientations, accessibilityLabel, ignoreBackgroundPress} = this.props;
253+
const {testID, supportedOrientations, accessibilityLabel, ignoreBackgroundPress, modalProps} = this.props;
250254
const onBackgroundPress = !ignoreBackgroundPress ? this.hideDialogView : undefined;
251255

252256
return (
@@ -259,6 +263,7 @@ class Dialog extends Component<DialogProps, DialogState> {
259263
onRequestClose={onBackgroundPress}
260264
supportedOrientations={supportedOrientations}
261265
accessibilityLabel={accessibilityLabel}
266+
{...modalProps}
262267
>
263268
{this.renderDialogContainer()}
264269
</Modal>

0 commit comments

Comments
 (0)