react-native-datetimepicker / datetimepicker

React Native date & time picker component for iOS, Android and Windows
MIT License
2.53k stars 413 forks source link

feature: Imperative API for iOS #906

Closed hichemfantar closed 3 months ago

hichemfantar commented 5 months ago

Feature request

Why it is needed

Right now we can build a custom button on Android, but on iOS, we are forced to use the iOS button design. I would like to have a single custom button that launches both android and ios pickers.

Possible implementation

Exactly like the existing imperative android api. It would be possible to create something like this: https://github.com/henninghall/react-native-date-picker?tab=readme-ov-file#modal

Code sample

import { DateTimePickeriOS } from '@react-native-community/datetimepicker';

DateTimePickeriOS.open(params: iOSNativeProps)
DateTimePickeriOS.dismiss(mode: iOSNativeProps['mode'])
vonovak commented 3 months ago

Hello and thanks for asking, this library exposes the native primitives in their simplest form. If you want anything on top of it, like a different API, you need to build it yourself.

Thank you 🙂

ishaangandhi commented 1 week ago

Its not clear that the library does expose the native primitives. What primitive can you use to open the time picker?