Skip to content

Typescript errors occurring #124

Description

@saodatJustdice

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-country-codes-picker@2.3.5 for the project I'm working on.

Please add typescript types

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-country-codes-picker/components/CountryButton.tsx b/node_modules/react-native-country-codes-picker/components/CountryButton.tsx
index fd26e46..20f0c80 100644
--- a/node_modules/react-native-country-codes-picker/components/CountryButton.tsx
+++ b/node_modules/react-native-country-codes-picker/components/CountryButton.tsx
@@ -1,6 +1,6 @@
 import React from 'react';
-import { Text, TouchableOpacity, ViewStyle } from "react-native";
-import { ItemTemplateProps } from "../types/Types";
+import { Text, TouchableOpacity, type ViewStyle } from "react-native";
+import { type ItemTemplateProps } from "../types/Types";
 
 
 export const CountryButton = ({ item, name, style, ...rest }: ItemTemplateProps) => (
diff --git a/node_modules/react-native-country-codes-picker/constants/countryCodes.ts b/node_modules/react-native-country-codes-picker/constants/countryCodes.ts
index d60d6ec..75dda87 100644
--- a/node_modules/react-native-country-codes-picker/constants/countryCodes.ts
+++ b/node_modules/react-native-country-codes-picker/constants/countryCodes.ts
@@ -1,4 +1,4 @@
-import {CountryItem} from "../types/Types";
+import {type CountryItem} from "../types/Types";
 
 export const countryCodes: CountryItem[] = [
     {
diff --git a/node_modules/react-native-country-codes-picker/helpers/countriesRemover.ts b/node_modules/react-native-country-codes-picker/helpers/countriesRemover.ts
index 08810e1..3fbdd96 100644
--- a/node_modules/react-native-country-codes-picker/helpers/countriesRemover.ts
+++ b/node_modules/react-native-country-codes-picker/helpers/countriesRemover.ts
@@ -1,5 +1,5 @@
 import {countryCodes} from "../constants/countryCodes";
-import {CountryItem} from "../types/Types";
+import {type CountryItem} from "../types/Types";
 
 export const countriesRemover = (excludedCountries: string[]|undefined): CountryItem[] => {
     return countryCodes?.filter(country => {
diff --git a/node_modules/react-native-country-codes-picker/helpers/useKeyboardStatus.ts b/node_modules/react-native-country-codes-picker/helpers/useKeyboardStatus.ts
index 70b7be6..fda5ac7 100644
--- a/node_modules/react-native-country-codes-picker/helpers/useKeyboardStatus.ts
+++ b/node_modules/react-native-country-codes-picker/helpers/useKeyboardStatus.ts
@@ -1,5 +1,5 @@
 import React, {useEffect, useRef, useState} from "react";
-import {EmitterSubscription, Keyboard, Platform} from "react-native";
+import {type EmitterSubscription, Keyboard, Platform} from "react-native";
 
 /*
 * This func. listen the keyboard and
diff --git a/node_modules/react-native-country-codes-picker/index.tsx b/node_modules/react-native-country-codes-picker/index.tsx
index 6464ae1..b8d6769 100644
--- a/node_modules/react-native-country-codes-picker/index.tsx
+++ b/node_modules/react-native-country-codes-picker/index.tsx
@@ -9,11 +9,11 @@ import {
     Easing,
     Platform,
     Keyboard,
-    ViewStyle,
+    type ViewStyle,
     Modal,
-    TextStyle
+    type TextStyle
 } from 'react-native';
-import { CountryItem, ItemTemplateProps, Style, ListHeaderComponentProps } from "./types/Types";
+import type { CountryItem, ItemTemplateProps, Style, ListHeaderComponentProps } from "./types/Types";
 import { useKeyboardStatus } from "./helpers/useKeyboardStatus";
 import { CountryButton } from "./components/CountryButton";
 import { countriesRemover } from "./helpers/countriesRemover";
@@ -163,6 +163,7 @@ export const CountryPicker = ({
             ) {
                 return country;
             }
+            return false;
         });
     }, [searchValue]);
 
@@ -389,6 +390,7 @@ export const CountryList = ({
             ) {
                 return country;
             }
+            return false;
         });
     }, [searchValue]);
 
diff --git a/node_modules/react-native-country-codes-picker/types/Types.ts b/node_modules/react-native-country-codes-picker/types/Types.ts
index e49cb83..43bd5e1 100644
--- a/node_modules/react-native-country-codes-picker/types/Types.ts
+++ b/node_modules/react-native-country-codes-picker/types/Types.ts
@@ -1,4 +1,4 @@
-import {ViewStyle, TextStyle} from "react-native";
+import type {ViewStyle, TextStyle} from "react-native";
 
 export interface ItemTemplateProps {
     item: CountryItem,

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions