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

Change month by using arrow will trigger onDateSelected on frist day of month #39

Open
cypie92 opened this issue May 30, 2022 · 8 comments

Comments

@cypie92
Copy link

cypie92 commented May 30, 2022

image

image

I need to run some function in onDateSelected so i can save the date user pressed in a list, but when user press the arrow the onDateSelected will get called and insert first day of month into my list. Is this a bug ?
@rwbr
Copy link
Owner

rwbr commented May 30, 2022

Technically it is not a bug. The navigation using these arrows leads to the selection of a new date, which then triggers the callback. But I get your point. There should be a way to differentiate wether the user clicked on a date, tapped an arrow or used the day picker to select a new date.

@cypie92
Copy link
Author

cypie92 commented May 31, 2022

Technically it is not a bug. The navigation using these arrows leads to the selection of a new date, which then triggers the callback. But I get your point. There should be a way to differentiate wether the user clicked on a date, tapped an arrow or used the day picker to select a new date.

and select on any date will trigger the onMonthChanged too from my testing which is not suppose to happen I assume.

@rwbr
Copy link
Owner

rwbr commented May 31, 2022

What could be a proper solution? Should the package provide the possibility to assign callback functions for each of the situations?

@cypie92
Copy link
Author

cypie92 commented Jun 1, 2022

What could be a proper solution? Should the package provide the possibility to assign callback functions for each of the situations?

I tried to use the onMonthChanged callback to remove the first day of month from list when user press arrow but the onMonthChanged get call even the user select a date on the current month so I'm unable to fix that.
now I'm trying another package.

@rwbr
Copy link
Owner

rwbr commented Jun 1, 2022

Sure, you are free to use whatever package you want. But this is open source code. I was just asking you for an idea, how it should work.

@cypie92
Copy link
Author

cypie92 commented Jun 1, 2022

Sure, you are free to use whatever package you want. But this is open source code. I was just asking you for an idea, how it should work.

  1. Select any day of current month shouldn't trigger onMonthChanged
  2. maybe a boolean value to indicate onDateSelected is trigger by user select date or by pressing the arrow

@jjvillavicencio
Copy link

Hi, i think the solution is that, allow provide assign different callbacks

@rwbr
Copy link
Owner

rwbr commented Dec 27, 2022

I think I'll add a parameter that controls the behavior of the callback. This parameter will let you select between two modes:

  • Trigger each time, the date updates (like today)
  • Trigger only on touch events, when the user explicitly selects a day

@cypie92 Do you think, that could work for you?

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

3 participants