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

Active month showing up wrong in calendar which value is changed #70

Open
vinit-m opened this issue Apr 1, 2021 · 2 comments
Open

Active month showing up wrong in calendar which value is changed #70

vinit-m opened this issue Apr 1, 2021 · 2 comments

Comments

@vinit-m
Copy link

vinit-m commented Apr 1, 2021

Changing the value of month picker manually (setState / useState) doesn't change the active month. The active month only changes when clicked on month. The active month (visually/css) should be updated on the calendar when the month picker value changes.

In short, I have buttons to go up/down months so when using the buttons the calendar doesn't update

@richardwestenra
Copy link

richardwestenra commented Aug 4, 2021

Hey I'm experiencing the same issue - a possible duplicate of #68?

I am unable to programmatically update the picker. I would expect that when the value prop changes, the picker selection updates. However it seems to only update on first mount, then does not update subsequently.

@richardwestenra
Copy link

Update: I figured out a solution to this which seems to work - you can use the key prop to force the component to remount/update. Example:

<MonthPicker
  ref={picker}
  key={JSON.stringify(value)}
  years={years}
  value={value} />

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

No branches or pull requests

2 participants