rili-live / react-native-phone-input

Phone input box for React Native
https://www.npmjs.com/package/react-native-phone-input
MIT License
42 stars 54 forks source link

Fix: types of renderFlag function extended #54

Closed Revolt9k closed 11 months ago

Revolt9k commented 11 months ago

Description

Type for renderFlag function extended to make available to place any JSX.Element and render it on flag place.

Motivation

I want to use this lib in FC way with external library (react-native-country-picker-modal) with both auto-detect country by calling code feature and set calling code on country select with modal feature

I've tested, it works fine.

But without this PR i have to deal with type error that says that Type '({ imageSource }: { imageSource: number; }) => JSX.Element' is not assignable to type '({ imageSource }: { imageSource: number; }) => Element'.

CountryPicker in provided example is exported from react-native-country-picker-modal 2.0.0. It's JSX.Element

image image

Additional info

Rendering CountryPicker as children is also not allowed (even though Readme file says it). If you'll accept this PR i'm going to update Readme file too and add to documentation new clean and actual example with external library usage like react-native-country-picker-modal in FC way.

image

Best regards

rililive commented 11 months ago

Thanks for the thorough explaination!

rililive commented 11 months ago

published in 1.3.7