Clean up InputDate types

This commit is contained in:
Eric Bailey
2024-01-10 14:44:14 -06:00
parent 0c8c37b221
commit 24074dea50
4 changed files with 10 additions and 19 deletions
@@ -1,5 +1,5 @@
import React from 'react'
import {View, TextInputProps, TextStyle, Pressable} from 'react-native'
import {View, TextStyle, Pressable} from 'react-native'
import DateTimePicker, {
BaseProps as DateTimePickerProps,
} from '@react-native-community/datetimepicker'
@@ -8,14 +8,13 @@ import {Logo} from '#/view/icons/Logo'
import {useTheme, atoms, tokens} from '#/alf'
import {Text} from '#/view/com/Typography'
import {useInteractionState} from '#/view/com/util/hooks/useInteractionState'
import {BaseProps} from '#/view/com/forms/types'
import {InputDateProps} from '#/view/com/forms/InputDate/types'
import {
localizeDate,
toSimpleDateString,
} from '#/view/com/forms/InputDate/utils'
type Props = Omit<TextInputProps, 'placeholder' | 'value'> & BaseProps
export * as utils from '#/view/com/forms/InputDate/utils'
export function InputDate({
@@ -27,7 +26,7 @@ export function InputDate({
accessibilityLabel,
accessibilityHint,
...props
}: Props) {
}: InputDateProps) {
const labelId = React.useId()
const t = useTheme()
const [open, setOpen] = React.useState(false)
+3 -5
View File
@@ -1,16 +1,14 @@
import React from 'react'
import {View, TextInputProps} from 'react-native'
import {View} from 'react-native'
import DateTimePicker, {
DateTimePickerEvent,
} from '@react-native-community/datetimepicker'
import {useTheme, atoms} from '#/alf'
import {Text} from '#/view/com/Typography'
import {BaseProps} from '#/view/com/forms/types'
import {toSimpleDateString} from '#/view/com/forms/InputDate/utils'
type Props = Omit<TextInputProps, 'placeholder' | 'value'> & BaseProps
import {InputDateProps} from '#/view/com/forms/InputDate/types'
export * as utils from '#/view/com/forms/InputDate/utils'
/**
@@ -27,7 +25,7 @@ export function InputDate({
label,
accessibilityLabel,
accessibilityHint,
}: Props) {
}: InputDateProps) {
const labelId = React.useId()
const t = useTheme()
const [value, setValue] = React.useState(initialValue)
+2 -4
View File
@@ -8,11 +8,9 @@ import {useTheme, atoms, tokens} from '#/alf'
import {Text} from '#/view/com/Typography'
import {useInteractionState} from '#/view/com/util/hooks/useInteractionState'
import {BaseProps} from '#/view/com/forms/types'
import {InputDateProps} from '#/view/com/forms/InputDate/types'
import {toSimpleDateString} from '#/view/com/forms/InputDate/utils'
type Props = BaseProps
export * as utils from '#/view/com/forms/InputDate/utils'
export function InputDate({
@@ -24,7 +22,7 @@ export function InputDate({
accessibilityLabel,
accessibilityHint,
...props
}: Props) {
}: InputDateProps) {
const labelId = React.useId()
const t = useTheme()
const [value, setValue] = React.useState<string>(initialValue)
+1 -5
View File
@@ -1,4 +1,4 @@
import {AccessibilityProps, TextInputProps} from 'react-native'
import {AccessibilityProps} from 'react-native'
export type RequiredAccessibilityProps = Required<AccessibilityProps>
@@ -15,8 +15,4 @@ export type BaseProps<T = string> = Omit<
testID: string
label?: string
hasError?: boolean
/**
* **NOTE:** Available only on web
*/
autoFocus?: TextInputProps['autoFocus']
}