React-native-reanimated: "react-native-reanimated/plugin" does not work

Created on 17 Sep 2020  路  13Comments  路  Source: software-mansion/react-native-reanimated

Description

Screenshots

IMG_3A3245021BDC-1

Steps To Reproduce

  1. add react-native-reanimated/plugin to babel.config.js

Expected behavior

the code to compile

Actual behavior

the bundler crashes

Snack or minimal code example

Package versions

  • React: 16.13.1
  • React Native: 0.63.2
  • React Native Reanimated: 2.0.0-alpha.6
馃彔 Reanimated2 馃悶 Bug

Most helpful comment

I think I saw someone having this problem and upgrading node version helped

All 13 comments

did you run packager with --reset-cache?

yes! i did

still doesn't work, I don't know what to do anymore

Then it should work. Without any code we won't be able to help you, unfortunately.

that's the bable code

/* eslint-disable func-names */
const rootImportOpts = [
  {
    rootPathSuffix: './src',
    rootPathPrefix: 'src',
  },
  {
    rootPathSuffix: './src/screens',
    rootPathPrefix: 'screens',
  },
  {
    rootPathSuffix: './src/shared-components',
    rootPathPrefix: 'shared-components',
  },
  {
    rootPathSuffix: './src/utils',
    rootPathPrefix: 'utils',
  },
  {
    rootPathSuffix: './assets',
    rootPathPrefix: 'assets',
  },
  {
    rootPathSuffix: './src/context',
    rootPathPrefix: 'context',
  },
];
// require('babel-core').transform('code', { plugins: ['babel-plugin-rewire'] });

module.exports = function(api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo', '@babel/preset-typescript'],
    sourceMaps: true,
    plugins: [
      [
        'babel-plugin-root-import',
        {
          paths: rootImportOpts,
        },
      ],
      // '@babel/proposal-class-properties',
      // '@babel/proposal-object-rest-spread',
      'transform-class-properties',
      // ['babel-plugin-rewire'],
      'react-native-reanimated/plugin',
    ],
  };
};

if I remove 'react-native-reanimated/plugin', the error doesn't show but reanimated also don't work, at least the version 2 the version one still works fine

could you try the reanimated plugin to be the very first one one the list?

What is your node version? Try using node 12

it's 10.15.3

i tried the reanimated-2-playground
git checkout [email protected]:software-mansion-labs/reanimated-2-playground.git
and got the same error

I think I saw someone having this problem and upgrading node version helped

It worked! thanks, man!!!

they could add to the documentation that requires node 12 or above!

Was this page helpful?
0 / 5 - 0 ratings