ColorInput: fix initial field state

This commit is contained in:
Liam Fitzgerald 2021-07-19 16:04:36 +10:00
parent 768549ce86
commit 52ce332f09
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -37,8 +37,7 @@ function padHex(hex: string) {
export function ColorInput(props: ColorInputProps) {
const { id, placeholder, label, caption, disabled, ...rest } = props;
const [{ value, onBlur }, meta, { setValue, setTouched }] = useField(id);
const [field, setField] = useState('');
// const [error, setError] = useState<string | undefined>();
const [field, setField] = useState(uxToHex(value));
useEffect(() => {
const newValue = hexToUx(padHex(field));