useSharedValue is not a function
See original GitHub issueDescription
Followed the steps to install alpha 8, then proceeded to setup my view, however none of the react-native-reanimated 2 hooks are available?
Looking at the default Animated object and I can’t see the hooks there either.
And looking node_modules/react-native-reanimated/src/reanimated2 has Hooks.js
which has the correct hooks.
babel.config.js looks like:
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: ['react-native-reanimated/plugin'],
env: {
production: {
plugins: ['react-native-paper/babel'],
},
},
}
Screenshots
Steps To Reproduce
- Try using any of the new hooks via import
Expected behavior
Hook is available
Actual behavior
Hook isn’t found
Snack or minimal code example
import React from 'react'
import Animated, { useSharedValue } from 'react-native-reanimated'
export const Screen = ({ route, navigation }) => {
const height = useSharedValue(0)
return null
}
Package versions
- React: 16.14.0
- React Native: 0.63.3
- React Native Reanimated: 2.0.0-alpha.8
- NodeJS: v12.14.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
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 >Reanimated - Expo Documentation
Reanimated uses React Native APIs that are incompatible with "Remote JS Debugging" for JavaScriptCore. In order to use a debugger with your app...
Read more >React Native Reanimated - Nabeel Valley
module.exports = function (api) { api.cache(true); return { presets: ... Can be created using the useSharedValue hook, similar to Animated.value but can ...
Read more >An Introduction to React Native Reanimated 2 - Amimetic
This takes a function which defines (animated) styles. ... Text, View } from "react-native" import Animated, { useSharedValue, useAnimatedStyle, withSpring, } ...
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
@shockdesign, the react-native bundler. To get rid of its cache fire it up with
react-native start --clear-cache
.@canberkardic do you use npm by any chance? We saw similar reports in the past. Try using yarn and if you can, please provide a reproducible repository – that will greatly help us resolve this error.