Code Monkey home page Code Monkey logo

react-native-country-code-telephone-input's Introduction

React native phone number picker and Numeric pin picker

Ready-to-use components for building a Whatsapp style user onboarding workflow

  • Accept user phone input
  • Basic validation for user phone input based on country code
  • Country calling code picker
  • Validate 6 digit pin
  • Works for both android and iOS
  • little emphasis on look and feel and more on functionality. Users can always change color/images etc

Dependency: React-Native

Example

npm install react-native-country-code-telephone-input --save
import PhoneNumberPicker from 'react-native-country-code-telephone-input'

class UserOnBoarding extends React.Component {
        PhoneNumberPickerChanged(country, callingCode, phoneNumber) {
            this.setState({countryName: country.name, callingCode: callingCode, phoneNo:phoneNumber});
         }

         render() {
         <PhoneNumberPicker
         countryHint={{name: 'United States', cca2: 'US', callingCode:"1"}}
         onChange={this.PhoneNumberPickerChanged.bind(this)}/>
         }
}

See ExampleTelephoneInput for a sample.

#git clone https://github.com/farazshaikh/react-native-country-code-telephone-input
#cd react-native-country-code-telephone-input/ExampleTelephoneInput
#npm install
#react-native run-ios

Changelog

  • 0.0.1 first version

MIT

Contributions welcome.

react-native-country-code-telephone-input's People

Contributors

farazshaikh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-native-country-code-telephone-input's Issues

Cannot read property 'func' of undefined

It seems that this library outdated.

Cannot read property 'func' of undefined

countrypicker.js:59:34
loadModuleImplementation
require.js:174:4
guardedLoadModule
require.js:126:11
_require
require.js:110:2

phonenumberpicker.js:21
loadModuleImplementation
require.js:174:4
guardedLoadModule
require.js:126:11
_require
require.js:110:2

SignupForm.js:4
loadModuleImplementation
require.js:174:4

My project deps are:

	"dependencies": {
		"focus-redux-reducer": "~1.0.2-3",
		"libphonenumber-js": "^0.4.32",
		"material-native": "0.0.0-alpha.12",
		"react": "~16.0.0-alpha.12",
		"react-native": "^0.48.4",
		"react-native-country-code-telephone-input": "0.0.9",
		"react-native-firebase": "~3.0.0",
		"react-native-i18n": "^2.0.6",
		"react-native-router-flux": "^4.0.0-beta.21",
		"react-native-vector-icons": "^4.4.0",
		"react-redux": "^5.0.6",
		"redux": "^3.7.2",
		"redux-thunk": "^2.2.0"
	},

screenshot_1507705664

Overide existing styles

Is there a way through which one can extend or override existing style properties, such as changing font size and country selector color ?

undefined is not an object

After installing this plugin, and using those code im seeing this error

undefined is not an object (evaluating '_react3.default.PropTypes.func')
<unknown>
    countrypicker.js:60:34
loadModuleImplementation
    require.js:191:12
guardedLoadModule
    require.js:138:36
_require
    require.js:118:20
<unknown>
    phonenumberpicker.js:21
loadModuleImplementation
    require.js:191:12
guardedLoadModule
    require.js:138:36
_require
    require.js:118:20
<unknown>
    Register.js:3
loadModuleImplementation
    require.js:191:12
guardedLoadModule
    require.js:138:36
_require
    require.js:118:20
<unknown>
    Login.js:4
loadModuleImplementation
    require.js:191:12
guardedLoadModule
    require.js:138:36
_require
    require.js:118:20
<unknown>
    App.js:7
loadModuleImplementation
    require.js:191:12
guardedLoadModule
    require.js:138:36
_require
    require.js:118:20
<unknown>
    crna-entry.js:27:19
loadModuleImplementation
    require.js:191:12
guardedLoadModule
    require.js:131:45
_require
    require.js:118:20
global code
    

Trouble with Prop Types

I was trying to use this module, but I find a problem that made build again all my project, it was with the Prop Types module from React. But in the latest versions the way to call it is:
import { PropTypes } from 'prop-types';

So the fix for countryPicker.js is first import it

import { PropTypes } from 'prop-types';

and on static propTypes variable
static propTypes = { onChange: PropTypes.func.isRequired, }

Also in phoenumberpicker.js
import { PropTypes } from 'prop-types';
And then defining the propTypes class variable:
PhoneNumberPicker.propTypes = { onChange: PropTypes.func, countryHint: PropTypes.object, }

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.