From 23e62b18de9537b50c8b1df2b4744adc030501d0 Mon Sep 17 00:00:00 2001 From: Samuel Newman Date: Mon, 3 Feb 2025 12:27:58 -0800 Subject: Date input improvements (#7639) * add max date, use modern field for birthday input * rm legacy date input * handle simplifying to simpleDateString internally * update jsdoc --- src/view/com/util/forms/DateInput.tsx | 105 ---------------------------------- 1 file changed, 105 deletions(-) delete mode 100644 src/view/com/util/forms/DateInput.tsx (limited to 'src/view/com/util/forms/DateInput.tsx') diff --git a/src/view/com/util/forms/DateInput.tsx b/src/view/com/util/forms/DateInput.tsx deleted file mode 100644 index 594bb48f6..000000000 --- a/src/view/com/util/forms/DateInput.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import {useCallback, useState} from 'react' -import {StyleProp, StyleSheet, TextStyle, View, ViewStyle} from 'react-native' -import DatePicker from 'react-native-date-picker' -import { - FontAwesomeIcon, - FontAwesomeIconStyle, -} from '@fortawesome/react-native-fontawesome' -import {useLingui} from '@lingui/react' - -import {usePalette} from '#/lib/hooks/usePalette' -import {TypographyVariant} from '#/lib/ThemeContext' -import {useTheme} from '#/lib/ThemeContext' -import {isAndroid, isIOS} from '#/platform/detection' -import {Text} from '../text/Text' -import {Button, ButtonType} from './Button' - -interface Props { - testID?: string - value: Date - onChange: (date: Date) => void - buttonType?: ButtonType - buttonStyle?: StyleProp - buttonLabelType?: TypographyVariant - buttonLabelStyle?: StyleProp - accessibilityLabel: string - accessibilityHint: string - accessibilityLabelledBy?: string - handleAsUTC?: boolean -} - -export function DateInput(props: Props) { - const {i18n} = useLingui() - const [show, setShow] = useState(false) - const theme = useTheme() - const pal = usePalette('default') - - const onChangeInternal = useCallback( - (date: Date) => { - setShow(false) - props.onChange(date) - }, - [setShow, props], - ) - - const onPress = useCallback(() => { - setShow(true) - }, [setShow]) - - const onCancel = useCallback(() => { - setShow(false) - }, []) - - return ( - - {isAndroid && ( - - )} - {(isIOS || show) && ( - - )} - - ) -} - -const styles = StyleSheet.create({ - button: { - flexDirection: 'row', - alignItems: 'center', - gap: 10, - }, -}) -- cgit 1.4.1