react-native-reanimated: Cannot read property 'makeMutable' of undefined

Description

When I call useSharedValue(0) the app crashes with the following message.

Cannot read property 'makeMutable' of undefined

Steps to reproduce

  1. Run your app in development
  2. Create a shared value with useSharedValue(0)

Snack or a link to a repository

Private Repo

Reanimated version

3.6.1

React Native version

0.73.1

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native

Architecture

Fabric (New Architecture)

Build type

Debug app & dev bundle

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 25 (2 by maintainers)

Most upvoted comments

I have same problem

For others looking to resolve - this is what your babel.config.js should look like if using useSharedValue / reanimated

module.exports = { presets: [‘module:@react-native/babel-preset’], plugins: [ /// This Plugin should be last ‘react-native-reanimated/plugin’, ], };

Hi @Latropos sorry for the delayed response, a colleague of mine was able to find the problem, there’s was a slight mistake when I was adding the plugin in the babel file due to nesting from another plugin, it was resolved by properly adding the plugin in the babel file. I’ll go ahead and close this because that was the solution to the problem. Thanks for following up.

I solved this problem.(我解决了这个问题)

react-native-reanimated-carousel 版本:3.5.1

这个问题是因为两个依赖库版本的问题,我从 react-native-reanimated-carousel 的 package.json 中发现依赖库版本并不是最新版本,所以用下面命令重新安装了这两个库。 yarn add react-native-reanimated@~3.3.0 react-native-gesture-handler@~2.12.0

安装完又按照下面文档进行了配置 https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/

然后重启app错误就没有了。


Translate into English with translation software.

This problem is due to the problem of two dependent library versions. I found that the dependent library version is not the latest version from the react-native-reanimated-carousel package.json, so I reinstalled the two libraries with the following command. yarn add react-native-reanimated @~3.3.0 react-native-gesture-handler @~2.12.0

After installation, it was configured according to the following documents https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/

Then restart the app and the error is gone.

Step 1: check suggest reanimated-version https://docs.swmansion.com/react-native-reanimated/docs/guides/compatibility/ with your react-native version

Step 2: if you use react-native-reanimated version > 2 add " [ ‘react-native-reanimated/plugin’, { relativeSourceLocation: true, }, ]" in plugins bable.config.js

Step 3: run comand with reset-cache

It work for me

For me it got fixed by npm start --reset-cache , mine was "dependencies": { "@react-native-community/netinfo": "^11.4.1", "@react-navigation/bottom-tabs": "^7.2.0", "@react-navigation/native": "^7.0.14", "@react-navigation/native-stack": "^7.2.0", "moment": "^2.30.1", "react": "18.3.1", "react-native": "0.77.0", "react-native-gesture-handler": "^2.22.1", "react-native-reanimated": "^3.16.7", "react-native-reanimated-carousel": "^3.5.1", "react-native-safe-area-context": "^5.1.0", "react-native-screens": "^4.5.0" },

i’ve faced the same issue i put plugin at last ex :- module.exports = { presets: [‘module:@react-native/babel-preset’], plugins: [‘nativewind/babel’, [ ‘module-resolver’, { root: [‘.’], extensions: [‘.ios.js’, ‘.android.js’, ‘.js’, ‘.ts’, ‘.tsx’, ‘.json’], alias: { ‘@screens’: ‘./screens’, ‘@public’: ‘./public’, }, }, ], ‘react-native-reanimated/plugin’, ], };

and then after i run a comman npm start – --reset-cache and its works

I’m having the same issue.

For me it got fixed by installing NativeWind v4 followed by npm start --reset-cache .

am getting the same issue in latest react native version.Have anyone reproduce the issue.

Now it solved by using “react-native-reanimated”: “^3.12.0”, and add (plugins: [‘react-native-reanimated/plugin’] on bable.config.js. Dont know the logic behind it but first run the ios and keep it on and then run the android. In my case it is working.

Since we haven’t received any reproduction for this issue, I will close this issue. Feel free to ping me if you have a reproduction, preferably as a github repository. Only then will I reopen this issue.

module.exports = { presets: [‘module:@react-native/babel-preset’], plugins: [ /// This Plugin should be last ‘react-native-reanimated/plugin’, ], };

this solved the problem for me as well, adding ‘react-native-reanimated/plugin’, to babel file. on the previous RN version it wasn’t required.