Skip to content

Latest commit

 

History

History
37 lines (30 loc) · 905 Bytes

readme.md

File metadata and controls

37 lines (30 loc) · 905 Bytes

uniforms-masked-phone-field

React component for unifroms-material with input mask

Install

npm i styleschool/uniforms-masked-phone-field

Example

import MaskedField from 'uniforms-masked-phone-field';
import { AutoForm, AutoField } from 'uniforms-material';
import SimpleSchema from 'simpl-schema';
import SimpleSchema2Bridge from 'uniforms/SimpleSchema2Bridge';

const Bridge = new SimpleSchema2Bridge(new SimpleSchema({
  phone: {
    type: String,
    uniforms: {
      component: (props: any) => <MaskedField {...props} />,
    },
  },
  // Region field auto-implemented in MaskedField.
  // It have no need to be placed in Autoform manualy.
  // ATTEMPT! You must use AutoForm component with AutoFiled, but not by itself.
  region: {
    type: String,
  }
}));

<AutoForm schema={Bridge}>
  <AutoField name="phone"/>
</AutoForm>