react-native-reanimated: export 'default'.'Value' (imported as 'Animated') was not found in 'react-native-reanimated' - 2.10.x
Description
Found when upgrading a react native web project’s reanimated dep from 2.2.x -> 3.0.0-rc.3
ERROR in ./node_modules/@react-navigation/drawer/lib/module/views/legacy/Drawer.js 84:25-39
export 'default'.'Value' (imported as 'Animated') was not found in 'react-native-reanimated' (possible exports: FlatList, Image, ScrollView, Text, View, addWhitelistedNativeProps, addWhitelistedUIProps, createAnimatedComponent
Steps to reproduce
- upgrade reanimated from 2.2.x -> 3.0.x
- use react-navigation with all of the latest versions (drawer v6.5.0)
Snack or a link to a repository
N/A
Reanimated version
2.10.x & up
React Native version
react native web 0.18.9
Platforms
Web
JavaScript runtime
No response
Workflow
No response
Architecture
No response
Build type
No response
Device
No response
Device model
No response
Acknowledgements
Yes
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 5
- Comments: 50 (7 by maintainers)
It was happened between 2.9.x and 2.10.0 when index files in package was splits into: index.js and index.web.js
I’m using expo 47, react-native 70 and react-native-reanimated 2.12.0 and here are steps to fix this issue:
I have the same problem, im using “react-native-reanimated”: “~2.14.4”,
`WARNING in ./node_modules/@react-navigation/drawer/lib/module/views/legacy/Overlay.js:11:4 export ‘default’.‘interpolate’ (imported as ‘Animated’) was not found in ‘react-native-reanimated’ (possible exports: Clock, Code, EasingNode, Extrapolate, FlatList, Image, Node, ScrollView, SpringUtils, Text, Transition, Transitioning, Value, View, abs, acc, acos, adapt, add, addWhitelistedNativeProps, addWhitelistedUIProps, always, and, asin, atan, block, call, ceil, clockRunning, color, concat, cond, cos, createAnimatedComponent, createTransitioningComponent, debug, decay, defined, diff, diffClamp, divide, eq, event, exp, floor, greaterOrEq, greaterThan, interpolateColors, interpolateNode, lessOrEq, lessThan, log, max, min, modulo, multiply, neq, not, onChange, or, pow, proc, round, set, sin, spring, sqrt, startClock, stopClock, sub, tan, timing, useCode, useValue) 9 | cond, 10 | greaterThan,
33 warnings what a pain this package is.
This is wonderful even though I was like how do I go about implementing this workaround as the above suggestion was not very clear to me but here is what I did for people like me:
Having the same problem on Expo SDK 49 with
react-native-reanimated
3.3.0, where our web compiles with 33 warnings.My workaround using
patch-package
:WARNING in ./node_modules/@react-navigation/drawer/lib/module/views/legacy/Overlay.js:11:4 export ‘default’.‘greaterThan’ (imported as ‘Animated’) was not found in ‘react-native-reanimated’ (possible exports: FlatList, Image, ScrollView, Text, View, addWhitelistedNativeProps, addWhitelistedUIProps, createAnimatedComponent) 9 | cond, 10 | greaterThan,
web compiled with 33 warnings
Any solution ???
I’ve tried the suggestion of
export * from './Animated';
which allows the babel loader to succeed, but obviously changes the shape of the export. If you’re using react-navigation withuseLegacyImplementation
, it will throw an error because it no longer passes the check it does to make sure you’re using reanimated 2.This works though
Thanks I was able to solve this
We are currently seeing this error with 3.x. Tried the above solution of adding
@babel/plugin-proposal-export-namespace-from
to babel.config.js with no success.The only thing it’s complaining about is when importing:
but not when doing:
package.json:
info
Still reproducing for me on
2.14.4
with Expo48.0.6
and React Native Web0.18.12
.We’re seeing this in version 2.10.x
@hsavit1 , I just fix it 😝
The theory in your
export 'default'.'Value' (imported as 'Animated')
is same with mine, so the solution should be the same.Theory
My APP ReactWebNative8Koa just got
ERROR in ./node_modules/react-native-tab-view/lib/module/TabBarIndicator.js 25:48-68 export 'default'.'interpolate' (imported as 'Animated') was not found in 'react-native-reanimated'
in react-native-web with bundler Webpack 5, but good in react-native with bundler Metro.The related code in
TabBarIndicator.js
isand the code seems no problem if
Animated.interpolate
isundefined
, right?Then I thought Webpack 5 maybe is too strict than Metro with such
undefined
.strict
?With keyword
strict
, I found https://github.com/facebook/create-react-app/blob/v5.0.0/packages/react-scripts/config/webpack.config.js#L348 asAnd patched it in
node_modules/react-scripts/config/webpack.config.js
toNow
ERROR
becomeWARNING
, everything is good.Solution
Finally I refactor it, not patch in
node_modules/react-scripts/config/webpack.config.js
, but just addin
YOUR_APP/config-overrides.js
, ref to the commit of APP ReactWebNative8Koa RN 0.63.2 -> 0.70.5: let Web Worker with Support for CRA v5 (and Webpack 5)PS: installation of react-native-web with
react-app-rewired
andconfig-overrides.js
can ref to my blog https://github.com/flyskywhy/g/blob/master/i主观的体验方式/t快乐的体验/电信/Tool/编程语言/JavaScript/React使用详解.md#upgrade-to-react-scripts5-and-add-web-workers-support@fukemy In Reanimated 3 we removed Reanimated API v1. If you want to still use Reanimated v1 API, you need to stay with the 2.x version. But I highly recommended using 3.x version.
still broken when I tried with 3.0.rc5
@hsavit1 Just tried 2.12. Still no different. Doesn’t work with
react-native-web
.@hsavit1 That is the
node_modules/react-native-reanimated/lib/index.web.js
file that I patched