JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18
  • Score
    100M100P100Q62663F
  • License MIT

vb-react-phone-number React component

Package Exports

  • vb-react-phone-number

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vb-react-phone-number) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

VBPhoneNumber

A React component for masking and formatting phone number.

Live Demo

Install

npm

VBPhoneNumber can be used on the server, or bundled for the client using an npm-compatible packaging system such as Browserify or webpack.

npm install vb-react-phone-number --save

Browser bundle

The browser bundle exposes a global VBPhoneNumber variable and expects to find a global React (>= 0.14.0) variable to work with.

Usage

var React = require('react')
var VBPhoneNumber = require('vb-react-phone-number')

var PhoneNumber = React.createClass({
    onChange = (value) => {};

    onInvalidChange = (value) => {};
  
    onValidChange = (value) => {};
  
    onFocus = (event) => {};
  
    onBlur = (event) => {};
  
    render () {
      const { value } = this.props;
      return (
        <VBPhoneNumber {...custom}
          value={value}
          onChange={this.onChange}
          onInvalidChange={this.onInvalidChange}
          onValidChange={this.onValidChange}
          onFocus={this.onFocus}
          onBlur={this.onBlur}
          onlyCountryCodes={['UA', 'US', 'RU', 'DE']}
          favoriteCountryCodes={['US', 'UA', 'RU']}
          errorMessage="Phone number is not valid" />
      )
    }
})

Props

{
    favoriteCountryCodes: PropTypes.arrayOf(PropTypes.string),
    onlyCountryCodes: PropTypes.arrayOf(PropTypes.string),
    value: PropTypes.string,
    errorMessage: PropTypes.string,
    onChange: PropTypes.func,
    onValidChange: PropTypes.func,
    onInvalidChange: PropTypes.func,
    onFocus: PropTypes.func,
    onBlur: PropTypes.func,
    selectComponent: PropTypes.func
}

selectComponent: Custom React Component for customization select of regions

MIT Licensed