useSharedValue hook throws errror
See original GitHub issueDescription
useSharedValue hook throws “Object.values requires that input parameter not be null or undefined”
Screenshots
Snack or minimal code example
const offset = useSharedValue(1);
Package version
- React: 16.13.1
- React Native: 0.62.2
- React Native Reanimated: 2.0.0-alpha.5
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
why useSharedValue can use in here? · Issue #1512 - GitHub
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. The text was updated successfully, ...
Read more >Testing error: useSharedValue is not a function while testing
I'm using react-native-reanimated and when I'm testing, useSharedValue throws an error that it's not a function when using jest and ...
Read more >useSharedValue | React Native Reanimated - Software Mansion
Use this hook to create a reference to a JavaScript value that can be shared with worklets. Shared Values serve a similar purpose...
Read more >How to fix React Error: Rendered fewer hooks than expected
First, double check that you're not calling hooks within a conditional statement. The Hooks documentation makes clear that we are to use hooks ......
Read more >react-native-reanimated useSharedValue TypeScript Examples
useState(0); const currentX = useSharedValue(-1); const currentY ... if (typeof source === 'undefined') { throw new Error( 'ImageTransformer: either source ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Firstly, try cleaning project with:
watchman watch-del-all
If that doesn’t help try deleting xcode build artifacts & node_modules
If none of that will work please post the entire function (with dependencies, so if you’re using any variable, include it as well in the snippet) or better, create sample code on which you can repro this.
Closing for now.
Upgrading node version fixed the issue for me. Ref: https://github.com/software-mansion/react-native-reanimated/issues/1244#issuecomment-694468084