0.0.7 • Published 6 years ago

react-native-form-runtime v0.0.7

Weekly downloads
9
License
MIT
Repository
github
Last release
6 years ago

React Native Form Runtime

Form runtime is a react container that let you to have dynamic forms based on design json schema.

Sample output

Installing

$ yarn add react-native-form-runtime

Simple Example

import FormRuntime from "react-native-form-runtime";
...
const formDesign = [
      {
        type: "Text",
        field: "firstName",
        label: "First Name"
      },
      {
        type: "Number",
        field: "age",
        label: "Age"
      },
      {
        type: "Picker",
        field: "gender",
        label: "Select Gender",
        options: ["Male", "Female"]
      }
    ];
...
_submit(formData: {}, ACTION: string) {
    console.log(formData);
}
...
 <FormRuntime
    formDesign={formDesign}
    type="submit"
    submit={this._submit.bind(this)}
    />

Available Properties

PropertyTypeDescription
formDesignArray of objectsArray holds number of fields in form
typestringAction will be taken when click on submit
submitfunctionFunction will be called to submit your data to server for example.

Available Fields ( Type in form design array)

FieldDescription
Textsimple text input
Numbersimple number input
Checkboxsimple checkbox
Labeltext field
Pickerpicker . MUST have options property .

Todo

  • View Mode
  • Form validation
  • Flow Typed And Linting
  • Test
  • Add Picker Field
  • Add more fields (Cont.)
  • Add Example (Cont.)