Skip to content

Commit 2b2bdd3

Browse files
MatiPl01Copilot
andauthored
chore: Bump reanimated to latest versions (#432)
## Description This PR bumps reanimated in example apps to latest versions (`4.0.0` in the `fabric` example and `3.19.0` in remaining ones). ## TODO - [x] Fix runtime error thrown immediately after starting the app <img width="1035" height="466" alt="image" src="https://github.com/user-attachments/assets/eaa20e3b-dea3-4209-b472-efc81d2606f8" /> - [ ] Fix expo example `Runtime not ready` error --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent afd4f2f commit 2b2bdd3

28 files changed

+483
-433
lines changed

.yarn/patches/react-native-reanimated-npm-3.18.0-3e0f9f00d6.patch renamed to .yarn/patches/react-native-reanimated-npm-4.0.1-40ff4579cd.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/lib/module/layoutReanimation/web/componentUtils.js b/lib/module/layoutReanimation/web/componentUtils.js
2-
index c3623f90862b4413ce6d77bb04496ad2fecb3125..1ebfd2a5579b6bbfd19b343e0484a6ca935652d5 100644
2+
index 558d20f1721d3ee84e61ea6abb98b611bbce1520..8f8d9fd7461a35bc9f543b997cf7b33113a44171 100644
33
--- a/lib/module/layoutReanimation/web/componentUtils.js
44
+++ b/lib/module/layoutReanimation/web/componentUtils.js
5-
@@ -109,6 +109,7 @@ export function setElementAnimation(element, animationConfig, shouldSavePosition
5+
@@ -110,6 +110,7 @@ export function setElementAnimation(element, animationConfig, shouldSavePosition
66
element.style.animationDuration = `${duration}s`;
77
element.style.animationDelay = `${delay}s`;
88
element.style.animationTimingFunction = easing;
@@ -11,7 +11,7 @@ index c3623f90862b4413ce6d77bb04496ad2fecb3125..1ebfd2a5579b6bbfd19b343e0484a6ca
1111
if (animationConfig.animationType === LayoutAnimationType.ENTERING) {
1212
// On chrome sometimes entering animations flicker. This is most likely caused by animation being interrupted
1313
diff --git a/src/layoutReanimation/web/componentUtils.ts b/src/layoutReanimation/web/componentUtils.ts
14-
index 53bfae44e3dfee63f2fbc86566f99d1f586396d1..99ebb1b9bdad6299cc75a848fb2e1f525213dee9 100644
14+
index 7118949bc0f3ae223d7890cb860e688e75ad8f0d..aec1349be3798e9d1fde4fca08639c5ba97a9ebc 100644
1515
--- a/src/layoutReanimation/web/componentUtils.ts
1616
+++ b/src/layoutReanimation/web/componentUtils.ts
1717
@@ -163,6 +163,7 @@ export function setElementAnimation(

babel.config.cjs

Lines changed: 0 additions & 9 deletions
This file was deleted.

example/app/eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import rootConfig from '../../eslint.config.mjs';
22

33
export default [
4+
{
5+
ignores: ['scripts']
6+
},
47
...rootConfig,
58
{
69
languageOptions: {

example/app/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
"react-native": "0.80.0",
1414
"react-native-gesture-handler": "2.26.0",
1515
"react-native-haptic-feedback": "2.3.3",
16-
"react-native-reanimated": "patch:react-native-reanimated@npm%3A3.18.0#~/.yarn/patches/react-native-reanimated-npm-3.18.0-3e0f9f00d6.patch",
16+
"react-native-reanimated": "patch:react-native-reanimated@npm%3A4.0.1#~/.yarn/patches/react-native-reanimated-npm-4.0.1-40ff4579cd.patch",
1717
"react-native-safe-area-context": "5.3.0",
1818
"react-native-screens": "4.11.1",
1919
"react-native-sortables": "workspace:*",
20-
"react-native-svg": "15.12.0"
20+
"react-native-svg": "15.12.0",
21+
"react-native-worklets": "0.4.1"
2122
},
2223
"devDependencies": {
2324
"@babel/core": "^7.25.2",

example/app/scripts/dependencies.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
const path = require('path');
2+
3+
function getDependencies(currentAppDir = '.', excludeCommon = []) {
4+
const commonAppDir = path.resolve(__dirname, '..');
5+
const commonAppPkg = require(path.resolve(commonAppDir, 'package.json'));
6+
const currentAppPkg = require(path.resolve(currentAppDir, 'package.json'));
7+
8+
const excludedCommonDeps = new Set(excludeCommon);
9+
10+
const allDeps = new Set([
11+
...[
12+
...Object.keys(commonAppPkg.dependencies ?? {}),
13+
...Object.keys(commonAppPkg.devDependencies ?? {})
14+
].filter(dep => !excludedCommonDeps.has(dep)),
15+
...Object.keys(currentAppPkg.dependencies ?? {}),
16+
...Object.keys(currentAppPkg.devDependencies ?? {})
17+
]);
18+
19+
const result = {};
20+
21+
for (const dep of allDeps) {
22+
// Find versions in both package.json files
23+
const commonVersion =
24+
commonAppPkg.dependencies?.[dep] ?? commonAppPkg.devDependencies?.[dep];
25+
const currentVersion =
26+
currentAppPkg.dependencies?.[dep] ?? currentAppPkg.devDependencies?.[dep];
27+
28+
if (!commonVersion || !currentVersion || commonVersion === currentVersion) {
29+
result[dep] = {
30+
root: path.resolve(currentAppDir, `../../node_modules/${dep}`)
31+
};
32+
} else {
33+
// Include from the local node_modules only if the dependency is present
34+
// in the current app and versions are different
35+
result[dep] = {
36+
root: path.resolve(currentAppDir, `node_modules/${dep}`)
37+
};
38+
}
39+
}
40+
41+
return result;
42+
}
43+
44+
module.exports = {
45+
getDependencies
46+
};

example/app/scripts/metro.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const path = require('path');
2+
const escape = require('escape-string-regexp');
3+
const {
4+
wrapWithReanimatedMetroConfig
5+
} = require('react-native-reanimated/metro-config');
6+
7+
function createMetroConfig(defaultConfig, currentAppDir, options = {}) {
8+
const { excludeFromRoot = [] } = options;
9+
10+
const monorepoRoot = path.resolve(currentAppDir, '../..');
11+
12+
const config = { ...defaultConfig };
13+
config.resolver ??= {};
14+
15+
config.watchFolders = [currentAppDir, monorepoRoot];
16+
config.resolver.nodeModulesPaths = [
17+
path.resolve(currentAppDir, 'node_modules'),
18+
path.resolve(currentAppDir, '../app/node_modules'),
19+
path.resolve(monorepoRoot, 'node_modules')
20+
];
21+
config.resolver.disableHierarchicalLookup = true;
22+
23+
if (excludeFromRoot.length > 0) {
24+
config.resolver.blockList = excludeFromRoot.map(
25+
m =>
26+
new RegExp(
27+
`^${escape(path.join(monorepoRoot, 'node_modules', m))}\\/.*$`
28+
)
29+
);
30+
}
31+
32+
return wrapWithReanimatedMetroConfig(config);
33+
}
34+
35+
module.exports = {
36+
createMetroConfig
37+
};

example/expo/metro.config.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
1-
const path = require('path');
21
const { getDefaultConfig } = require('expo/metro-config');
2+
const { createMetroConfig } = require('../app/scripts/metro');
33

4-
const monorepoRoot = path.resolve(__dirname, '../..');
4+
const defaultConfig = getDefaultConfig(__dirname);
55

6-
const config = getDefaultConfig(__dirname);
7-
8-
config.watchFolders = [__dirname, monorepoRoot];
9-
config.resolver.nodeModulesPaths = [
10-
path.resolve(__dirname, 'node_modules'),
11-
path.resolve(__dirname, '../app/node_modules'),
12-
path.resolve(monorepoRoot, 'node_modules')
13-
];
14-
config.resolver.disableHierarchicalLookup = true;
15-
16-
module.exports = config;
6+
module.exports = createMetroConfig(defaultConfig, __dirname);

example/expo/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"name": "example-expo",
33
"version": "1.0.0",
44
"dependencies": {
5-
"expo": "53.0.11",
5+
"expo": "53.0.20",
66
"expo-status-bar": "~2.2.3",
77
"react": "19.0.0",
8-
"react-native": "0.79.3",
8+
"react-native": "0.79.5",
99
"react-native-gesture-handler": "~2.24.0",
1010
"react-native-reanimated": "~3.17.4"
1111
},

example/fabric/babel.config.cjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
*/
55
const path = require('path');
66

7-
const rootDir = path.resolve(__dirname, '../..');
87
const appDir = path.resolve(__dirname, '../app');
98

109
module.exports = function (api) {
1110
api.cache(true);
1211
return {
13-
extends: path.join(rootDir, 'babel.config.cjs'),
1412
presets: ['module:@react-native/babel-preset'],
1513
plugins: [
14+
'@babel/plugin-transform-export-namespace-from',
1615
[
1716
'module-resolver',
1817
{
@@ -23,7 +22,8 @@ module.exports = function (api) {
2322
'@': path.join(appDir, 'src')
2423
}
2524
}
26-
]
25+
],
26+
'react-native-worklets/plugin'
2727
]
2828
};
2929
};

0 commit comments

Comments
 (0)