Replies: 21 comments 9 replies
-
Hey, |
Beta Was this translation helpful? Give feedback.
-
we need the picker working on web ++ |
Beta Was this translation helpful? Give feedback.
-
PRs, ideas, and suggestions are welcome! |
Beta Was this translation helpful? Give feedback.
-
I agree a modal might not be the best UX on web. But if it is, react-native-web supports modals now. Perhaps a native |
Beta Was this translation helpful? Give feedback.
-
Here is an example of a nice modal picker on web: https://material-ui.com/components/pickers/ Could just fall back to that on web for now? |
Beta Was this translation helpful? Give feedback.
-
I'd go for a native solution like this one https://codepen.io/getify/pen/LYZbaGj?editors=1111, which looks native on the web both on desktop and mobile |
Beta Was this translation helpful? Give feedback.
-
That's true. It doesn't have as much browser support, but I think the native input makes sense. |
Beta Was this translation helpful? Give feedback.
-
The native support is not there for browsers like Safari (the underlying "input" control falls back to text-only on such browsers) so I wouldn't go that route until all browsers have caught up. I am now using react-datepicker in my web solution which is not terrible, maybe you can just wrap that to add web support for now: https://www.npmjs.com/package/react-datepicker It can run in inline mode as well as in portal mode (modal-like), there are a few tricks to get it working properly but not too bad and now that it works it looks quite good compared to the other things i've tried. I can share that code if you're interested. |
Beta Was this translation helpful? Give feedback.
-
Yeah that'd be great if you could share, I had some trouble with it when I tried it. Don't love the design but it's simple. |
Beta Was this translation helpful? Give feedback.
-
I'll just sum it up here. This is for an Expo Web app which will then work on the mobile as well as web. Add these to your project (in addition to react-native-modal-datetime-picker):
Import this at the top of your main form: File 1: filename must be "ReactDatePicker_CSSHelper.js": File 2: filename must be "ReactDatePicker_CSSHelper.native.js": The state stuff at the top of your main form: The state stuff declared at the top inside the function() {...} block: Add these functions to your main form inside the function() {...} block: In your main form's return statement: @mmazzarolo I'm pretty sure the above could easily be pulled into react-native-modal-datetime-picker to provide Expo Web support. |
Beta Was this translation helpful? Give feedback.
-
Very happy we're having this discussion 💥 Let me ask you all a question: why do you feel adding support for the web to this component would be a good idea? To clarify: I'm not against adding support for it here 👍 I'm just wondering if it's the right approach or not, given that what this modal datetimepicker is doing is just wrapping the community picker and expose it into a unified modal-UI. |
Beta Was this translation helpful? Give feedback.
-
I hear you, i think maybe it does not belong inside either of these because they are both based on native - and the react-datepicker is not native. Actually i think it would make most sense to create a new component based on the code i sent earlier which then uses react- native-modal-datetimepicker for mobile and react-datepicker for the web. The purpose of such a component would simply be to provide a reasonable out-of-the-box component that people can use in an Expo Web / React Native Web app which works from the mobile as well as from the web. Because currently there is nothing even close to decent and cross-browser out there that does both, at least none that i could find. What do you think? |
Beta Was this translation helpful? Give feedback.
-
I don't see this as the main problem in all honesty. I think the "native" word in the react-native ecosystem is more scoped to the platform where the code itself run... meaning for the web it will be JS, which is fine. |
Beta Was this translation helpful? Give feedback.
-
Ok, but i mean the true web native control for picking a date is the <input ... type="date" ...> as per https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date - which is not supported by all modern browsers. So react-datepicker is not the actual native thing. But maybe that doesn't matter that much. But anyway i just thought i would share my code as i struggled a bit to get it working. I don't have the time right now to do a separate wrapper for it but i think it would work well, so if anyone else wants to run with it please feel free. I have added a reference to this thread on the react-native-datetimepicker project: https://github.com/react-native-datetimepicker/datetimepicker/issues/318. Maybe they will consider incorporating it there. |
Beta Was this translation helpful? Give feedback.
-
I've come to agree with this. I have tried a number of web date pickers in the past few days. Materials UI's has been the best one to use on web for a number of reasons.
I understand the motivation to use a native HTML date picker to stay closer to the browser's api. That said, I think such a picker belongs in This library is a modal date time picker, and it should have a modal experience on all platforms IMO. The material UI one is very smooth, lightweight, and has a design that's consistent with this modal picker. |
Beta Was this translation helpful? Give feedback.
-
Just wanted to put this out there as of Oct 22 Safari now supports the date, time, and date-time picker. So they are fully supported across all browsers except IE. I am using the web-native date pickers and think it's the way to go. However, I would agree that maybe it doesn't belong in this repo. |
Beta Was this translation helpful? Give feedback.
-
Relevant package: https://github.com/web-ridge/react-native-paper-dates |
Beta Was this translation helpful? Give feedback.
-
Hey @nigranac ! This is not the right place to discuss your issue :) Please ask on Stackoverflow, thanks! |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Hello so is it possible to use this package for web? |
Beta Was this translation helpful? Give feedback.
-
Ask your Question
Are there plans to support web? It would be awesome to have a universal date picker that also works on web.
Beta Was this translation helpful? Give feedback.
All reactions