diff --git a/native/.babelrc.cjs b/native/.babelrc.cjs --- a/native/.babelrc.cjs +++ b/native/.babelrc.cjs @@ -9,7 +9,12 @@ 'babel-plugin-transform-bigint', '@babel/plugin-transform-named-capturing-groups-regex', // react-native-reanimated must be last - 'react-native-reanimated/plugin', + [ + 'react-native-reanimated/plugin', + { + extraPresets: ['@babel/preset-flow'], + }, + ], ], env: { production: { diff --git a/patches/react-native-reanimated+2.12.0.patch b/patches/react-native-reanimated+2.12.0.patch --- a/patches/react-native-reanimated+2.12.0.patch +++ b/patches/react-native-reanimated+2.12.0.patch @@ -1,5 +1,5 @@ diff --git a/node_modules/react-native-reanimated/android/build.gradle b/node_modules/react-native-reanimated/android/build.gradle -index a38b2a5..32cb655 100644 +index a38b2a5..8605d09 100644 --- a/node_modules/react-native-reanimated/android/build.gradle +++ b/node_modules/react-native-reanimated/android/build.gradle @@ -658,7 +658,7 @@ if (isNewArchitectureEnabled()) { @@ -11,3 +11,32 @@ if (REACT_NATIVE_MINOR_VERSION < 69) { srcUrl = "https://github.com/react-native-community/boost-for-react-native/releases/download/v${transformedVersion}-0/boost_${BOOST_VERSION}.tar.gz" } +diff --git a/node_modules/react-native-reanimated/plugin.js b/node_modules/react-native-reanimated/plugin.js +index b9ba1c3..0aa9ab7 100644 +--- a/node_modules/react-native-reanimated/plugin.js ++++ b/node_modules/react-native-reanimated/plugin.js +@@ -360,13 +360,14 @@ function makeWorklet(t, fun, state) { + + const transformed = transformSync(code, { + filename: state.file.opts.filename, +- presets: ['@babel/preset-typescript'], ++ presets: ['@babel/preset-typescript', ...(state.opts.extraPresets ?? [])], + plugins: [ + '@babel/plugin-transform-shorthand-properties', + '@babel/plugin-transform-arrow-functions', + '@babel/plugin-proposal-optional-chaining', + '@babel/plugin-proposal-nullish-coalescing-operator', + ['@babel/plugin-transform-template-literals', { loose: true }], ++ ...(state.opts.extraPlugins ?? []), + ], + ast: true, + babelrc: false, +@@ -760,6 +761,8 @@ function isPossibleOptimization(fun) { + + module.exports = function ({ types: t }) { + return { ++ ++ + pre() { + // allows adding custom globals such as host-functions + if (this.opts != null && Array.isArray(this.opts.globals)) {