callstack / react-native-paper

Material Design for React Native (Android & iOS)
https://reactnativepaper.com
MIT License
12.96k stars 2.1k forks source link

No overload matches this call Issue with Most of the components - ReactNative + TypeScript #2528

Closed ImAbhishekTomar closed 3 years ago

ImAbhishekTomar commented 3 years ago

Most of the component showing "No overload matches this call." this error message, (Already Tryed #2482,#1971)

Packages (Using Yarn)

"react-native": "0.63.4", "react-native-paper": "^4.7.1", "@types/react-native": "^0.63.46"

Screenshot 2021-01-27 at 6 09 53 AM

Screenshot 2021-01-27 at 6 08 06 AM

 <Button
          color={colors.primary}
          labelStyle={{color: '#fff'}}
          compact={false}
          style={{marginBottom: 15, padding: 6, borderRadius: 50}}
          mode="contained"
          onPress={signIn}>
          CONTINUE
        </Button>

ERROR

No overload matches this call. Overload 1 of 2, '(props: Pick<Props, "ref" | "style" | "children" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | ... 57 more ... | "contentStyle"> & { ...; }, context?: any): ReactElement<...> | ... 1 more ... | null', gave the following error. Type '{ children: string; mode: "outlined"; onPress: () => void; }' is missing the following properties from type 'Pick<Props, "ref" | "style" | "children" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | ... 57 more ... | "contentStyle">': accessibilityComponentType, accessibilityTraits Overload 2 of 2, '(props: PropsWithChildren<Pick<Props, "ref" | "style" | "children" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | ... 57 more ... | "contentStyle"> & { ...; }>, context?: any): ReactElement<...> | ... 1 more ... | null', gave the following error. Type '{ children: string; mode: "outlined"; onPress: () => void; }' is missing the following pr

PACKAGE


{
  "name": "vgcMobile",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
    "clean:android": "cd android && gradlew clean && cd..",
    "clean:ios": "cd ios && xcodebuild clean && cd ..",
    "xcode": "xed -b ios",
    "pod-update": "cd ios pod update && cd ..",
    "pod-install": "cd ios && pod install  && cd ..",
    "doctor": "react-native doctor",
    "update": "react-native upgrade",
    "clean:npm": "yarn && cd ios && pod install && pod update && cd .."
  },
  "dependencies": {
    "@babel/plugin-proposal-decorators": "^7.12.12",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-navigation/drawer": "^5.12.3",
    "@react-navigation/material-bottom-tabs": "^5.3.13",
    "@react-navigation/material-top-tabs": "^5.3.13",
    "@react-navigation/native": "^5.9.2",
    "@react-navigation/stack": "^5.14.2",
    "babel-plugin-transform-decorators-legacy": "^1.3.5",
    "mobx": "^6.0.5",
    "mobx-react": "^7.0.6",
    "react": "16.13.1",
    "react-native": "0.63.4",
    "react-native-gesture-handler": "^1.9.0",
    "react-native-paper": "^4.7.1",
    "react-native-reanimated": "^1.13.2",
    "react-native-safe-area-context": "^3.1.9",
    "react-native-screens": "^2.17.1",
    "react-native-svg": "^12.1.0",
    "react-native-tab-view": "^2.15.2",
    "react-native-vector-icons": "^8.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.8.4",
    "@babel/runtime": "^7.8.4",
    "@react-native-community/eslint-config": "^1.1.0",
    "@types/color": "^3.0.1",
    "@types/jest": "^25.2.3",
    "@types/react-native": "^0.63.46",
    "@types/react-native-text-input-mask": "^0.7.5",
    "@types/react-test-renderer": "^16.9.2",
    "babel-jest": "^25.1.0",
    "eslint": "^6.5.1",
    "jest": "^25.1.0",
    "metro-react-native-babel-preset": "^0.59.0",
    "react-test-renderer": "16.13.1",
    "typescript": "^3.8.3"
  },
  "jest": {
    "preset": "react-native",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ]
  }
}
github-actions[bot] commented 3 years ago

Couldn't find version numbers for the following packages in the issue:

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

crofoot commented 3 years ago

Try downgrading types for react native to npm i @types/react-native@0.62.2

ImAbhishekTomar commented 3 years ago

It's fixed after downgrade types..

github-actions[bot] commented 3 years ago

Hello 👋, this issue has been open for more than 2 months with no activity on it. If the issue is still present in the latest version, please leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution on workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix the issue.

nonameolsson commented 3 years ago

Is there a working version with a fix for this somewhere? Downgrading to an earlier version feels like a temporarily solution. And I actually haven't been able to get it to work with @types/react-native@0.62.2.

I still get this error image

aprilmintacpineda commented 3 years ago

I'm still getting this error now:

No overload matches this call.
  Overload 1 of 2, '(props: Pick<Props, "ref" | "children" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | ... 55 more ... | "contentStyle"> & { ...; }, context?: any): ReactElement<...> | ... 1 more ... | null', gave the following error.
    Type '(ev: any) => void' is not assignable to type '() => void'.
  Overload 2 of 2, '(props: PropsWithChildren<Pick<Props, "ref" | "children" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | "nativeID" | "collapsable" | "needsOffscreenAlphaCompositing" | ... 55 more ... | "contentStyle"> & { ...; }>, context?: any): ReactElement<...> | ... 1 more ... | null', gave the following error.
    Type '(ev: any) => void' is not assignable to type '() => void'.ts(2769)
Button.d.ts(52, 5): The expected type comes from property 'onPress' which is declared here on type 'IntrinsicAttributes & Pick<Props, "ref" | "children" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | ... 58 more ... | "contentStyle"> & { ...; }'
Button.d.ts(52, 5): The expected type comes from property 'onPress' which is declared here on type 'IntrinsicAttributes & Pick<Props, "ref" | "children" | "hitSlop" | "onLayout" | "pointerEvents" | "removeClippedSubviews" | "style" | "testID" | ... 58 more ... | "contentStyle"> & { ...; } & { ...; }'
(JSX attribute) onPress?: (() => void) | undefined
Function to execute on press.
<RNPButton
      onPress={() => {
          console.log('pressed');
      }}
      {...otherProps}
/>
RichardLindhout commented 3 years ago

I have the same error in react-native-paper-dates now..

fermmm commented 3 years ago

same problem here, downgrading to @types/react-native@0.62.2 didn't work for me

dante-provar commented 2 years ago

Somethings you could jus be missing required props from a component .i.e Button Component requires a "title" prop as well as "onPress". Just use the ctrl+space bar to check missing props

Petes0n commented 6 months ago

Getting a similar error with apexCharts No overload matches this call. Overload 1 of 2, '(props: Props | Readonly): ReactApexChart', gave the following error. Type '{ chart: { height: number; type: string; zoom: { enabled: boolean; }; }; dataLabels: { enabled: boolean; }; stroke: { width: number[]; curve: string; dashArray: boolean; }; title: { text: string; align: string; }; ... 4 more ...; grid: { ...; }; }' is not assignable to type 'ApexOptions'.

NICOLA-200 commented 3 months ago

. It seems the issue persists. Could we explore alternative solutions that do not involve downgrading? Screenshot 2024-07-23 204915