octopitus / rn-sliding-up-panel

Draggable sliding up panel implemented in React Native https://octopitus.github.io/rn-sliding-up-panel/
MIT License
928 stars 157 forks source link

Module loading error with Expo Web / react-native-web #143

Closed vjsingh closed 4 years ago

vjsingh commented 4 years ago

Issue Description

When importing this library in Expo Web I get the below error:

Failed to compile
.../node_modules/rn-sliding-up-panel/SlidingUpPanel.js 35:19
Module parse failed: Unexpected token (35:19)
You may need an appropriate loader to handle this file type.
| 
| class SlidingUpPanel extends React.PureComponent {
>   static propTypes = {
|     height: PropTypes.number,
|     animatedValue: PropTypes.instanceOf(Animated.Value),
This error occurred during the build time and cannot be dismissed.

Environment

Expo SDK 33 on web

Solution?

Per this issue: https://github.com/react-native-web-community/react-native-web-linear-gradient/issues/1

This may be the fix needed:

This package needs to compile its modules to ES5 and point the package.json entry file to a commonjs module.

arch10 commented 4 years ago

@octopitus Any update on this? Getting the same error with expo SDK 36.

octopitus commented 4 years ago

@arch10 Try adding this to your app.json

{
  "expo": {
    "web": {
      "build": {
        "babel": {
          "include": ["rn-sliding-up-panel", "static-container"]
        }
      }
    }
  }
}
arch10 commented 4 years ago

Thanks @octopitus !! It worked !!