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

type error HoldItem onpress prop #65

Closed
dancixx opened this issue Apr 14, 2022 · 5 comments
Closed

type error HoldItem onpress prop #65

dancixx opened this issue Apr 14, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@dancixx
Copy link

dancixx commented Apr 14, 2022

There is a type error If I use the actionParams with multiple args.

Type '(status: string, id: string) => void' is not assignable to type '(arg?: string | number | undefined) => void'.

The original type of onPress?: (arg?: string | number) => void;
Maybe this can be a solution for it: onPress?: (...args: (string | number)[]) => void;

@dancixx dancixx added the bug Something isn't working label Apr 14, 2022
@enesozturk
Copy link
Owner

Hi @dancixx, thanks for pointing out that! Also, it can be any other type but string or number. I updated in #9fbde8!

@dancixx
Copy link
Author

dancixx commented Apr 16, 2022

Thanks for fast reaction, but I think the any type can cause a worklet error. I looked a bit deeper into the source code and I saw you use reanimated worklet feature. When I passed a nested object as a param I got worklet error. I will check it again in next days and write the result.

@enesozturk
Copy link
Owner

Oh, good catch. Not a fan of any but didn't now that issue. Would be very happy!

@dancixx
Copy link
Author

dancixx commented Apr 17, 2022

Ok, I have checked it. So the problem is coming when I try to pass a redux element and it is a frozen object because of that need a deep copy.
Here talk about this problem: software-mansion/react-native-reanimated#1517 (comment)
Maybe you can write a little note in the docs because the redux-toolkit is a must-have package in RN projects the it is use immer under the hood which creates a frozen object.

@dancixx
Copy link
Author

dancixx commented Apr 17, 2022

@enesozturk other thing, I can see the type update in the src/comp.../types.d.ts but in the lib folder the type is the original, do you have any idea, why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants