lanjingling0510 / react-mobile-datepicker

🙊 👻 look a demo, Please imitate mobile environment.
https://codepen.io/lanjingling0510/pen/LRpOYp?editors=1010
MIT License
303 stars 148 forks source link

feat(picker): support onChange callback #39

Closed raulmt closed 11 months ago

raulmt commented 5 years ago

In some cases it's a lot better to have a date picker that actually sets the underlying form data just as you scroll the wheels, without needing to actually press a "confirm" button. This is how the iOS date picker works in many cases (example: go to the iOS Contacts app and add a birthday to some contact). Maybe because of this, we were having many users having trouble using this picker in a mobile, because they don't tap "confirm" button, they just try to go to another field or things like that.

This is why I added two main changes in this PR:

With those two things I was able to customize the picker in a way that supports not needing to press the confirm button (passing a handler for the onChange new callback, and null as cancelText since it doesn't make sense to have a cancel button in this case).

I'm already using this PR from my fork, but it would be great if this can be landed on the library. Please consider this, or let me know any feedback you have, or missing piece on this PR.

Thanks!

VolodymyrDzz commented 5 years ago

Yeah, it's really usefull feature. Any chance it will be added soon?

AntoineKleinmann commented 5 years ago

Very useful, thanks a lot! I hope this will be accepted soon.

lanjingling0510 commented 5 years ago

hi @raulmt . First of all, thank for your pr about this. l totally agree with you. We need to be carefully considered in the design of component properties. l add showFooter property to control buttons visibility intuitively. it was already published on version 4.0.2.