jemise111/react-native-swipe-list-view

No overload matches this call

tsachit opened this issue ยท 7 comments

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):

  • OS: iOS
  • RNSLV Version: ^3.2.9
  • RN Version: 0.68.5

Same error here!

  • OS: Android
  • RNSLV Version: ^3.2.9
  • RN Version: 0.70.5

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 ?

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

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
  }
}

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

this way didn't help me(

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];
  }
}

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 {}
}