From c89dea181a25ecf43ba9b1bdb980dbd18f0b1960 Mon Sep 17 00:00:00 2001 From: Emilio Hernandez Date: Mon, 30 Mar 2026 18:32:27 +0200 Subject: [PATCH] fix: pass onOpen to FlagButton and extend DE phone mask - renderFlagButton was ignoring the props passed by CountryPicker, which include onOpen. This caused tapping the flag emoji to do nothing because FlagButton's internal TouchableOpacity had no onPress handler. Now onOpen is forwarded so tapping the flag opens the country modal. - The German (DE) mask only allowed 6 digits, blocking mobile numbers like +49 176 96079449 (11 digits). Updated mask to support up to 11-digit numbers (XXXX XXXXXXX format). Closes #9 --- src/PhoneInput/PhoneInput.tsx | 3 ++- src/PhoneInput/constants.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/PhoneInput/PhoneInput.tsx b/src/PhoneInput/PhoneInput.tsx index 675c862..b5c69a4 100644 --- a/src/PhoneInput/PhoneInput.tsx +++ b/src/PhoneInput/PhoneInput.tsx @@ -42,11 +42,12 @@ export const PhoneInput: React.FC = (props) => { } = props; const renderFlagButton = useCallback( - () => ( + (flagButtonProps?: { onOpen?: () => void }) => ( ), diff --git a/src/PhoneInput/constants.ts b/src/PhoneInput/constants.ts index 162d729..dcec223 100644 --- a/src/PhoneInput/constants.ts +++ b/src/PhoneInput/constants.ts @@ -451,7 +451,7 @@ export const MASK_PER_COUNTRY: Partial<{ GA: [/\d/, ' ', /\d/, /\d/, ' ', /\d/, /\d/, ' ', /\d/, /\d/], GM: [/\d/, /\d/, /\d/, ' ', /\d/, /\d/, /\d/, /\d/], GE: ['(', /\d/, /\d/, /\d/, ')', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/], - DE: [/\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/], + DE: [/\d/, /\d/, /\d/, /\d/, ' ', /\d/, /\d/, /\d/, /\d/, /\d/, /\d/, /\d/], GH: ['0', '3', /\d/, ' ', /\d/, /\d/, /\d/, ' ', /\d/, /\d/, /\d/, /\d/], GI: [/\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/, /\d/], GR: [