Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwipeProvider unusable with Typescript #31

Open
kris1803 opened this issue Oct 21, 2022 · 1 comment
Open

SwipeProvider unusable with Typescript #31

kris1803 opened this issue Oct 21, 2022 · 1 comment

Comments

@kris1803
Copy link

SwipeProvider breaks on type checking, all the component becomes red and types are not compatible.
Error message is below ( copied from VS code ).
Temporary fix is putting /* @ts-ignore */ above the component

No overload matches this call.
Overload 1 of 2, '(props: SwipeProviderProps | Readonly): SwipeProvider', gave the following error.
Type '{ children: Element[]; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly'.
Overload 2 of 2, '(props: SwipeProviderProps, context: any): SwipeProvider', gave the following error.
Type '{ children: Element[]; }' has no properties in common with type 'IntrinsicAttributes & IntrinsicClassAttributes & Readonly'.ts(2769)

@faisolp
Copy link

faisolp commented Feb 28, 2023

it same my error
I have to fix
./node_modules/react-native-swipe-item/index.d.tsx
to add some code

declare module 'react-native-swipe-item' {
..
interface SwipeProviderProps {
/**
* Swipe items mode, default is single
*/

    mode?: 'single' | 'multiple';
    /**
     * The trigger for automatically closed swipe item , default is onItemMoved
     * `onItemMoved` - when the swipe item is moved, the opened one will be closed.
     * `onButtonShowed` - when the swipe item button is showing, the opened one will be closed.
     */
    closeTrigger?: 'onItemMoved' | 'onButtonShowed';
    children: Element;   //add code fix error
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants