DatePicker : onDateChange callback for Android
See original GitHub issueHi,
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.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
DatePicker.OnDateChangedListener - Android Developers
public abstract void onDateChanged (DatePicker view, int year, int monthOfYear, int dayOfMonth). Called upon a date change.
Read more >Android: onDateChange callback in not being called for `type ...
Successfully merging a pull request may close this issue. Bugfix: onDateChange not called for some locales henninghall/react-native-date-picker.
Read more >DatePickerDialog.OnDateSetListener does not get a callback ...
It looks like from ICS and above, the callback need not be defined while defining the datePickerDialog. ... onDateSet(datePicker, datePicker.
Read more >src/com/android/contacts/datepicker/DatePickerDialog.java
This is a fork of the standard Android DatePicker that additionally allows toggling ... The callback used to indicate the user is done...
Read more >Android Date Time Picker Dialog | DigitalOcean
CallBack Function: onDateSet() is invoked when the user sets the date with the following parameters: int year : It will be store the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed with 2.6.1
@Corpsomium That’s exactly what I suggested when the iOS onDateChange support was added. Maybe we’re missing something?