React-Native-Paystack-WebView icon indicating copy to clipboard operation
React-Native-Paystack-WebView copied to clipboard

feat(RNPSW): expose the root modal's props for customization

Open el-naza opened this issue 1 year ago • 6 comments

This PR allows the consumer to customize the root modal's props. One specific and important use case is to be able to dismiss the modal on back button press like so;

modalProps={{ onRequestClose: () => paystackWebViewRef.current?.endTransaction() }}

I wanted to document the usage in the Readme but the contribution guide says "All modifications should be made exclusively in the /development directory". Hoping to hear from the maintainer.

el-naza avatar Oct 15 '24 07:10 el-naza

@El-Nazy, I see your point, i have updated docs #175, so feel free to update docs accordingly. You can update both the docs and code changes in this one PR.

Also, take time to update your PR to match the requirements for PRs in the contribution docs.

just1and0 avatar Oct 15 '24 08:10 just1and0

@El-Nazy, I see your point, i have updated docs #175, so feel free to update docs accordingly.

Thank you @just1and0 I'll proceed to make the commit with a docs commit.

el-naza avatar Oct 15 '24 08:10 el-naza

Also @El-Nazy we already have a way of closing the modal using ref.

Does this not work for you?

paystackWebViewRef.current.endTransaction()

just1and0 avatar Oct 15 '24 11:10 just1and0

Also @El-Nazy we already have a way of closing the modal using ref.

Does this not work for you?

paystackWebViewRef.current.endTransaction()

It does work but not on back button press. The react native modal completely absorbs the back button press and can only be handled/accessed through the onRequestClose() callback prop

el-naza avatar Oct 15 '24 11:10 el-naza

Also @El-Nazy we already have a way of closing the modal using ref. Does this not work for you?

paystackWebViewRef.current.endTransaction()

It does work but not on back button press. The react native modal completely absorbs the back button press and can only be handled/accessed through the onRequestClose() callback prop

I mean that the root modal does not dismiss on back-button press as tested on android so exposing the modal props helps with that as illustrated in the example earlier

modalProps={{ onRequestClose: () => paystackWebViewRef.current.endTransaction() }}

el-naza avatar Oct 15 '24 13:10 el-naza

@just1and0 Sir, please let me know if there are any requirements for the PR that still need to be met.

el-naza avatar Oct 17 '24 09:10 el-naza

LGTM

just1and0 avatar Nov 04 '24 15:11 just1and0

@all-contributors add @El-Nazy for code

just1and0 avatar Nov 04 '24 15:11 just1and0

@just1and0

I've put up a pull request to add @El-Nazy! :tada:

allcontributors[bot] avatar Nov 04 '24 15:11 allcontributors[bot]

:tada: This PR is included in version 4.2.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Nov 04 '24 15:11 github-actions[bot]