react-native-datetimepicker / datetimepicker

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

How to disable DateTimePicker component? #303

Closed RoTTex closed 2 years ago

RoTTex commented 4 years ago

Hello! We need to display DateTimePicker component with disabled flag on iOS. Before iOS14 we used a special header with current time and can disable this header to prevent DateTimePicker overlay open. After iOS 14 we don't see any reasons in this header but we can't disable system DateTimePicker component. As I know, iOS UIDatePicker view has got isEnabled field, that makes what we want: prevent touches and update UI to common disable view (gray text color). As a temp solution we are using another view about our date component, however it doesn't affect component styles. But it would be nice to have the same option in this lib.

coawazie commented 3 years ago

Hello! We need to display DateTimePicker component with disabled flag on iOS. Before iOS14 we used a special header with current time and can disable this header to prevent DateTimePicker overlay open. After iOS 14 we don't see any reasons in this header but we can't disable system DateTimePicker component. As I know, iOS UIDatePicker view has got isEnabled field, that makes what we want: prevent touches and update UI to common disable view (gray text color). As a temp solution we are using another view about our date component, however it doesn't affect component styles. But it would be nice to have the same option in this lib.

This is definitely necessary

pabloteari commented 3 years ago

Great question. Today I am adapting using pointerEvents = {"none"} in a view external to DateTimePicker.

dd-apt commented 3 years ago

Thanks @PabloTeari wrapping in a View w/ that prop set seems to work! Setting pointerEvents to 'auto' when not disabled.

vonovak commented 2 years ago

closed by #412