Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix flag blurry #123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
CountryCode,
CallingCode,
Country,
} from "react-native-country-picker-modal";
import { CountryFilterProps } from "react-native-country-picker-modal/lib/CountryFilter";
} from "@olegnjadocode/react-native-country-picker-modal";
import { CountryFilterProps } from "@olegnjadocode/react-native-country-picker-modal/lib/CountryFilter";
export interface PhoneInputProps {
withDarkTheme?: boolean;
withShadow?: boolean;
Expand Down Expand Up @@ -299,9 +299,15 @@ export default class PhoneInput extends Component<
getCallingCode: () => string | undefined;
isValidNumber: (number: string) => boolean;
onSelect: (country: Country) => void;
getNumberAfterPossiblyEliminatingZero: () => {number: string , formattedNumber: string };
getNumberAfterPossiblyEliminatingZero: () => {
number: string;
formattedNumber: string;
};
onChangeText: (text: string) => void;
render(): JSX.Element;
}

export function isValidNumber(number: string, countryCode: CountryCode ): boolean;
export function isValidNumber(
number: string,
countryCode: CountryCode
): boolean;
15 changes: 9 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import CountryPicker, {
DEFAULT_THEME,
CountryModalProvider,
Flag,
} from "react-native-country-picker-modal";
} from "@olegnjadocode/react-native-country-picker-modal";
import { PhoneNumberUtil } from "google-libphonenumber";
import styles from "./styles";

Expand All @@ -32,13 +32,16 @@ export default class PhoneInput extends PureComponent {

static getDerivedStateFromProps(nextProps, prevState) {
if (nextProps.disabled !== prevState.disabled) {
if ((nextProps.value || nextProps.value === "") && nextProps.value !== prevState.number) {
return ({ disabled: nextProps.disabled, number: nextProps.value });
if (
(nextProps.value || nextProps.value === "") &&
nextProps.value !== prevState.number
) {
return { disabled: nextProps.disabled, number: nextProps.value };
}
return ({ disabled: nextProps.disabled });
return { disabled: nextProps.disabled };
}
return null;
};
}

async componentDidMount() {
const { defaultCode } = this.props;
Expand Down Expand Up @@ -245,4 +248,4 @@ export const isValidNumber = (number, countryCode) => {
} catch (err) {
return false;
}
};
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"android"
],
"dependencies": {
"google-libphonenumber": "^3.2.10",
"react-native-country-picker-modal": "^2.0.0"
"@olegnjadocode/react-native-country-picker-modal": "^2.0.2",
"google-libphonenumber": "^3.2.10"
},
"devDependencies": {
"metro-react-native-babel-preset": "^0.61.0"
Expand Down
39 changes: 12 additions & 27 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,17 @@
deepmerge "^3.2.0"
hoist-non-react-statics "^3.3.0"

"@olegnjadocode/react-native-country-picker-modal@^2.0.2":
version "2.0.2"
resolved "https://registry.yarnpkg.com/@olegnjadocode/react-native-country-picker-modal/-/react-native-country-picker-modal-2.0.2.tgz#f7fcc4f4a0ea10a3e1f1439fb26f70f48b601fc6"
integrity sha512-TK2m6OvtwYm56O3wkGF5lRNmVIa8ImM6EuV+WTSGKcNDVDLQtGn+9F5OMXf/NdSMFF0QLEPT/YXuuK3yG4XK3w==
dependencies:
"@callstack/react-theme-provider" "3.0.3"
fuse.js "3.4.5"
node-emoji "1.10.0"
prop-types "15.7.2"
react-async-hook "3.6.1"

"@types/hoist-non-react-statics@^3.3.1":
version "3.3.1"
resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f"
Expand Down Expand Up @@ -754,7 +765,7 @@ lodash@^4.17.19:
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==

loose-envify@^1.0.0, loose-envify@^1.4.0:
loose-envify@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
Expand Down Expand Up @@ -811,13 +822,6 @@ minimist@^1.2.5:
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==

[email protected]:
version "0.2.0"
resolved "https://registry.yarnpkg.com/modal-react-native-web/-/modal-react-native-web-0.2.0.tgz#5daaa76213218fd25df739a267b11aed37e8c0c2"
integrity sha512-sC0/jL3ZL4bGtv1VS43TnrH7/FHUqgb7IU3VYWNDzuR223fYlpG5Gc974GsTP172Vi+lnnBL/G70xONmaggxeQ==
dependencies:
warning "^4.0.1"

ms@^2.1.1:
version "2.1.2"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
Expand Down Expand Up @@ -874,18 +878,6 @@ react-is@^16.7.0, react-is@^16.8.1:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==

react-native-country-picker-modal@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/react-native-country-picker-modal/-/react-native-country-picker-modal-2.0.0.tgz#005421303349a81fedf5975e465405bb4b7312d5"
integrity sha512-p0wfkKx1mOCEkn3Qm2/FA8TrxSdUw/nqaCcT6KYvIGmPtPdia1Ce+iWh5G0j2hZcDs6yJSkYAx+7lrZ0HwixAw==
dependencies:
"@callstack/react-theme-provider" "3.0.3"
fuse.js "3.4.5"
modal-react-native-web "0.2.0"
node-emoji "1.10.0"
prop-types "15.7.2"
react-async-hook "3.6.1"

react-refresh@^0.4.0:
version "0.4.3"
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.4.3.tgz#966f1750c191672e76e16c2efa569150cc73ab53"
Expand Down Expand Up @@ -995,10 +987,3 @@ unicode-property-aliases-ecmascript@^1.0.4:
version "1.1.0"
resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz#dd57a99f6207bedff4628abefb94c50db941c8f4"
integrity sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==

warning@^4.0.1:
version "4.0.3"
resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3"
integrity sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==
dependencies:
loose-envify "^1.0.0"