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 prop for onCancel #155

Open
scousino opened this issue Oct 30, 2020 · 2 comments
Open

Add prop for onCancel #155

scousino opened this issue Oct 30, 2020 · 2 comments

Comments

@scousino
Copy link

Add a prop that accepts a callback that will execute when the user presses the cancel button.

Right now, I'm manually controlling the visibility of the ModalSelector, but I have no way to when the user has selected cancel other than onModalClose, but I can't use that because I'm manually controlling the visibility.

@peacechen
Copy link
Owner

The cancel button fires close() which calls this.props.onModalClose(item). That always fires when the cancel button is pressed.
https://github.com/peacechen/react-native-modal-selector/blob/master/index.js#L193

If you're creating the button yourself, you have complete control over its callback. I might not be understanding your question fully. Please submit a PR if a change is required in this library.

@scousino
Copy link
Author

Yes if you look at that exact method you referred to, the close() method sets the visibility of the modal explicitly. However, I'm trying to control the visibility of the Modal manually like the doc indicates. But this explicit setting of the visibility by the package while I'm trying to rightfully be in full control of visibility breaks that functionality/understanding.

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

No branches or pull requests

2 participants