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 onClick handler to pay/save button #50

Closed
man-of-seafood opened this issue Apr 27, 2022 · 3 comments · Fixed by #47
Closed

Add onClick handler to pay/save button #50

man-of-seafood opened this issue Apr 27, 2022 · 3 comments · Fixed by #47
Assignees
Labels
enhancement New feature or request

Comments

@man-of-seafood
Copy link

Describe the feature you'd like to request

Context: Trying to add an onClick listener to the save button, but there isn't a way to do that.
I see there's the submit prop (added here), which I thought would be triggered on submission (i.e. on click), but the official SDK docs say this event is only emitted by pressing "Enter" while editing a field (crucially, not on click). I have verified this by adding a log into my submit handler:

<CreditCardInput
  text="Text"
  submitButtonId={submitButtonId}
  children={isCardProcessing ? <LoadingIcon/> : null}
  submit={(e) => {
    console.log('executing submit callback') // never logged on click. does log on `enter`
    setIsCardProcessing(true)
  }}
/>

Describe the solution you'd like

Add an onClick field to the buttonProps prop of the CreditCardInput (a la what you proposed here). From there, pass it to the button.

Describe alternatives you've considered

Passing the callback to the submit prop, but that's only triggered when you hit Enter.

@danestves
Copy link
Collaborator

button props event listeners

Hi @man-of-seafood currently in the canary version we support all kind of props for the button element, so you can write it and will appear all the methods that support it. Can you give it a try on canary and see if it's working?

@danestves danestves added the enhancement New feature or request label Apr 27, 2022
@danestves
Copy link
Collaborator

We consider the canary version right now as "stable" now we are writing all the new docs

@danestves danestves mentioned this issue Apr 28, 2022
4 tasks
@danestves danestves linked a pull request Apr 28, 2022 that will close this issue
4 tasks
@danestves danestves self-assigned this Apr 28, 2022
@danestves
Copy link
Collaborator

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

Successfully merging a pull request may close this issue.

2 participants