question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DatePicker : onDateChange callback for Android

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
SupriyaKalghatgicommented, Jun 22, 2018

Fixed with 2.6.1

1reaction
ferreirixcommented, Jun 18, 2018

@Corpsomium That’s exactly what I suggested when the iOS onDateChange support was added. Maybe we’re missing something?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found