Open tsachit opened 1 year ago
Same error here!
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 {}
}
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](https://user-images.githubusercontent.com/15964048/213194920-899daf04-fb5c-4e7e-9e34-ccce0988d569.png)
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](https://user-images.githubusercontent.com/15964048/213193547-2f634fc1-3f67-4db1-9908-731f30940c48.png)
Environment (please complete the following information):