Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function useForm(form?: FormInstance): [FormInstance] {
const wrapForm: FormInstance = form || {
...useRcForm()[0],
__INTERNAL__: {},
scrollToField: name => {
const namePath = toArray(name);
const fieldId = getFieldId(namePath, wrapForm.__INTERNAL__.name);
const node: HTMLElement | null = fieldId ? document.getElementById(fieldId) : null;
if (node) {
scrollIntoView(node, {
scrollMode: 'if-needed',
block: 'nearest',
});
}
},
};
return [wrapForm];