0.3.51 • Published 1 year ago

@nozify/form-builder v0.3.51

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

React-native form-builder

Getting Started

npm --save @rjsf/core @nozify/form-builder
# This package also depends on `@react-native-community/slider`
npm --save @react-native-community/slider

Usage

import FormBuilder, { defaultProps, FormContext } from '@nozify/form-builder';

const schema = {
  title: 'Todo',
  type: 'object',
  required: ['title'],
  properties: {
    title: { type: 'string', title: 'Title', default: 'A new task' },
    done: { type: 'boolean', title: 'Done?', default: false },
  },
};

const Form = () => {
  const form: any = useRef<any>();

  const onSubmit = (formData: any) => {};

  return (
    <FormContext.Provider
      value={{
        ...defaultProps,
      }}>
      <ScrollView>
        {schema && (
          <FormBuilder
            ref={form}
            onError={(e) => {
              console.log(e);
            }}
            schema={schema as any}
            onSubmit={(f: any) => onSubmit(f.formData)}>
            <Button
              title="Save"
              onPress={() => {
                if (form.current) {
                  (form.current as any)?.submit();
                }
              }}
            />
          </FormBuilder>
        )}
      </ScrollView>
    </FormContext.Provider>
  );
};
0.7.279

1 year ago

0.7.149

1 year ago

0.7.7

1 year ago

0.6.204

1 year ago

0.6.370

1 year ago

0.6.170

1 year ago

0.6.199

1 year ago

0.6.155

1 year ago

0.6.198

1 year ago

0.6.87

1 year ago

0.6.6

2 years ago

0.6.3

2 years ago

0.6.2

2 years ago

0.6.5

2 years ago

0.6.4

2 years ago

0.6.1

2 years ago

0.6.59

2 years ago

0.3.51

2 years ago