oblador / react-native-animatable

Standard set of easy to use animations and declarative transitions for React Native
MIT License
9.79k stars 704 forks source link

React Native Web support on new ejected create-react-app TypeScript project #370

Open kopax-polyconseil opened 3 years ago

kopax-polyconseil commented 3 years ago

We are experiencing issue configuring webpack with this module because of the class property here:

https://github.com/oblador/react-native-animatable/blob/ccafe141921912f21f1ad006ba8c3fb2191d6afc/createAnimatableComponent.js#L132

./node_modules/react-native-animatable/createAnimatableComponent.js
SyntaxError: /home/dka/workspace/github.com/pass-culture/pass-culture-app-native/node_modules/react-native-animatable/createAnimatableComponent.js: Support for the experimental syntax 'classProperties' isn't currently enabled (133:24):

  131 | 
  132 |   return class AnimatableComponent extends Component {
> 133 |     static displayName = `withAnimatable(${wrappedComponentName})`;
      |                        ^
  134 | 
  135 |     static propTypes = {
  136 |       animation: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),

Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-class-properties (https://git.io/vb4yQ) to the 'plugins' section to enable parsing.

I have tried to follow the recommendation but couldn't get a working configuration, did anyone succeeded to configure this package with webpack?

trigonometric-act commented 2 years ago

Did you make it work?