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

onModalClosed doesn't work #81

Open
matsko opened this issue Sep 9, 2021 · 9 comments
Open

onModalClosed doesn't work #81

matsko opened this issue Sep 9, 2021 · 9 comments

Comments

@matsko
Copy link

matsko commented Sep 9, 2021

Hello.

When the <CoinbaseCommerceButton> component is instantiated (and the modal opens up), the component fails to render if the onModalClosed property is set.

According to the documentation here, onModalClosed is a valid property, however, the component doesn't look like it has the code in place to recognize it.

Here's what my code looks like:

      <CoinbaseCommerceButton
        className={styles.coinbaseBuyNow}
        onPaymentDetected={processCoinbaseEvent}
        onChargeFailure={processCoinbaseEvent}
        onChargeSuccess={processCoinbaseEvent}
        onModalClose={processModalClose} // this fails
        chargeId={coinbaseChargeId}>
        Buy Now
      </CoinbaseCommerceButton>

I tried both onModalClosed and onModalClose and I got the same error:

Screen Shot 2021-09-09 at 11 22 00 AM

@chrisloeper-coinbase
Copy link

Hi @matsko! You might try changing the prop name like so:

onModalClose={processModalClose}

to

onModalClosed={processModalClose} <---- with a 'd'

Let us know if that works for you. 🙏

@matsko
Copy link
Author

matsko commented Sep 9, 2021

@chrisloeper-coinbase see my comment above:

I tried both onModalClosed and onModalClose and I got the same error

@chrisloeper-coinbase
Copy link

I'm also seeing that error. However, the callback does fire when I user onModalClosed. Is the callback working for you despite the error?

@matsko
Copy link
Author

matsko commented Sep 20, 2021

Yes it works. But the error is still showing up.

@chrisloeper-coinbase
Copy link

I see, thank you for the heads up! We will prioritize this as we are able. We just wanted to ensure that you were not blocked.

@matsko
Copy link
Author

matsko commented Oct 21, 2021

Yes I can confirm that onModalClosed={fn} does indeed work for us. The only problem that remains here is that your still library emits an error when it's used despite it being valid. Could you fix this error? It makes our unit/e2e testing emit the wrong signals.

@chrisloeper-coinbase
Copy link

I will talk with the team to see how best to prioritize this work.

@georgii-nansen
Copy link
Contributor

@chrisloeper-coinbase I've quickly checked through the code and it seems the only place where the code must be updated to fix this issue is here:

https://github.com/coinbase/react-coinbase-commerce/blob/master/src/index.js#L28

You only need to add 'onModalClosed' to the ignoredProps array

@georgii-nansen
Copy link
Contributor

also this problem exists since 2019 and this issue was simply deleted without any fix/workaround/feedback from the team.

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

No branches or pull requests

3 participants