Android & iOS both Issue on createAnimatedComponent.tsx Unexpected token, expected , on expo react native android application

67 Views Asked by At

I'm running an expo react-native application with a dependent version

  1. "expo": "^49.0.0"
  2. system MAC M1 Venture 13.2.1 (22D68)
  3. Node version is v20.11.1
  4. npm version is 10.2.4
  5. npx version is 10.2.4

Have configured all the packages and plugins correctly even ./gradlew clean command is successful. But when running the application using the yarn android command on the emulator it throws a run time error and the below issue came for the react-native-reanimated package for syntax error.

Find the issue below,

error: SyntaxError: /Users/da/Desktop/Documents/apps/expoapps/mm/myapp/node_modules/react-native-reanimated/src/createAnimatedComponent/createAnimatedComponent.tsx: Unexpected token, expected "," (105:28)

103 | // @ts-ignore This is required to create this overload, since type of createAnimatedComponent is incorrect and doesn't include typeof FlatList
104 | export function createAnimatedComponent(

105 | component: typeof FlatList,
| ^
106 | options?: Options
107 | ): ComponentClass<AnimateProps<FlatListProps>>;
108 |
`

Have the dependency version as,

  1. "react-native": "0.72.10",
  2. "react-native-reanimated": "^3.7.1",

and babel.config.js as follows as,

module.exports = function(api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
    plugins: ['react-native-reanimated/plugin'],
  };
};

Also in the iOS platform, it fails with the react-native-reanimated package with the same error, and also, below is the iOS runtime error caught on the Simulator

iOS Bundling failed 12533ms
error: SyntaxError: /Users/devendraahirwar/Desktop/Documents/apps/expoapps/mm/matrimoniallagnagathi/node_modules/react-native-reanimated/src/reanimated2/threads.ts: Unexpected token (235:47)

233 |
234 | return (...args) =>

235 | runOnJS(runWorkletOnJS<Args, ReturnValue>)(
| ^
236 | fun as WorkletFunction<Args, ReturnValue>,
237 | ...args
238 | );

Any resolution to this?

0

There are 0 best solutions below