0.1.6 • Published 7 years ago

vb-react-phone-number v0.1.6

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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

0.1.6

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago