react-native-international-phone-number 0.4.4 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -122,18 +122,18 @@ export class App extends React.Component {
122
122
  return (
123
123
  <View style={{ width: '100%', flex: 1, padding: 24 }}>
124
124
  <PhoneInput
125
- value={this.inputValue}
125
+ value={this.state.inputValue}
126
126
  onChangePhoneNumber={this.handleInputValue}
127
- selectedCountry={this.selectedCountry}
127
+ selectedCountry={this.state.selectedCountry}
128
128
  onChangeSelectedCountry={this.handleSelectedCountry}
129
129
  />
130
130
  <View style={{ marginTop: 10 }}>
131
131
  <Text>
132
132
  Country:{' '}
133
- {`${this.selectedCountry?.name} (${this.selectedCountry?.cca2})`}
133
+ {`${this.state.selectedCountry?.name} (${this.state.selectedCountry?.cca2})`}
134
134
  </Text>
135
135
  <Text>
136
- Phone Number: {`${this.selectedCountry?.callingCode} ${this.inputValue}`}
136
+ Phone Number: {`${this.state.selectedCountry?.callingCode} ${this.state.inputValue}`}
137
137
  </Text>
138
138
  </View>
139
139
  </View>
@@ -49,12 +49,14 @@ export default function getCountryByPhoneNumber(phoneNumber) {
49
49
  }
50
50
  }
51
51
 
52
- matchingCountry = {
53
- name: matchingCountry.name,
54
- cca2: matchingCountry.cca2,
55
- flag: matchingCountry.flag,
56
- callingCode: matchingCountry.callingCode,
57
- };
52
+ if (matchingCountry) {
53
+ matchingCountry = {
54
+ name: matchingCountry.name,
55
+ cca2: matchingCountry.cca2,
56
+ flag: matchingCountry.flag,
57
+ callingCode: matchingCountry.callingCode,
58
+ };
59
+ }
58
60
 
59
61
  return matchingCountry;
60
62
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-international-phone-number",
3
3
  "author": "AstrOOnauta (https://github.com/AstrOOnauta)",
4
- "version": "0.4.4",
4
+ "version": "0.4.5",
5
5
  "description": "International mobile phone input component with mask for React Native",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",