Skip to content

How to install new modules after setup? #2135

@ianaz

Description

@ianaz

First of all thank you for your work! I followed your "getting started" guide and worked perfectly, but now I'm having quite a big issue on almost all new libraries I want to add...
I'm writing the application in React Native and having it transformed for web too and it works well until I install a library (For example the Bottom sheet you recommend).

I install the new library, launch my application using react-app-rewired start and then, even if flow plugin, preset-env etc. are there I get errors like this one:

.../workspace/Name/node_modules/react-native-gesture-handler/DrawerLayout.js: Support for the experimental syntax 'flow' isn't currently enabled (30:8):

which suggests webpack isn't setup correctly; I then noticed in the config-overrides.js that you want babel presets/plugins only to be ran on react-native-vector-icons and react-native-safe-area-view modules.
To be clear (as described here):

....
test: /\.js$/,
exclude: /node_modules[/\\](?!react-native-vector-icons|react-native-safe-area-view)/,
...

Whenever I add my new library there, I then get another compilation error:

./node_modules/react-native-gesture-handler/GestureButtons.js 244:65
Module parse failed: Unexpected token (244:65)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|           rest = _objectWithoutProperties(_this$props2, ["children", "style"]);
| 
>     const resolvedStyle = _reactNative.StyleSheet.flatten(style ?? {});
| 
|     return /*#__PURE__*/_react.default.createElement(BaseButton, _extends({}, rest, {

react: 16.13.1
react-native: 0.63.2
react-native-paper: 4.0.1
react-native-vector-icons: 7.0.0

Any suggestion? Thank you very much and sorry if it's a noob question

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions