Decorators don't work in release builds using SDK 31

We are using decorators and they have stopped working in SDK 31. This seems to be a RN bug https://github.com/facebook/react-native/issues/20150#issue-340235017

What is the best way to work around this in expo?

We use decorators extensively and this config has worked out for us so far in 31:

package.json devDependencies:

"@babel/plugin-proposal-decorators": "^7.1.0",
    "babel-preset-expo": "^5.0.0",
...

babel.config.js:

module.exports = function(api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
    plugins: [['@babel/plugin-proposal-decorators', { legacy: true }]],
  };
};

With these or any babel config changes, thing seem to work best if you stop Expo and restart it with the -c flag to clear the JS cache.

Have you deployed your app ? It works fine for us in development but not for release builds

Yeah, it’s worked for on release builds. When we first upgraded to 31, with our babel config mostly intact from 30, we did see similar behavior- worked in dev, not in release.

Thanks, I’ll give it a try

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.