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

Update internal state when props change #1

Closed
wants to merge 1 commit into from

Conversation

ahmadghizzawi
Copy link

Hey there!

While trying to use this TimePicker in our app, the TimePicker would not update the selectedHour and selectedMinute values after the initial props are passed unless onConfirm and onCancel are called. This means that if you try to update the selectedHour and selectedMinute, the new props would be ignored.

I fixed this issue by adding componentDidUpdate (check the commit).

Thanks!

@nysamnang
Copy link
Owner

I'm gonna review and test it this weekend. If it's okay then i'll merge your code and bump the version and thank you for taking the time to improve this lib !

@nysamnang nysamnang self-assigned this Oct 17, 2019
@ahmadghizzawi
Copy link
Author

@nysamnang thoughts?

@nysamnang
Copy link
Owner

@ahmadghizzawi Of course, After testing I found out the issue that you mentioned above. The problem was the local state not updating based on props. To fix this we better use componentWillReceiveProps rather than using componentDidUpdate. I already fixed b907552 and published the new version a few minutes ago, if you want it please kindly upgrade to the latest version.
Thanks for taking the time to improve this lib :)

@nysamnang nysamnang closed this Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants