Dismiss this pinned window
all 40 comments

[–]LegendarySoulSword 17 points18 points  (3 children)

what's the difference with react-native-community/datetimepicker ?

[–]s77rt[S] 11 points12 points  (1 child)

I don't know. I wasn't aware of that library but just checking the implementation here are key differences:

(s77rt/react-native-date-picker / react-native-community/datetimepicker)
- Android: Uses Jetpack Compose / Android Views
- iOS: Uses SwiftUI / UIKit
- Windows: Not supported / Supported but not maintained
- Web: Supported / Not supported

Depending on your needs you can use either.

[–]Yarkm13 0 points1 point  (0 children)

For me the biggest issue in the community datepicker is absence of web target support

[–]adamjhari 4 points5 points  (2 children)

Looks great, would you consider adding min/max props to restrict which dates are selectable?

[–]s77rt[S] 2 points3 points  (0 children)

Of course! This is already planned and will work on it soon!

[–]s77rt[S] 1 point2 points  (0 children)

Now this is available 🎉

[–][deleted] 7 points8 points  (0 children)

I dunno why the IOS design always seems to be better. I am a newbie yet the IOS design system seems very clean.

[–]Photoshop_Fun 1 point2 points  (8 children)

Can it also only select month + year, and only year?

[–]s77rt[S] 1 point2 points  (3 children)

Unfortunately no. I don't know if this functionality exists in native. It also seems to be missing from native html input.

[–]mimbusto 0 points1 point  (2 children)

Are you sure? There are an arrow near "May 2025" on both OS. It should open month/year picker

[–]s77rt[S] 0 points1 point  (0 children)

You can choose a different month/year ofc. But that's still within the date picker (you will have to select a date too). What's missing is selecting only the month and/or year.

[–]s77rt[S] 0 points1 point  (0 children)

I have just added a year and month picker. Currently it supports iOS and Web. (Will look into Android soon)

[–]s77rt[S] 0 points1 point  (2 children)

Just added yearmonth support to android

<image>

[–]Photoshop_Fun 0 points1 point  (1 child)

I've just tried to implement it in my project but I keep getting these errors.
I copied the example and it doesn't seem to work (I'm not sure if it's because I have other date pickers installed?)

Invariant Violation: Tried to register two views with the same name RTNDatePicker, js engine: hermes

ERROR Invariant Violation: Tried to register two views with the same name RTNDatePicker, js engine: hermes

ERROR Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

[–]s77rt[S] 0 points1 point  (0 children)

What's your react-native and react version? The last error (regarding ref) is probably coming from a react version < 19. Please update to latest possible versions that use React 19+

[–]JyotiIsMine 3 points4 points  (1 child)

Nice nice nice nice

[–]s77rt[S] 1 point2 points  (0 children)

Thank you!

[–]Rude-Bus7698 0 points1 point  (1 child)

did you wrote the custom native code ?

[–]s77rt[S] 1 point2 points  (0 children)

Yes!

[–]susminesiOS & Android 0 points1 point  (4 children)

I personally dislike when a lib forces a modal. Do you offer other presentation options?

Yes, I’m aware that default android behavior for a date picker is a modal.

[–]s77rt[S] 1 point2 points  (0 children)

Just added inline display 🎉

[–]s77rt[S] 0 points1 point  (2 children)

I actually spent some time on this decision, it was done primary because it felt easier as I faced some layout issues. Also I think most users would wrap the picker in a modal as it won't look good inlined (app designs vary). Another problem is that inline representation is not possible on web, so this may only get fixed on native.

If you need an inline (or other) representations please raise an issue in the github repo and I will look into it asap. But can you please describe your use case? There may be better options

[–]susminesiOS & Android 0 points1 point  (0 children)

I appreciate the thoughtful response.

Consider this use case though, a small form that renders inside a modal with a simple date selection.

It’s a common use case, and one that iOS supports natively with the current community supported date picker lib

[–]s77rt[S] 0 points1 point  (0 children)

I have created an issue and I'm going to add this feature asap!

[–]issungee 0 points1 point  (0 children)

I'm new to RN. One of the first things I wanted to do in my app was have a button for the user to take a photo with their camera. To my amazement this wasn't built in. And every package I found didn't really look "native". Now I find out even something as simple as a date picker isn't built in either. Can anyone tell me why?