GithubHelp home page GithubHelp logo

georgehop / react-native-country-codes-picker Goto Github PK

View Code? Open in Web Editor NEW
107.0 1.0 63.0 366 KB

⚡ ⚡ ⚡This lib. provide multi lang. country picker with search functionality. Fully crossplatform and supported on React-native and expo. Didn't find your country ? Just add the required countries or locales and make a PR.⚡ ⚡ ⚡

Home Page: https://github.com/GeorgeHop/react-native-country-codes-picker

License: MIT License

TypeScript 100.00%
react-native picker country codes multilanguage search expo ios android country-codes flags react style styled-components modal bottomsheet searching

react-native-country-codes-picker's Introduction

react-native-country-codes-picker

⚡ ⚡ ⚡ This lib. provide multi lang. country picker or country list with search functionality. Fully crossplatform and supported on React-native and expo. Didn't find your country ? Just add the required countries or locales and make a PR. ⚡ ⚡ ⚡

❗ Before you start! ❗

I'm looking to enhance this library and would love to hear your thoughts on what features you'd like to see in the next version. Currently, I'm drafting a roadmap for the upcoming release of react-native-country-codes-picker.

Considering whether the next version should be based on reanimated v3 for improved performance or if it's better to introduce a flexible hook instead of a new component. Your input is crucial in guiding the development, so please share your ideas on the most valuable additions or changes you'd like to see.

Coming soon 💪 🙏

  1. Custom search input rendering.
  2. Docs update/improve for the best user experience.
  3. Animation improvements.

If you have something interesting ! Just write to us :)

❕ Installation ❕

expo: expo install react-native-country-codes-picker
npm: npm i react-native-country-codes-picker
yarn: yarn add react-native-country-codes-picker

Example

ezgif com-gif-maker

Basic usage

Modal

import {CountryPicker} from "react-native-country-codes-picker";

export default function App() {
  const [show, setShow] = useState(false);
  const [countryCode, setCountryCode] = useState('');

  return (
    <View style={styles.container}>
      <TouchableOpacity
        onPress={() => setShow(true)}
        style={{
            width: '80%',
            height: 60,
            backgroundColor: 'black',
            padding: 10,
        }}
      >
        <Text style={{
            color: 'white',
            fontSize: 20
        }}>
            {countryCode}
        </Text>
      </TouchableOpacity>

      // For showing picker just put show state to show prop
      <CountryPicker
        show={show}
        // when picker button press you will get the country object with dial code
        pickerButtonOnPress={(item) => {
          setCountryCode(item.dial_code);
          setShow(false);
        }}
      />
    </View>
  );
}

Modal with list header

import {CountryPicker} from "react-native-country-codes-picker";

function ListHeaderComponent({countries, lang, onPress}) {
    return (
        <View
            style={{
                paddingBottom: 20,
            }}
        >
            <Text>
                Popular countries
            </Text>
            {countries?.map((country, index) => {
                return (
                    <CountryButton key={index} item={country} name={country?.name?.[lang || 'en']} onPress={() => onPress(country)} />
                )
            })}
        </View>
    )
}

export default function App() {
  const [show, setShow] = useState(false);
  const [countryCode, setCountryCode] = useState('');

  return (
    <View style={styles.container}>
      <TouchableOpacity
        onPress={() => setShow(true)}
        style={{
            width: '80%',
            height: 60,
            backgroundColor: 'black',
            padding: 10,
        }}
      >
        <Text style={{
            color: 'white',
            fontSize: 20
        }}>
            {countryCode}
        </Text>
      </TouchableOpacity>

      // For showing picker just put show state to show prop
      <CountryPicker
        show={show}
        // when picker button press you will get the country object with dial code
        pickerButtonOnPress={(item) => {
          setCountryCode(item.dial_code);
          setShow(false);
        }}
        ListHeaderComponent={ListHeaderComponent}
        popularCountries={['en', 'ua', 'pl']}
      />
    </View>
  );
}

List

import {CountryList} from "react-native-country-codes-picker";

export default function App() {
  const [countryCode, setCountryCode] = useState('');

  return (
    <View style={styles.container}>
      <View        
        style={{
            width: '80%',
            height: 60,
            backgroundColor: 'black',
            padding: 10,
        }}
      >
        <Text style={{
            color: 'white',
            fontSize: 20
        }}>
            {countryCode}
        </Text>
      </TouchableOpacity>

      // All props the same as for picker
       <CountryList
          lang={'pl'}
          pickerButtonOnPress={(item) => {
              setCountryCode(item.dial_code);
          }}
       />
    </View>
  );
}

Props

Below are the props you can pass to the React Component.

Prop Type Default Example Description
show boolean This prop using for displaying the modal. Put your show state here.
pickerButtonOnPress function (country) => setCode(country.dial_code) Put your function/functions here for getting country data from picker.
inputPlaceholder string inputPlaceholder={'Your placeholder'} If you need a custom placeholder for your input you may need this prop.
searchMessage string searchMessage={'Some search message here'} If you want to customize search message just use this prop.
lang string 'en' lang={'pl'} If you need to change the lang. just put one of supported lang. Or if you didn't find required lang just add them and make a PR :)
enableModalAvoiding boolean false enableModalAvoiding={true} Is modal should avoid keyboard ? On android to work required to use with androidWindowSoftInputMode with value pan, by default android will avoid keyboard by itself
androidWindowSoftInputMode string androidWindowSoftInputMode={'pan'} Basicaly android avoid keyboard by itself, if you want to use custom avoiding you may use this prop
itemTemplate ReactNode CountryButton itemTemplate={YourTemplateComponentsHere} This parameter gets a React Node element to render it as a template for each item of the list. These properties are sent to the item: key, item, style, name, and onPress
style Object style={{yoursStylesHere}} If you want to change styles for component you probably need this props. You can check the styling part below.
disableBackdrop boolean false disableBackdrop if you don't wanna show modal backdrop pass this prop.
onBackdropPress function null onBackdropPress={() => setShow(false)} If you want to close modal when user taps on the modal background.
initialState string initialState={'+380'} Sometimes you need to pre-select country for example by user current location so you may use this prop.
excludedCountries array excludedCountries={['RU', 'BY']} In this prop you can define list of countries which you want to remove by adding their codes.
showOnly array showOnly={['UA', 'EN']} This prop allow you to configure which countries you want to show.
popularCountries array popularCountries={['UA', 'EN']} This prop allow you to send popular countries array to your ListHeaderComponent.
ListHeaderComponent JSX.Element ListHeaderComponent={ListHeaderComponent} This prop allow you to create header component to show popular countries on top of list! Check example section with ListHeaderComponent

❕ Also you can use all other FlatList and TextInput props if you need. ❕

Styling

<CountryPicker
    show={show}
    lang={'cz'}
    style={{
        // Styles for whole modal [View]
        modal: {
            height: 500,
            backgroundColor: 'red'
        },
        // Styles for modal backdrop [View]
        backdrop: {
        
        },
        // Styles for bottom input line [View]
        line: {
        
        },
        // Styles for list of countries [FlatList]
        itemsList: {
        
        },
        // Styles for input [TextInput]
        textInput: {
              height: 80,
              borderRadius: 0,
        },
        // Styles for country button [TouchableOpacity]
        countryButtonStyles: {
              height: 80
        },
        // Styles for search message [Text]
        searchMessageText: {

        },
        // Styles for search message container [View]
        countryMessageContainer: {
        
        },
        // Flag styles [Text]
        flag: {

        },
        // Dial code styles [Text]
        dialCode: {

        },
        // Country name styles [Text]
        countryName: {

        }
    }}
    pickerButtonOnPress={(item) => {
        setCountryCode(item.dial_code);
        setShow(false);
    }}
/>

🎌 Supported langs. 🎌

  "name": {
    "en": "English",
    "ru": "Russian",
    "pl": "Polish",
    "ua": "Ukrainian",
    "cz": "Czech",
    "by": "Belarusian",
    "pt": "Portuguese",
    "es": "Espanol",
    "ro": "Romanian",
    "bg": "Bulgarian",
    "de": "German",
    "fr": "French",
    "nl": "Dutch",
    "it": "Italian",
    "cn": "Chinese",
    "ee": "Estonian",
    "jp": "Japanese",
    "he": "Hebrew",
    "tr": "Turkish"
  },

You can add your lang. if you need !!! But after that make a PR please, it will help other people.

Testing

If you are using this package and need to target one of the components in your automated tests, we currently do provide a testID for the following components:

  • The wrapping FlatList component: 'countryCodesPickerFlatList'
  • The country search TextInput component: 'countryCodesPickerSearchInput'
  • The country button (TouchableOpacity) component: 'countryCodesPickerCountryButton'

react-native-country-codes-picker's People

Contributors

alotaibi1217 avatar asdotdev avatar bjorgar avatar brams-s avatar dbrab avatar einsight04 avatar elchawich avatar enlcy avatar erdogansad avatar gbyesiltas avatar georgehop avatar gonalc avatar henrikbn avatar johnf avatar kasperkberg avatar klethor avatar krisisav avatar lorenc-tomasz avatar louismonteiro avatar rafaelamanta avatar rrasconc avatar sheharyar566 avatar stuartrapop avatar zrapar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

react-native-country-codes-picker's Issues

TS error in Flatlist ListHeaderComponent

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

I couldn't spent much time on fixing this ts error, hence i just ignored the line which is causing the ts error.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-country-codes-picker/index.tsx b/node_modules/react-native-country-codes-picker/index.tsx
index 1d2131f..fc7e6e2 100644
--- a/node_modules/react-native-country-codes-picker/index.tsx
+++ b/node_modules/react-native-country-codes-picker/index.tsx
@@ -394,6 +394,7 @@ export const CountryList = ({
             style={[style?.itemsList]}
             keyboardShouldPersistTaps={'handled'}
             renderItem={renderItem}
+            // @ts-ignore
             ListHeaderComponent={(popularCountries && ListHeaderComponent && !searchValue ) &&
                 <ListHeaderComponent countries={preparedPopularCountries} lang={lang}/>}
             {...rest}

This issue body was partially generated by patch-package.

Mobile number templet

Kindly add mobile number templet based on country, so we can display as place holder in textinput

Warning when scrolling the list

 WARN  Please report: Excessive number of pending callbacks: 501. Some pending callbacks that might have leaked by never being called from native code: {"15204":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15207":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15210":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15213":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15216":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15219":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15222":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15225":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15228":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15231":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15234":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15237":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15240":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15243":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15246":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15249":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15252":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15255":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15258":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15261":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15264":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15267":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15270":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15273":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15276":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15279":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15282":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15285":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15288":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15291":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15294":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15297":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15300":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15303":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15306":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15309":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15312":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15315":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15318":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15321":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15324":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15327":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15330":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15333":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15336":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15339":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15342":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15345":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15348":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"15351":{"module":"NativeAnimatedModule","method":"startAnimatingNode"},"...(truncated keys)...":451}
  • Just scroll the list to the very end.

iPhone 12 Pro, iOS 16.3.1
Expo SDK 48
Expo Go

can't avoiding keyboard with enableModalAvoiding

code:

<CountryPicker
      show={show}
      enableModalAvoiding
      style={{
        modal: {height: '50%'},
      }}
      onBackdropPress={() => setShow(false)}
      pickerButtonOnPress={item => onPickCountry(item)}
    />

i was using enableModalAvoiding but it not work in my project

IOS: 16.1 , Simulator : Iphone 14

Feature request - Flag component

Expose the flag component separately. This will help user to create a button with flag and country name, upon touch open the country picker

Improvement suggestions

Just some minor suggestions (I can make a PR for this if needed):

  1. Export the types and CountryButton Component at top level (in index.ts). Makes it easier to use the library
  2. Correctly type ListHeaderComponent with ({countries: CountryItem[], locale: string}) => JSX.Element To avoid TS false-errors when using the library.

Search input should accept country names ignoring letter accents.

I was searching for mexico, but I could not see any result. So, the thing is that I need to search it exactly like ''méxico'' with the ''é'' being accented.

I think it would be nice if we can ignore the accents on the search query for a better user experience.

I fixed this issue by modifying the next lines 119 and 122 in index.tsx

const resultCountries = React.useMemo(() => {
    const lowerSearchValue = searchValue.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");

    return codes.filter((country) => {
        if (country?.dial_code.includes(searchValue) || country?.name[lang || 'en'].toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").includes(lowerSearchValue)) {
            return country;
        }
    });
}, [searchValue]);

I needed to add .normalize("NFD").replace(/[\u0300-\u036f]/g, "") to ignore all accents in search query.

Could this solution be added in the main branch?

missing placeholderTextColor

Hi, in React Native ver. > 0.69.0 it is necessary to specify the placeholderTextColor field in the TextInput component, only in this way the placeholder will be visible. Thanks a lot.
image

Ts error in CountryPicker

the given type for the CountyPicker is a following,

interface Props {
excludedCountries?: string[],
showOnly?: string[],
popularCountries?: string[],

style?: Style,

show: boolean,
enableModalAvoiding?: boolean,
disableBackdrop?: boolean,

onBackdropPress?: (...args: any) => any,
pickerButtonOnPress: (item: CountryItem) => any,
itemTemplate?: (props: ItemTemplateProps) => JSX.Element,
ListHeaderComponent?: (props: ListHeaderComponentProps) => JSX.Element,
onRequestClose?: (...args: any) => any,

lang: string,
inputPlaceholder?: string,
inputPlaceholderTextColor?: TextStyle['color'],
searchMessage?: string,
androidWindowSoftInputMode?: string,
initialState?: string,

}

Now, As I my writing test in my application where I have used this CounteryPicker component, so, I have to test this CountryPicker for that I have find the element of the text input from where I can search the country and then select that country, so for that I have to pass testId to the textInput, the type of CountryPicker does not have the testID props but If I am passing it forcefully than I works.

Please update the import code in guide

The code in guide:
import {CountryPicker} from "react-native-country-codes-picker";
is unable to import the library component onto the required screen. Because the component is exported by default, I used,
import CountryPicker from "react-native-country-codes-picker";
and it worked. I think updating the library will help others, Thank you.

enableModalAvoiding with "Modal Height" not Working

when enableModalAvoiding={true} and you specify the "height" property in the Modal style, the keyboard avoiding view stops working. If you remove the "height" value (from below) it starts working again.

style={{
modal: {
height: 250,
},
}}

Unit Testing with Jest to take a snapshop.

Hello, I was trying to make a snapshop using Jest but it's throwing me this error:

Screen Shot 2022-12-20 at 1 26 54

this is my snapshop:

import React from 'react';
import Phone from '../../../components/storyBook/components/inputs/Phone';
import renderer from 'react-test-renderer';

test('renders correctly', () => {
  const tree = renderer
    .create(
      <Phone
        onCountryCodeChange={() => {}}
        inputValue={''}
        onChangeText={() => {}}
        inputIsDisabled={false}
        floatingLabelText={'Label'}
        inputIsInValid={false}
      />,
    )
    .toJSON();
  expect(tree).toMatchSnapshot();
});

and this is my react component:

        <View>
          <CountryPicker
            lang="es"
            show={show}
            onBackdropPress={() => setShow(false)}
            pickerButtonOnPress={item => {
              setCountryCode(item.flag + ' ' + item.dial_code);
              onCountryCodeChange?.(item.flag + ' ' + item.dial_code);
              setShow(false);
            }}
            inputPlaceholder={'Selecciona tu país'}
            searchMessage={'Lo sentimos, no pudimos encontrar tu país'}
          />
        </View>

any suggestions on how to fix this issue?
"react-native": "0.68.2",
"react-native-country-codes-picker": "^2.2.0",

Handle Back button press

Description

When the back button is pressed, nothing happen which feels like the application is buggy.

Problem

When a Modal is opened, BackButton events are not propagated. As this component is using a Modal, developers cannot catch this event

Solution

Close the modal when the back button is pressed

import { BackHandler } from "react-native";

// Add handleBackButton to props

useEffect(() => {
  let backHandler: NativeEventSubscription;
  if (handleBackButton) {
    backHandler = BackHandler.addEventListener("hardwareBackPress", () => {
      closeModal();
    });
  }

  return () => {
    backHandler?.remove();
  };
}, [handleBackButton]);

Unit Testing onBackdropPress

Hey, I'd like to test the closing of the modal on press to the backdrop (onBackdropPress={() => setShow(false)})
Would it be possible to add a way to test this using jest/react native testing library?

Typescript Support

Hi there,

Any update regarding adding the typescript support to the package? If you need some help, do let me know and we can discuss.

Background color is still white on dark mode

I found a problem that on light mode, the background color is white and text is dark. But when switch to dark mode, background color is still white but text color is change to white. Great work, thank you so much!

Typescript Declarations?

Could not find a declaration file for module 'react-native-country-codes-picker/components/CountryPicker'.

How to preselect a country

We are going to detect user's locale and based on that we need to populate the initial value of the Country Picker. Is there a way to do this?

Dropdown for language only with flags

This package looks great. Thank you.

it would be great to have a second drop down component for choosing languages styled the same way. Same concept - flag on left with language displayed based on currently selected language.

Update package

Hi,
Thanks for the work! Very much appreciated!

I created a pull request to only show popular countries if there is no searchValue. As long as the popular countries doesn't filter when searching, I would prefer them to go away. Possible to merge that (if it looks ok), and update the package with the types-fixes done 3 weeks ago as well?

Element type is invalid

Hello,
I try to use the library in my app, but when I run I get this message:

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

I also tried to import into my APP with this line: import CountryPicker from "react-native-country-codes-picker ";
but in this case I get this message: Error: text strings must be displayed inside a component.

Has anyone encountered the same problem?
Can you help me?

Disable Picker

Please do let me know if there's a way to enable / disable the actual picker.

Want to Customize the flag

I want to customize the flag and want to make it circular, but though I'm receiving flag in Text Component, so I'm no able to customize it

keyboard not hiding on country code select

Greetings,

I'm currently using the CountryPicker in our project, and it's generally functioning as expected. However, there's a specific scenario that requires attention. Here's how it plays out:

  1. Upon clicking the button, the CountryPicker opens, and the list of countries populates. I can select my preferred country code by clicking on an item from the list.
  2. After making a selection, the CountryPicker modal is dismissed or hidden.

The issue arises when I click on the input box to search for a country among the available options. When I click on an item in the list that appears after the search, there's an unexpected behavior. On the first click, the keyboard gets dismissed, and I need to click again to select the desired country. This means I have to click twice to make a country selection.

This behavior is somewhat cumbersome and could benefit from a smoother interaction. We appreciate your attention to this matter as it affects the usability of the CountryPicker component. Thank you for considering this feedback.

here is the code
`
const handlePickerPress = item => {
setCountryCode(item.dial_code);
setFlag(item.flag);
setShow(false);
Keyboard.dismiss();
if (onPress) {
onPress(item);
}
};
<TouchableOpacity
onPress={() => setShow(true)}
style={{
alignSelf: 'center',
}}>
<Text
style={{
color: '#1b1212',
fontSize: 14,
marginRight: 10,
marginLeft: 10,
}}>
{countryCode}

          <CountryPicker
            searchMessage={'Search here'}
            show={show}
            style={{
              // Styles for whole modal [View]
              modal: {
                height: 425,
                //backgroundColor: 'red',
              },
              // Styles for modal backdrop [View]
              backdrop: {
                backgroundColor: 'transparent',
              },

              textInput: {
                height: 45,
                //borderRadius: 20,
                color: '#1b1212',
              },
              countryName: {
                color: '#1b1212',
                fontFamily: 'Mont-Regular',
                lineHeight: 16,
                fontSize: 14,
              },
              dialCode: {
                color: '#1b1212',
                fontFamily: 'Mont-Regular',
                lineHeight: 16,
                fontSize: 14,
              },
              countryButtonStyles: {
                height: 50,
                //backgroundColor:'#f3f3f3'
              },
            }}
            pickerButtonOnPress={handlePickerPress}
            onRequestClose={() => {
              setShow(false);
            }}
     />

`

Unable to resolve module ./components/CountryPicker

After installing the library and opening the app i got this error on app startup
after checking the files i found that CountryPicker and CountryButton are in jsx format which is not supported, changing the formats to JS or TS fixes it
RN version: 0.68.1
simulator_screenshot_95828E37-FA5F-4C7E-961E-9F56A0F9262B
p

Issue with lint

Getting this error:
node_modules/react-native-country-codes-picker/index.tsx(16,33): error TS7016: Could not find a declaration file for module './helpers/useKeyboardStatus'. '/Users/../../node_modules/react-native-country-codes-picker/helpers/useKeyboardStatus.js' implicitly has an 'any' type.

Not sure how to fix it! Can anyone help with this?

Code for the example GIF

Firstly, this library is awesome.
I was wondering if you have the exact code for the example GIF you have in the README? I love the search feature and the collapsible context menu list, I'm struggling to replicate it :). (Currently my implementation takes the entire screen :( )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.