Comments (14)
@DanielKuhn I looked into your package.json and yarn.lock, created new RN App using 0.73.6, copied your package.json and yarn.lock there, removed all irrelevant dependencies and everything worked fine.
From what I see react-native-svg-transfomer
adds a bunch of babel plugins, however I don't know if you are actually using them - could it possible be the culprit?
Unfortunately, since there seems to be no problems with brand new apps it seems that the issue is somewhere on your side. There are some additional steps I would suggest here:
- Create a brand new React Native App
npx react-native init App --version 0.73.6
, add Reanimated, use it and see if the problem persists - if it does, then there's something wrong with your machine configuration. - Clear your yarn cache in case you have overrode some packages -
yarn cache clean
. - You can actually use generated js files instead of source typescript files. All you need is the following change in your
metro.config.js
:
diff --git a/metro.config.js b/metro.config.js
index ad8f87b..feaf6fb 100644
--- a/metro.config.js
+++ b/metro.config.js
@@ -6,6 +6,10 @@ const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
*
* @type {import('metro-config').MetroConfig}
*/
-const config = {};
+const config = {
+ resolver: {
+ resolverMainFields: ['main', 'react-native'],
+ },
+};
module.exports = mergeConfig(getDefaultConfig(__dirname), config);
from react-native-reanimated.
I for my part forked react-native-reanimated
at version 3.8.1 and simply pointed "react-native" to "lib/module/index" in package.json
in the fork.
I found changing resolverMainFields
globally in my app too risky because I don't know which side-effects this might have in other packages and the typescript compilation mentioned here is only a problem in react-native-reanimated
.
from react-native-reanimated.
Hey! 👋
The issue doesn't seem to contain a minimal reproduction.
Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?
from react-native-reanimated.
The solution outlined in this comment is outdated and does not help.
from react-native-reanimated.
Hi @DanielKuhn, thanks for reporting this issue.
Could you please provide a repro so we can investigate this problem?
It would also be helpful if you could share your JS bundle so we can see what's wrong in line 232124 and column 78.
from react-native-reanimated.
Hi @tomekzaw ,
please find JS bundle attached. I upgraded to the latest version (RNReanimated 3.8.1) so now the error occurs in line 231833:78
from react-native-reanimated.
@DanielKuhn Thanks for providing more details. The faulty line is:
}(_react.default.Component<AnimatedComponentProps<InitialComponentProps>>);
For some reason, there's still some TypeScript syntax in the JS bundle (which should be JavaScript code).
Can you please try re-generating your yarn.lock
(i.e. removing it and installing the dependencies again, possibly with newer versions)?
If that doesn't help, can you try upgrading TypeScript in your project?
from react-native-reanimated.
This seems like outdated @babel/preset-typescript
potentially. Try to upgrade it (regenerating yarn.lock should do the trick).
from react-native-reanimated.
Hi @tomekzaw and @tjzel your help is very much appreciated.
So far I've...
- rebuilt the bundle (
rm yarn.lock && rm -rf node_modules && yarn cache clean && yarn install
) - updated
@babel/preset-typescript
to 7.24.1 - updated typescript to 5.4.2
...but nothing seems to work.
I've had this problem ever since trying to upgrade react-native-reanimated
to version 3.4.0 (just like this guy) - and I've tried all major versions up until 3.8.1 by now, in various versions of React Native - somehow there's always some TypeScript syntax which ends up in my bundle.js
. That's why I postponed the update every time when upgrading the rest of the packages. But now I need to upgrade React Native to 0.73, therefore this time I need to get at least react-native-reanimated
3.6 to work.
The hint by @tomekzaw was correct so now I just need to figure out which setting or dependency causes the TypeScript syntax ending up in bundle.js
If anyone has an idea where or who the culprit may be - or what changed concerning TypeScript transpilation between Version 3.3.0 and 3.4.0 - please let me know.
Please find my config files attached:
package.json
yarn.lock
tsconfig.json
babel.config.js
from react-native-reanimated.
It works!
Awesome, thanks a ton you guys for explaining the problem and providing a working solution.
@tjzel : Could you elaborate a little bit about what the resolver instruction resolverMainFields: ['main', 'react-native']
does? I'd like to fully understand the matter to evaluate potential side-effects before merging this in production.
from react-native-reanimated.
Ah, I found the documentation - so I guess resolverMainFields: ['main', 'react-native']
switches the lookup order from the default ['react-native', 'browser', 'main']
to instead search in main
first. But then the question is: Why does react-native-reanimated
specify "react-native": "src/index"
instead of pointing react-native to "lib/module/index"
like main
does?
from react-native-reanimated.
It's the standard for React Native to take the code from the source for bundling, all libraries point react-native
target to source code. I don't know why however, I admit I have never exactly looked into it.
from react-native-reanimated.
Neither have I. I also think that it shouldn't be required for react-native dev's to know all the ins and outs of package development. It looks to me like this is a standard config convention when creating a package using react-native-builder-bob
.
Anyways, I opened a pull request proposing the change. Maybe someone with more insights will comment on the matter. For now I'm using a fork with the change in package.json
from react-native-reanimated.
Any update on this? Changing resolverMainFields
causes us issues with other dependencies (specifically this)
from react-native-reanimated.
Related Issues (20)
- 1st item in an inverted list is no longer animated after a while with itemLayoutAnimation HOT 1
- expo 51.0.7 CRASH [TypeError: animatedRef.getTag is not a function (it is undefined)] HOT 3
- useAnimatedKeyboard break navigation color HOT 5
- Found Error TypeScript when run yarn tsc HOT 2
- Task :react-native-reanimated:buildCMakeRelWithDebInfo[armeabi-v7a] FAILED HOT 4
- Entering and/or layout animation flickering when SafeAreaView is a first parent of an animated component HOT 1
- > java.net.SocketException: Connection reset HOT 1
- iOS build faied: ld: Undefined symbols HOT 3
- SVG Polygon Animation not working HOT 1
- [3.12.0] TypeError: property is not configurable on useAnimatedStyle hook HOT 12
- useSharedValue `modify` does not exist, but shows in docs HOT 1
- Animated component issue: touchables and TextInputs inside the Animated.ScrollView are not responsive HOT 3
- web: AnimatedComponent raises a deprecation warning for findDOMNode in v3.12.0 HOT 4
- React Native Reanimated Not Responsive HOT 5
- Invalid `RNReanimated.podspec` file: [Reanimated] Unsupported React Native version. Please use 0.71 or newer. HOT 3
- Android build failure v3.12.0 HOT 8
- Impossible to animate any SVG color on android HOT 5
- 3.12.0 crashes with 'property is not configurable' HOT 11
- Performance regression or race condition between UI and JS threads
- RangeError: Set maximum size exceeded HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-reanimated.