fateh999 / react-native-paper-dropdown

Dropdown using react native paper TextInput and Menu
121 stars 72 forks source link

invalid Type imports from `react-native-paper` #97

Open lucksp opened 11 months ago

lucksp commented 11 months ago

We are getting tsc errors in the library, even though we're not supposed to check for node_modules:

node_modules/react-native-paper/src/components/Icon.tsx:96:8 - error TS2769: No overload matches this call.
  Overload 1 of 2, '(props: ImageProps | Readonly<ImageProps>): Image', gave the following error.
    Type '{ accessibilityIgnoresInvertColors: true; role: string; focusable: boolean; accessibilityElementsHidden?: undefined; importantForAccessibility?: undefined; source: any; style: ({ transform: { ...; }[]; } | { ...; })[]; allowFontScaling?: boolean | undefined; } | { ...; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Image> & Readonly<ImageProps>'.
      Type '{ accessibilityIgnoresInvertColors: true; role: string; focusable: boolean; accessibilityElementsHidden?: undefined; importantForAccessibility?: undefined; source: any; style: ({ transform: { ...; }[]; } | { ...; })[]; allowFontScaling?: boolean | undefined; }' is not assignable to type 'Readonly<ImageProps>'.
        Types of property 'role' are incompatible.
          Type 'string' is not assignable to type 'Role | undefined'.
  Overload 2 of 2, '(props: ImageProps, context: any): Image', gave the following error.
    Type '{ accessibilityIgnoresInvertColors: true; role: string; focusable: boolean; accessibilityElementsHidden?: undefined; importantForAccessibility?: undefined; source: any; style: ({ transform: { ...; }[]; } | { ...; })[]; allowFontScaling?: boolean | undefined; } | { ...; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Image> & Readonly<ImageProps>'.
      Type '{ accessibilityIgnoresInvertColors: true; role: string; focusable: boolean; accessibilityElementsHidden?: undefined; importantForAccessibility?: undefined; source: any; style: ({ transform: { ...; }[]; } | { ...; })[]; allowFontScaling?: boolean | undefined; }' is not assignable to type 'Readonly<ImageProps>'.
        Types of property 'role' are incompatible.
          Type 'string' is not assignable to type 'Role | undefined'.

96       <Image
          ~~~~~

node_modules/react-native-paper/src/components/TextInput/Adornment/TextInputAdornment.tsx:9:32 - error TS2307: Cannot find module 'src/types' or its corresponding type declarations.

9 import type { ThemeProp } from 'src/types';
                                 ~~~~~~~~~~~

node_modules/react-native-paper/src/components/TextInput/TextInputFlat.tsx:14:32 - error TS2307: Cannot find module 'src/types' or its corresponding type declarations.

14 import type { ThemeProp } from 'src/types';
                                  ~~~~~~~~~~~

If I reference the errors within react-native-paper-dropdown, the following Dropdown.d.ts file shows errors related to:

import { Theme } from "react-native-paper/lib/typescript/types";
import { TextInputProps } from "react-native-paper/lib/typescript/components/TextInput/TextInput";

As you can see in react-native-paper npm package, the lib directory does not match with actual:

image

The TextInputProps should be:

import { TextInputProps } from "react-native-paper";

There is no Theme in the react-native-paper anymore