Giter VIP home page Giter VIP logo

react-intl-tel-input-v2's Introduction

react-intl-tel-input-v2

React component wrap for intl-tel-input

Installation

$ npm install --save intl-tel-input react-intl-tel-input-v2

Usage

import 'intl-tel-input/build/css/intlTelInput.css';
import ReactIntlTelInput from 'react-intl-tel-input-v2';

export default () => {
  const inputProps = {
    placeholder: 'ReactIntlTelInput',
  };

  const intlTelOpts = {
    preferredCountries: ['cn'],
  };

  const value = { iso2: 'cn', dialCode: '86', phone: '12345678901' };

  const onChange = value => console.log(value);
  const onReady = (instance, IntlTelInput) => console.log(instance, IntlTelInput);

  return (
    <ReactIntlTelInput
      inputProps={inputProps}
      intlTelOpts={intlTelOpts}
      value={value}
      onChange={onChange}
      onReady={onReady}
    />
  );
}

propTypes

className:                PropTypes.string,
inputProps:               PropTypes.object,
intlTelOpts:              PropTypes.object,
value:                    PropTypes.object,
onChange:                 PropTypes.func,
onReady:                  PropTypes.func,
onCountryDropdownOpen:    PropTypes.func,
onCountryDropdownClose:   PropTypes.func,

intlTelOpts

defaultProps

className: null,
inputProps: {},
intlTelOpts: {},
onChange: () => {},
onReady: () => {},
onCountryDropdownOpen: () => {},
onCountryDropdownClose: () => {},

License

MIT

react-intl-tel-input-v2's People

Contributors

xlsdg avatar

Stargazers

Shyam Prasad avatar Ousmane Coulibaly avatar Moataz Mohammady avatar Cleverson Fernandes avatar Emrah ÖZDEMİR avatar Andrei Kandratovich avatar

Forkers

lakylekidd

react-intl-tel-input-v2's Issues

Validation?

It doesn't seem there's any ability to access the intl-tel-input validation rules. Am I wrong about that? Even through the instance, there's no ability to access the great methods that come with the initial vanilla Javascript package. Anyone have any insight into this?

SyntaxError: Unexpected identifier at Jest test

I'v got an error while trying to check component with unit tests using Jest

({"Object.":function(module,exports,require,__dirname,__filename,global,jest){import baseGet from './_baseGet.js';

SyntaxError: Unexpected identifier

  at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:403:17)
  at Object.<anonymous> (node_modules/react-intl-tel-input-v2/dist/ReactIntlTelInput.cjs.js:8:28)

Value issue when using multiple countries

For example I have set countries to
const intlTelOpts = { preferredCountries: ['ma'], onlyCountries : ['ma', 'fr','it'] };
While for the const value it only accept one country so I can either set it as this
const value = { iso2: 'ma' , dialCode: '212' , phone: null}; which makes the input select only one country even if I change it.

or this
const value = { iso2: null , dialCode: null , phone: null};

which makes the iso2 and dialcode change, when I switch country but once I start inserting a value, the iso2 and dialcode are null again.

if I try to add multiple countries to iso2 and dialcode I get errors. Any solution?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.