-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFormTextField.tsx
More file actions
45 lines (40 loc) · 1023 Bytes
/
FormTextField.tsx
File metadata and controls
45 lines (40 loc) · 1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { useId } from "react"
import { TextInput } from "react-native"
import Box from "../../design/Box"
import { useTheme } from "../../design/theme"
import Typography from "../../design/Typography"
export interface FormTextFieldProps {
type?: "text"
label: string
value: string
onChange?: (value: string) => void
}
const FormTextField: React.FC<FormTextFieldProps> = ({
label,
value,
onChange,
}) => {
const theme = useTheme()
const id = useId()
return (
<Box style={{ marginVertical: 8 }}>
<Typography nativeID={id} variant="label">
{label}
</Typography>
<TextInput
accessibilityLabel={label}
accessibilityLabelledBy={id}
onChangeText={onChange}
value={value}
style={{
flex: 1,
paddingVertical: 0,
borderBottomWidth: 1,
borderBottomColor: theme.palette.screen.contrast,
color: theme.palette.screen.contrast,
}}
/>
</Box>
)
}
export default FormTextField