How to use rc-field-form - 1 common examples

To help you get started, we’ve selected a few rc-field-form examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ant-design / ant-design / components / form / util.ts View on Github external
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];

rc-field-form

React Form Component

MIT
Latest version published 10 days ago

Package Health Score

81 / 100
Full package analysis

Popular rc-field-form functions