![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
material-ui-phone-number-2
Advanced tools
A material-ui react component to format phone numbers. Based on Material UI Phone Number, which ceased to be maintained.
Highly customizable phone input component with auto formatting. Based on mui-phone-number which is not maintained anymore; and which was in turn based on the wonderful react-phone-input-2 package.
This library is actively maintained and currently being rewritten into functional style (previous one was class based).
It looks like this, but in Material Design:
Uses @material-ui/core/TextField for rendering the phone input
npm install material-ui-phone-number-2 --save
import MuiPhoneNumber from 'material-ui-phone-number-2'
React.render(<MuiPhoneNumber defaultCountry={'us'} onChange={handleOnChange} />, document.getElementById('root'))
Your handler for the onChange
event should expect a string as
parameter, where the value is that of the entered phone number. For example:
function handleOnChange(value) {
this.setState({
phone: value,
})
}
Name | Type | Description | Example |
---|---|---|---|
excludeCountries | array | array of country codes to be excluded | ['cu','cw','kz'] |
onlyCountries | array | country codes to be included | ['cu','cw','kz'] |
preferredCountries | array | country codes to be at the top | ['cu','cw','kz'] |
defaultCountry | string | initial country | 'us' |
inputClass | string | class for input | |
dropdownClass | string | class for dropdown container | |
autoFormat | bool | on/off auto formatting, true by default | |
disableAreaCodes | bool | disable local codes for all countries | |
disableCountryCode | bool | false by default | |
disableDropdown | bool | false by default | |
enableLongNumbers | bool | false by default | |
countryCodeEditable | bool | true by default | |
Supported TextField props | |||
See TextField API for possible values https://material-ui.com/api/text-field/ |
Name | Type | Description |
---|---|---|
regions | array/string | to only show codes from selected regions |
Regions |
---|
['america', 'europe', 'asia', 'oceania', 'africa'] |
Subregions |
['north-america', 'south-america', 'central-america', 'carribean', 'european-union', 'ex-ussr', 'middle-east', 'north-africa'] |
Regions selected: {'europe'}
<MuiPhoneNumber defaultCountry="it" regions={'europe'} />
Regions selected: {['north-america', 'carribean']}
<MuiPhoneNumber defaultCountry="ca" regions={['north-america', 'carribean']} />
Name | Type |
---|---|
localization | object |
<MuiPhoneNumber onlyCountries={['de', 'es']} localization={{ Germany: 'Deutschland', Spain: 'España' }} />
onChange | onFocus | onBlur | onClick | onKeyDown |
Country data object not returns from onKeyDown event
Data | Type | Description |
---|---|---|
value/event | string/object | the event or the phone number |
country data | object | the country object { name, dialCode, country code (iso2 format) } |
MIT Licence.
Based on material-ui-phone-number
Based on react-phone-input-2
Based on react-phone-input using MIT
[1.3.0] - 2019-02-15
FAQs
A material-ui react component to format phone numbers. Based on Material UI Phone Number, which ceased to be maintained.
The npm package material-ui-phone-number-2 receives a total of 5,740 weekly downloads. As such, material-ui-phone-number-2 popularity was classified as popular.
We found that material-ui-phone-number-2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.