Zhigang Fang d22d5fd3f9 Merge pull request #7 from mbellagamba/fix-react-native-version
Fix React Native peer dependency version
2020-10-17 11:28:27 +08:00
2020-01-03 11:46:22 +08:00
2020-08-19 14:35:36 +02:00
2020-07-06 13:21:46 +02:00
2020-07-06 13:21:46 +02:00
2020-07-12 15:09:49 +02:00
2020-07-06 13:21:46 +02:00
2020-07-08 11:20:13 +02:00

react-json-schema-form themed for react-native

Getting Started

yarn add @rjsf/core rjsf-native

# This package also depends on `@react-native-community/slider`
yarn add @react-native-community/slider

Usage

import ReactNativeForm from 'rjsf-native';

const App = () => {
  const form = useRef(null);
  return (
    <ReactNativeForm
      ref={form}
      onError={e => {
        console.log(e);
        Alert.alert('Please check your form');
      }}
      schema={schema}
      uiSchema={uiSchema}
      onSubmit={form => console.log(form.formData)}>
      <Button
        title="Submit"
        onPress={() => {
          form.current?.submit();
        }}
      />
    </ReactNativeForm>
  );
};

We also provide a Context as a form of overriding defaults and theming

import ReactNativeForm, {defaultProps, FormContext} from 'rjsf-native';

const App = () => {
  const form = useRef(null)
  return (
    <FormContext value={{...defaultProps, requiredTitle: '*'}}>
        <ReactNativeForm .../>
    </FormContext>
  )
}

Form Context Props

{
  theme: {
    primaryColor: string; // Your main theme color. Used for e.g. buttons
    highlightColor: string; // Used for focused inputs, checked checkboxes, slider...
    borderColor: string; // Color of textinput borders
    textColor: string;
    placeholderTextColor: string;
    errorColor: string;
    [propName: string]: any;
  };
  requiredTitle: string;
  arrayAddTitle: string;
  radioLabelMapping?: (label: string) => string;
  [propName: string]: any;
}

Development

  1. Run npm start in root folder to run the dev server
  2. cd example && npm run android to start the example app
Description
No description provided
Readme 1.1 MiB
Languages
TypeScript 62%
Java 11.9%
Ruby 10.2%
Objective-C 8.4%
JavaScript 6.3%
Other 1.2%