jemise111 / react-native-swipe-list-view

A React Native ListView component with rows that swipe open and closed
https://www.npmjs.com/package/react-native-swipe-list-view
MIT License
2.78k stars 528 forks source link

No overload matches this call #614

Open tsachit opened 1 year ago

tsachit commented 1 year ago

Could be something like this

Describe the bug When I try to use swipe row i get typescript error, it works but the typescript error is annoying and it keeps failing compiling typescript. It seems like SwipeRow does not allow children. When i don't send any children and use just the close it without any children it doesn't give any typescript error. image

To Reproduce Steps to reproduce the behavior: Just use like in the example https://github.com/jemise111/react-native-swipe-list-view/blob/master/docs/SwipeRow.md

Screenshots image

Environment (please complete the following information):

vickycabrera commented 1 year ago

Same error here!

D4RKBR4IN commented 1 year ago

Hi i have the same error, both android and IOS "react-native-swipe-list-view": "^3.2.9", "react-native": "0.70.6",

Because typescript needs everything declared... Apparently children definition is missing on SwipeRow as one of the props.

any development on this problem predicted any time soon ?

carlvelasco96 commented 1 year ago

I also need a fix for this issue! Just waiting for an update on this thread about a potential fix.

lgibso34 commented 1 year ago

While we wait...

Either // @ts-expect-error it or create a <something>.d.ts file and add this to it.

import {ReactNode} from 'react'

declare module 'react-native-swipe-list-view' {
  interface IPropsSwipeRow<T> {
    children: ReactNode
  }
}
BuhorDenysDEV commented 1 year ago

also have this problem. Has something been done to fix it?

this way didn't help me(

helferleinsoftware commented 9 months ago

improving on @lgibso34 s suggestion, I explicitly declared that the <SwipeRow> needs two children

// src/custom-types.d.ts
import { IPropsSwipeRow } from 'react-native-swipe-list-view';

declare module 'react-native-swipe-list-view' {
  interface IPropsSwipeRow extends IPropsSwipeRow {
    children: [unknown, unknown];
  }
}
vasylnahuliak commented 4 months ago

React has a type helper for working with the children


import { IPropsSwipeRow } from 'react-native-swipe-list-view';

declare module 'react-native-swipe-list-view' {
  interface IPropsSwipeRow extends React.PropsWithChildren {}
}