DateTimePicker makes app crash in native build

Hello! I use SDK v45, Managed worfklow.
When I try the datetimepicker on android build, it crashes the app. I’m using the Imperative Android API approach as recommended in docs.

When I try on Expo Go it works fine, and even in development build.
The issue is only In Android;

Please help

Hey @iga-frg,

Can you please share a minimal reproducible example so that I clone and see what the issue is?

I created a minimal example on my own using Expo SDK 45 (since you mentioned that), the date time picker library and using the Imperative Android API, as you linked from the docs. Everything works fine on my end.

I’d also ask you to run expo-cli doctor --fix-dependencies and see if there are any dependencies compatibility issues.

1 Like

Hi again! finished reinstalling and no issues after running the command you gave me. now I’m building a separate simple example with exact same deps versions. Will share it soon . please stay close :slight_smile:

This is the git repo: GitHub - firas1220/datetimepicker-android-issue
Its a minimal example, with exact same deps versions, feel free to ask anything you want, or even contact me on discord FRG#5942 : Please try to help me and thanks a lot

1 Like

Thanks for sharing the reproducible example.

I just ran the build of your example on my end the build seems to be okay. The app does crash when I try open the DatePicker.

On running expo-cli start --no-dev --minify command (which you can also use to test your app in Production mode, for more info about it, see docs: Development and production modes - Expo Documentation) the app doesn’t crash but I can’t open or use the DatePicker functionality under “Filtres”. The issue seems to be in that part of the code. You’ll have to re-check the implementation of business logic on how you are using it.

1 Like

For the business logic, yeah I made somthing, now will revert it please stay online. going to commit in few minutes. And thanks a lot.

I’ve just made another commit after retesting the behavior on expo go. Now launching the build again.

thanks

Now testing , with build + the command you gave me I got 2 different results:
1 - native build: the app crashes
2 - on expo go: the screen get stuck, the touchables doesnt work anymore.

Hello! the issue is finally solved! :grin: the problem was with Moment.js library, the use of locale() function is behind the crash! I removed it from the code and made new build and everything now is fine. Would you recommend us to use an alternative to moment.js?

I guess this issue & answer, will help some developers having same cases than me today.

Please accept my thanks I really appreciate your support @amanhimself

2 Likes

That’s great to know @iga-frg! No worries! I’m glad you were able to resolve it :slight_smile:

As an alternative to moment, check out date-fns. It might fulfill your use case.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.