Skip to content

fix missing dialog props (such as onShow) #1715

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 5 commits into from
Dec 14, 2021
Merged
Changes from 2 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
3 changes: 2 additions & 1 deletion src/components/dialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class Dialog extends Component<DialogProps, DialogState> {

render = () => {
const {modalVisibility} = this.state;
const {testID, supportedOrientations, accessibilityLabel, ignoreBackgroundPress} = this.props;
const {testID, supportedOrientations, accessibilityLabel, ignoreBackgroundPress, ...others} = this.props;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be done with modalProps:

  /**
   * Additional props for the modal.
   */
  modalProps?: ModalProps;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@M-i-k-e-l
We are currently declaring that Dialog props are extending Modal props. (code wise, we don't do it)
If you want to go with adding modalProps which I agree is safer, we should fix the component typings as well

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a Pick from ModalPropsIOS, or did I miss something? Generally we should remove that if we're adding the suggested prop, but I don't think it's worth the migration since we're going to move to the new Dialog soonish.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed :)

const onBackgroundPress = !ignoreBackgroundPress ? this.hideDialogView : undefined;

return (
Expand All @@ -260,6 +260,7 @@ class Dialog extends Component<DialogProps, DialogState> {
onRequestClose={onBackgroundPress}
supportedOrientations={supportedOrientations}
accessibilityLabel={accessibilityLabel}
{...others}
>
{this.renderDialogContainer()}
</Modal>
Expand Down