xgfe / react-native-datepicker

react native datePicker component for both Android and IOS, useing DatePikcerAndroid, TimePickerAndroid and DatePickerIOS
MIT License
2.12k stars 726 forks source link

Should I use this module in expo or the one offered on expo #410

Open kopax opened 4 years ago

kopax commented 4 years ago

Issue

I am using expo sdk 36 and I want to display a date time picker for ios, android and web, their official recommendation is showing https://github.com/react-native-community/datetimepicker project, tought all their snack is outdated and the projcet seems to be less maintained than this one

Which one should I use with expo?

The corresponding issue on expo forum: https://forums.expo.io/t/date-time-picker-demo-is-outdated/34899 Source: https://docs.expo.io/versions/latest/sdk/date-time-picker/

AlexArendsen commented 4 years ago

Use something else if you can. The component in this package expects your input to match the specified display format. It also outputs moment instances instead of a regular old Date. moment also isn't tree-shakable (unlike date-fns, which it should use), so it caused my project's DEX method reference count to blow past the 64K default limit. It's pretty astonishing that this seems to be the most popular package for the job.

kopax commented 4 years ago

Thanks for your feedback @AlexArendsen it is well appreciated. Have you find a replacement so far? I will probably use @material-ui/picker for the web, and the expo choice for ios and android.

The problem I see with date-fns is the lack of many time zone functions that moment-timezone actually fill. Which make moment still not replaceable.

AlexArendsen commented 4 years ago

I just tried the react-native-community one you have linked in your original comment but I'm facing a strange issue with the modal opening and closing unpredictably. Currently trying this one, which appears to just be a more user-friendly (and more popular-- 1.7k stars vs 488) front-end to the react-native-community package

https://github.com/mmazzarolo/react-native-modal-datetime-picker

AlexArendsen commented 4 years ago

Update: the community repo one is probably fine actually, you just have to be careful when you're closing it to close the modal before you set the date value (otherwise it'll open twice).

kopax commented 4 years ago

Thanks for the feedbacl @AlexArendsen it is well appreciated. May I ask what are your target devices (ios/native/web) ?

I wonder if the community repo is working for the web, or if I will have to deal with the @material-ui/picker for it.