react-native-datetimepicker / datetimepicker

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

Cancel & Ok buttons couldn't see at display set spinner #535

Closed nl123 closed 2 years ago

nl123 commented 2 years ago

Bug report

Hi I'm using expo DateTimePicker, My issue is when I set the display to spinner, cancel and ok buttons are not displayed but I can see on other display mode.

Summary

The cancel & open button doesn't appear when display set of spinner

Reproducible sample code

import React, {useState} from 'react'; import {View, Button, Platform} from 'react-native'; import DateTimePicker from '@react-native-community/datetimepicker';

const App = () => { const [date, setDate] = useState(new Date(1598051730000)); const [mode, setMode] = useState('date'); const [show, setShow] = useState(false);

const onChange = (event, selectedDate) => { const currentDate = selectedDate || date; setShow(Platform.OS === 'ios'); setDate(currentDate); };

const showMode = (currentMode) => { setShow(true); setMode(currentMode); };

const showDatepicker = () => { showMode('date'); };

const showTimepicker = () => { showMode('time'); };

return (

vrinch commented 2 years ago

Has anyone found a solution to this?

vonovak commented 2 years ago

hello, thanks for asking. With display=spinner you need to provide your own cancel / ok buttons. Neither UIDatePicker nor this package provide those buttons.

Thank you! :)