Typing custom form components #922
-
I am trying to create my own components since tanstack form is great, but pretty verbose. I'm using it with react native. I am trying to get one of the following uses. Preferred: <FormInput
name="name"
label="Business name"
placeholder="Hat rentals"
form={form}
validators={{
onSubmit: v.pipe(v.string(), v.minLength(3)),
}}
/> Alternatively (assuming field.name equals name): <form.Field name="name" validators={{ onSubmit: v.pipe(v.string(), v.minLength(3)) }}>
{(field) => (
<FormInput field={field} label="Business name" placeholder="Festi hats rental" />
)}
</form.Field> My biggest issue is with typing. I can't figure out how to properly type form or field. I've looked through the docs and other issues but the closest I could find was #636 and that didn't help me. Any help or guidance would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You may find some hints in #825 and the We'd like to come out with a supported/recommended way of creating custom components/wrappers at some point, feedback is welcome! :) |
Beta Was this translation helpful? Give feedback.
You may find some hints in #825 and the
ReactFormApi
type.We'd like to come out with a supported/recommended way of creating custom components/wrappers at some point, feedback is welcome! :)