-
- Notifications
You must be signed in to change notification settings - Fork 453
Closed
Description
If i open the Datepicker it opens twice on Android. I select in the first Dialog a date. then the same dialog opens again and i have to select a date again . After the second time it will accept the input. Can someone help me?
Thats the code of the component. Most of the components are just for styling:
const DatePickerInput = ({ inputName, locale, labelKey, max, min, }) => { const { values, setFieldValue } = useFormikContext(); const [t] = useTranslation('validatedTextInput'); const [showDatePicker, setShowDatePicker] = useState(false); const initialDate = values[inputName] || new Date(); const [selectedDate, setSelectedDate] = useState(moment(initialDate).toDate()); const datePlaceholderKey = 'datePlaceholder'; return ( <DatePickerContainer> <DatePickerLabel> {t(labelKey)} </DatePickerLabel> <DatePickerButtonContainer> <DatePickerButton onPress={() => setShowDatePicker(!showDatePicker)} > <DatePickerButtonText> {selectedDate ? moment(selectedDate).format('L') : t(datePlaceholderKey)} </DatePickerButtonText> <DatePickerButtonImage source={Calendar} /> </DatePickerButton> </DatePickerButtonContainer> { showDatePicker && ( <DateTimePicker mode="date" display="spinner" value={selectedDate} onChange={(event, value) => { setFieldValue(inputName, value); setShowDatePicker(!showDatePicker); // setSelectedDate(value); }} maximumDate={max} minimumDate={min} locale={locale} /> ) } </DatePickerContainer> ); }; Thx for your help
tsoojdev-zz, tranhoangduong1994, YuriBecker, chismadalina, SaeedZhiany and 76 moreSteffi3rd, ArturoTorresMartinez and Shail-Patel-1Steffi3rd, ArturoTorresMartinez, Shail-Patel-1 and rahultripathi-devSteffi3rd, ArturoTorresMartinez and Shail-Patel-1
Metadata
Metadata
Assignees
Labels
No labels