Skip to content
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

Add coverScreen prop #145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add coverScreen prop #145

wants to merge 1 commit into from

Conversation

saghul
Copy link

@saghul saghul commented Jun 20, 2022

Fixes: #120

Overview

Test Plan

Copy link
Owner

@mmazzarolo mmazzarolo left a comment

Choose a reason for hiding this comment

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

Thanks for this PR! 🙌
Code looks perfect, but I'd like to suggest a different API.

bottom: 0,
left: 0,
right: 0,
...StyleSheet.absoluteFillObject,
Copy link
Owner

Choose a reason for hiding this comment

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

TIL :)


if (!coverScreen && visible) {
return (
<View pointerEvents="box-none" style={StyleSheet.absoluteFill}>
Copy link
Owner

Choose a reason for hiding this comment

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

I know, in the other thread I suggested to just provide a coverScreen prop like we're doing in react-native-modal. Still, I think an even better approach for the maintainability of the project would be to instead allow providing a CustomModalComponent props that we'll just swap with ReactNativeModal below, if provided.
Why? Because with the current approach in the future people will also require something like coverScreenWrapperProps to inject here, and so on, making the surface area of this API even bigger.
The drawback of the CustomModalComponent approach is that users will need to maintain the wrapper (so line 208 to 210 in their app — but I'm 100% OK with it given that it's not something that I want to/can maintain within react-native-dialog :/
Hope it makes sense.

}

return (
<ReactNativeModal
Copy link
Owner

Choose a reason for hiding this comment

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

Basically, following what I'm saying above, you can replace ReactNativeModal here with ModalComponent, which is a variable defined like this:

const ModalComponent = props.CustomModalComponent || ReactNativeModal;

Copy link
Author

Choose a reason for hiding this comment

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

Gotcha. Can do, I'll update the PR shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request] A boolean prop indicating to not use React Native's Modal
2 participants