From 40446a13044b5d45a920c3c9cf3cea8837255385 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Tue, 9 Jan 2024 17:58:47 -0600 Subject: [PATCH] Add labels to input --- src/view/com/forms/InputText.tsx | 23 +++++++++++++++++++++-- src/view/screens/DebugNew.tsx | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/view/com/forms/InputText.tsx b/src/view/com/forms/InputText.tsx index 4f136a3241..55506b84d7 100644 --- a/src/view/com/forms/InputText.tsx +++ b/src/view/com/forms/InputText.tsx @@ -2,14 +2,17 @@ import React from 'react' import {View, TextInput, TextInputProps, TextStyle} from 'react-native' import {useTheme, atoms, web, tokens} from '#/alf' +import {Text} from '#/view/com/Typography' type Props = Omit & { + label?: string placeholder: string hasError?: boolean icon?: React.FunctionComponent } -export function InputText({hasError, icon: Icon, ...props}: Props) { +export function InputText({label, hasError, icon: Icon, ...props}: Props) { + const labelId = React.useId() const t = useTheme() const [state, setState] = React.useState({ hovered: false, @@ -77,7 +80,23 @@ export function InputText({hasError, icon: Icon, ...props}: Props) { return ( + {label && ( + + {label} + + )} + - +