-
Notifications
You must be signed in to change notification settings - Fork 128
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
is onPress memoized? #102
Comments
Same issue. |
I have reached a solution via the help of StackOverflow: https://stackoverflow.com/questions/74297972/react-native-really-awesome-button-onpress-does-not-update-function-when-state-c However, it is clear that this bug needs to be addressed in the repository. |
Can confirm this bug exists and needs to be fixed. It seems to not be present in the release version |
@eeshankeni It is present in the release version. Check out my demo: https://snack.expo.dev/@anshnanda/awesomebutton-not-working |
Weird, I tried to toggle the button's colour between two options using a state. It worked fine in the release but not in the latest version. |
Can you provide a demo on Snack or a repo/gist? @eeshankeni |
@septpointdeux This is effectively the solution I hinted at in my SO answer. Did you apply the fix in a local clone of the repo or are you planning to issue a pull request with the fix applied? |
@awreese Thx i effectively followed your advises on SO 👍. The PR is done. |
It has been almost a month, with a perfectly good PR created, and the maintainer of this package has not even responded. I have emailed him and he has seen the email many times and yet is probably too busy to maintain this. So, I have forked the package, cleaned up the code, updated the dependencies, and published it under Please find it here https://www.npmjs.com/package/react-native-raised-button?activeTab=readme Looking forward to your contributions @septpointdeux and @awreese |
Hey @ansh Do check out my expo snack https://snack.expo.dev/@esean_keni/8465d3 |
@eeshankeni The example snack I initially gave that did not work with this package works now: https://snack.expo.dev/@anshnanda/awesomebutton-not-working so my fork solved my issue. Not sure why your example doesn't work. Let me take a look. |
@eeshankeni I have debugged your Snack and it seems like there is another bug in the original react-native-really-awesome-button package! This is actually absurd. I regret using this package now. But in any case, the simplest fix is not pressing the button back-to-back. If you wait 1-2 seconds between pressing the button, the color changes every time. However, if you press the button in rapid succession, the color doesn't change and it doesn't register the new state. Not sure why this happening (maybe @awreese and @septpointdeux can take another look). |
@ansh damn this package seems more trouble than its worth. Which is unfortunate cause its really rather good |
is the dev dead? |
This has been fixed in #108 |
However, since the original dev is not active, I made a fork that works better and will be maintained: All done in accordance with the MIT license |
Is the onPress prop memoized? Because if it is, there is an issue since I am using state in onPress and it using the wrong state.
Using Expo SDK 46
It seems like
onPressIn
works because it is directly being passed into the component, but ideally I would like to useonPress
as it is significantly better UX.Here is a reproducible demo: https://snack.expo.dev/@anshnanda/awesomebutton-not-working
The text was updated successfully, but these errors were encountered: