import { PropsWithChildren, ReactNode, useEffect, useState } from "react"; import { Pressable, TextInput, TextInputProps, TouchableOpacity, TouchableOpacityProps, View, ViewProps, } from "react-native"; import { Text } from "../common/Text"; interface Props extends ViewProps { title?: string | null | undefined; text?: string | null | undefined; children?: ReactNode; iconAfter?: ReactNode; iconBefore?: ReactNode; textInputProps?: TextInputProps; defaultValue?: string; onChange: (text: string) => void; } export const ListInputItem: React.FC> = ({ title, text, iconAfter, iconBefore, children, onChange, textInputProps, defaultValue, ...props }) => { const [value, setValue] = useState(defaultValue || ""); useEffect(() => { onChange(value); }, [value]); return ( {iconBefore && {iconBefore}} {title} {iconAfter && {iconAfter}} ); };