I was hoping to use https://github.com/xgfe/react-native-datepicker
with react-native-web but it's not compatible I think.
Is there other library that offers native datepicker look as in the image which are compatible with react-native-web
?
Something like this will work. You can call this component instead of the native one if you are on a web platform and it will use the default web date picker.
export default function DateTimePicker({ value, onChange }: Props) {
return createElement('input', {
type: 'date',
value: value,
onInput: onChange,
})
}
one possibility is to write a native input with "date" type with the createElement function from react-native-web library like i did here with select and option tags: https://gist.github.com/orYoffe/1f5d1651bab5d477730aec317ed405fc
Then you would have native behaviour on mobile web and other native supported features
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With