Hi,
NativeBase's version v2.5.2 added support for onDateChange on iOS (#1987), but I need it on Android.
The support on IOS is made by using an internal setDate(date) function. Why not use it on both cases ?
Actual code :
async openAndroidDatePicker() {
/****/
if (action === "dateSetAction") {
this.setState({ chosenDate: new Date(year, month, day) });
}
That could turn into something like :
async openAndroidDatePicker() {
/****/
if (action === "dateSetAction") {
this.setDate.bind(this)(new Date(year, month, day));
}
Also, the setDate and showDatePicker functions could be turned into an arrow function to avoid binding on every render, but instead only once at the object's instantiation.
Edit : Oh, and I forgot : I can make a PR about it.
Any updates on this? Are there any workarounds for now? I would love for this to be added!
Little update on this : I added it on my project and it works just fine.
Maybe not on all cases, but on every that I used, it worked.
Corresponding changed line
Full commit with several changes
I don't get why it would not work on Android ?
@Corpsomium That's exactly what I suggested when the iOS onDateChange support was added. Maybe we're missing something?
Fixed with 2.6.1
Most helpful comment
Fixed with 2.6.1