react-native-date-picker: Loading is slow on Android

Hi Henning,

Thanks for this great library, just what we’ve been looking for!

We’ve tried implementing this in our app, but it seems to load slow on Android. After some debugging we’ve located the issue in PickerView.java

Both in setMode and setLocale you call the applyOnAllWheels method, and we’ve measured this to take between 200 and 400 milliseconds each time on the emulator. They are of course faster on a device, but its still too slow in a production build. If commenting these out, the view loads fast (except it won’t work of course). I’m not sure how to solve that, but maybe you have an idea?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

Just a note to people who get here because they are still experiencing jankiness and slowness even after v2.0.3, check if (and what) you are passing in the maximumDate and minimumDate props.

I was passing a date 100 years ago and it was taking several seconds to load.

Anyways, thanks so much for the work guys! 🎉

@tunaSalad2406 I have made some improvements that I think will resolve your issue. I would really appreciate if you would like to try it out and let me know if it solved your issue 🙂

Do the following to try it out:

  1. Change the line in your package.json to: "react-native-date-picker": "henninghall/react-native-date-picker#performance"

  2. npm install or yarn

  3. rm -rf node_modules/react-native-date-picker/example && rm -rf node_modules/react-native-date-picker/example-cocoapods

  4. react-native run-android