Clean up InputDate types
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {View, TextInputProps, TextStyle, Pressable} from 'react-native'
|
import {View, TextStyle, Pressable} from 'react-native'
|
||||||
import DateTimePicker, {
|
import DateTimePicker, {
|
||||||
BaseProps as DateTimePickerProps,
|
BaseProps as DateTimePickerProps,
|
||||||
} from '@react-native-community/datetimepicker'
|
} from '@react-native-community/datetimepicker'
|
||||||
@@ -8,14 +8,13 @@ import {Logo} from '#/view/icons/Logo'
|
|||||||
import {useTheme, atoms, tokens} from '#/alf'
|
import {useTheme, atoms, tokens} from '#/alf'
|
||||||
import {Text} from '#/view/com/Typography'
|
import {Text} from '#/view/com/Typography'
|
||||||
import {useInteractionState} from '#/view/com/util/hooks/useInteractionState'
|
import {useInteractionState} from '#/view/com/util/hooks/useInteractionState'
|
||||||
import {BaseProps} from '#/view/com/forms/types'
|
|
||||||
|
import {InputDateProps} from '#/view/com/forms/InputDate/types'
|
||||||
import {
|
import {
|
||||||
localizeDate,
|
localizeDate,
|
||||||
toSimpleDateString,
|
toSimpleDateString,
|
||||||
} from '#/view/com/forms/InputDate/utils'
|
} from '#/view/com/forms/InputDate/utils'
|
||||||
|
|
||||||
type Props = Omit<TextInputProps, 'placeholder' | 'value'> & BaseProps
|
|
||||||
|
|
||||||
export * as utils from '#/view/com/forms/InputDate/utils'
|
export * as utils from '#/view/com/forms/InputDate/utils'
|
||||||
|
|
||||||
export function InputDate({
|
export function InputDate({
|
||||||
@@ -27,7 +26,7 @@ export function InputDate({
|
|||||||
accessibilityLabel,
|
accessibilityLabel,
|
||||||
accessibilityHint,
|
accessibilityHint,
|
||||||
...props
|
...props
|
||||||
}: Props) {
|
}: InputDateProps) {
|
||||||
const labelId = React.useId()
|
const labelId = React.useId()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const [open, setOpen] = React.useState(false)
|
const [open, setOpen] = React.useState(false)
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {View, TextInputProps} from 'react-native'
|
import {View} from 'react-native'
|
||||||
import DateTimePicker, {
|
import DateTimePicker, {
|
||||||
DateTimePickerEvent,
|
DateTimePickerEvent,
|
||||||
} from '@react-native-community/datetimepicker'
|
} from '@react-native-community/datetimepicker'
|
||||||
|
|
||||||
import {useTheme, atoms} from '#/alf'
|
import {useTheme, atoms} from '#/alf'
|
||||||
import {Text} from '#/view/com/Typography'
|
import {Text} from '#/view/com/Typography'
|
||||||
import {BaseProps} from '#/view/com/forms/types'
|
|
||||||
import {toSimpleDateString} from '#/view/com/forms/InputDate/utils'
|
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'
|
export * as utils from '#/view/com/forms/InputDate/utils'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,7 +25,7 @@ export function InputDate({
|
|||||||
label,
|
label,
|
||||||
accessibilityLabel,
|
accessibilityLabel,
|
||||||
accessibilityHint,
|
accessibilityHint,
|
||||||
}: Props) {
|
}: InputDateProps) {
|
||||||
const labelId = React.useId()
|
const labelId = React.useId()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const [value, setValue] = React.useState(initialValue)
|
const [value, setValue] = React.useState(initialValue)
|
||||||
|
|||||||
@@ -8,11 +8,9 @@ import {useTheme, atoms, tokens} from '#/alf'
|
|||||||
import {Text} from '#/view/com/Typography'
|
import {Text} from '#/view/com/Typography'
|
||||||
import {useInteractionState} from '#/view/com/util/hooks/useInteractionState'
|
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'
|
import {toSimpleDateString} from '#/view/com/forms/InputDate/utils'
|
||||||
|
|
||||||
type Props = BaseProps
|
|
||||||
|
|
||||||
export * as utils from '#/view/com/forms/InputDate/utils'
|
export * as utils from '#/view/com/forms/InputDate/utils'
|
||||||
|
|
||||||
export function InputDate({
|
export function InputDate({
|
||||||
@@ -24,7 +22,7 @@ export function InputDate({
|
|||||||
accessibilityLabel,
|
accessibilityLabel,
|
||||||
accessibilityHint,
|
accessibilityHint,
|
||||||
...props
|
...props
|
||||||
}: Props) {
|
}: InputDateProps) {
|
||||||
const labelId = React.useId()
|
const labelId = React.useId()
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
const [value, setValue] = React.useState<string>(initialValue)
|
const [value, setValue] = React.useState<string>(initialValue)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {AccessibilityProps, TextInputProps} from 'react-native'
|
import {AccessibilityProps} from 'react-native'
|
||||||
|
|
||||||
export type RequiredAccessibilityProps = Required<AccessibilityProps>
|
export type RequiredAccessibilityProps = Required<AccessibilityProps>
|
||||||
|
|
||||||
@@ -15,8 +15,4 @@ export type BaseProps<T = string> = Omit<
|
|||||||
testID: string
|
testID: string
|
||||||
label?: string
|
label?: string
|
||||||
hasError?: boolean
|
hasError?: boolean
|
||||||
/**
|
|
||||||
* **NOTE:** Available only on web
|
|
||||||
*/
|
|
||||||
autoFocus?: TextInputProps['autoFocus']
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user