-
Notifications
You must be signed in to change notification settings - Fork 439
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
feat: Accept async function for URL prop #336
Open
Kashuab
wants to merge
4
commits into
nygardk:master
Choose a base branch
from
Kashuab:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kashuab
changed the title
feat: Re-run handleClick after beforeOnClick is called
feat: Handle prop changes from beforeOnClick
Jul 22, 2020
Kashuab
changed the title
feat: Handle prop changes from beforeOnClick
feat: Accept async function for URL prop
Jul 23, 2020
justinscoderepo
approved these changes
Jun 7, 2021
Made a commit on my fork to resolve the edits I made to package.json before publishing the package to be used until this is merged 👍 |
would love to get this merged in - I need the same feature |
any chance of this getting merged in? |
I also need this feature, is there a chance to merge in? |
need this |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #216
Related pull requests: #268
My first approach was to re-run
ShareButton.handleClick
after callingbeforeOnClick
, but I felt the solution was unreliable and messy. My actual use-case requires me to upload an image to a third party service (which returns a URL to the image), which I was doing inbeforeOnClick
. The problem was that afterbeforeOnClick
was called, any props that got updated were not used.Instead of relying on changing props by calling
setState
in the parent component that contains thebeforeOnClick
prop in order to dynamically specify a URL (which is very complicated,) I think it's a lot simpler to accept an async function instead for theurl
prop.Here's a quick example implementation:
This is my first ever open-source contribution, so let me know if there's anything I'm missing!
If you need to use this feature before it's merged, I've published a package in the interim: @kashuab/react-share