Skip to content

Conversation

@SteveYuOWO
Copy link

Fix error of #111 .
In the expo project, a strict type error occurs.

searchBar needs to be strictly defined as TextStyle, and the rest of keys need to be defined as ViewStyle.

✖ tsc --project tsconfig.json --alwaysStrict:
node_modules/react-native-country-codes-picker/index.tsx(271,37): error TS2769: No overload matches this call.
  Overload 1 of 2, '(props: TextInputProps): TextInput', gave the following error.
    Type 'ViewStyle' is not assignable to type 'Falsy | TextStyle | RegisteredStyle<TextStyle> | RecursiveArray<Falsy | TextStyle | RegisteredStyle<TextStyle>> | readonly (Falsy | ... 1 more ... | RegisteredStyle<...>)[]'.
      Type 'ViewStyle' is not assignable to type 'TextStyle'.
        Types of property 'userSelect' are incompatible.
          Type 'string | undefined' is not assignable to type '"text" | "auto" | "none" | "contain" | "all" | undefined'.
            Type 'string' is not assignable to type '"text" | "auto" | "none" | "contain" | "all" | undefined'.
  Overload 2 of 2, '(props: TextInputProps, context: any): TextInput', gave the following error.
    Type 'ViewStyle' is not assignable to type 'Falsy | TextStyle | RegisteredStyle<TextStyle> | RecursiveArray<Falsy | TextStyle | RegisteredStyle<TextStyle>> | readonly (Falsy | ... 1 more ... | RegisteredStyle<...>)[]'.
      Type 'ViewStyle' is not assignable to type 'TextStyle'.
        Types of property 'userSelect' are incompatible.
          Type 'string | undefined' is not assignable to type '"text" | "auto" | "none" | "contain" | "all" | undefined'.
            Type 'string' is not assignable to type '"text" | "auto" | "none" | "contain" | "all" | undefined'.
image

@SteveYuOWO SteveYuOWO changed the title fix: separated viewStyle and textStyle keys Separated viewStyle and textStyle keys Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant