-
-
Notifications
You must be signed in to change notification settings - Fork 425
fix: do not update android dialog on each re-render #374
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay
Great Job! 🎉
## [3.0.9](v3.0.8...v3.0.9) (2021-01-02) ### Bug Fixes * do not update android dialog on each re-render ([#374](#374)) ([16bff74](16bff74))
🎉 This PR is included in version 3.0.9 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@luancurti can you please check discord? I left a message in the datepicker channel, thank you! :) |
Just tested this new version that is supposed to not update on re-render. But it does not work for me atleast. I have a useEffect with setInterval that triggers a recalculation of time once each second. And the datepicker reverts my date while open and selecting, every time my value is recalculated. My picker is inside a modal. |
@snios that is the expected behavior, JS is the source of truth for the picker:
|
Hm. I dont change the js date that the picker uses as far as i know. The calculation that is done in useeffect is not connected with the date. The date picker is a separate component that houses its own logic. EDIT |
@snios We are also facing same problem in our code. Did you find solution for same? |
Hi @AmoIFC. Issue for us was that in the parent view of the modal there was a setInterval that calculated som values and that made the modal component reinitialize (the constructor ran again). So in the view that has the setInterval i dont recalculate the values if modal is shown. Probably a bad solution but it works. example. |
Summary
replacement for #327, please see motivation there. To sum it up, android dialog's selected date is controlled from JS and while the dialog is open, it will update only if the date changed in JS.
edit: Previously we updated the value in the android dialog on each render, now we will update it only if the value has changed.
Closes #182
Closes #235
Closes #327
Test Plan
tested locally
What's required for testing (prerequisites)?
What are the steps to reproduce (after prerequisites)?
Compatibility
Checklist
README.md
example/App.js
)