exposes useFieldType hook for public consumption

This commit is contained in:
James
2020-06-02 16:55:31 -04:00
parent 061621ff7e
commit 5b88f139d9
2 changed files with 9 additions and 1 deletions

View File

@@ -15,7 +15,9 @@ const useFieldType = (options) => {
const locale = useLocale();
const formContext = useContext(FormContext);
const { dispatchFields, submitted, processing } = formContext;
const {
dispatchFields, submitted, processing, fields,
} = formContext;
let mountValue = formContext.fields[name]?.value;
if (!mountValue && mountValue !== false) mountValue = null;
@@ -62,6 +64,7 @@ const useFieldType = (options) => {
value: valueToRender,
formSubmitted: submitted,
formProcessing: processing,
fields,
onFieldChange: (e) => {
if (e && e.target) {
sendField(e.target.value);