amplify-js icon indicating copy to clipboard operation
amplify-js copied to clipboard

Amplify React Native dependency incompatible with latest version of react-native

Open iartemiev opened this issue 2 years ago • 3 comments

Before opening, please confirm:

JavaScript Framework

React Native

Environment information

 System:
    OS: macOS 12.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 11.22 GB / 64.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.15.1 - /usr/local/bin/node
    Yarn: 1.22.5 - ~/.yarn/bin/yarn
    npm: 8.11.0 - /usr/local/bin/npm
    Watchman: 2022.06.13.00 - /usr/local/bin/watchman
  Browsers:
    Chrome: 102.0.5005.115
    Chrome Canary: 105.0.5135.0
    Firefox: 99.0.1
    Safari: 15.5
  npmPackages:
    @babel/core: ^7.12.9 => 7.18.5
    @babel/runtime: ^7.12.5 => 7.18.3
    @react-native-community/eslint-config: ^2.0.0 => 2.0.0
    HelloWorld:  0.0.1
    babel-jest: ^26.6.3 => 26.6.3
    eslint: ^7.32.0 => 7.32.0
    hermes-inspector-msggen:  1.0.0
    jest: ^26.6.3 => 26.6.3
    metro-react-native-babel-preset: ^0.70.3 => 0.70.3
    react: 18.0.0 => 18.0.0
    react-native: 0.69.0 => 0.69.0
    react-test-renderer: 18.0.0 => 18.0.0
  npmGlobalPackages:
    @aws-amplify/cli: 9.0.0
    corepack: 0.10.0
    npm: 8.11.0

Describe the bug

Customers are unable to install aws-amplify via npm into React Native applications using the latest version of [email protected] released 6/22/22.

React Native 0.69.0 updated its React dependency to [email protected]. One of the AmplifyJS React Native dependencies react-native-picker/picker doesn't yet support this version per its peer dependency list.

We should explore whether we can provide a short term resolution to customers until the picker team updates its peer dep. It would be worth opening a GitHub issue in their repo requesting that change.

As a workaround, customers can use the --legacy-peer-deps flag when using npm install to ignore peer dependency warnings.

Note: this issue is specific to customers installing aws-amplify via npm at version >= 7. Customers using yarn will not experience this issue.

Expected behavior

It should be possible to install aws-amplify into a new React Native project using the latest version of RN.

Reproduction steps

$ npx react-native@latest init amplify_rn
$ cd amplify_rn
$ npm install aws-amplify aws-amplify-react-native amazon-cognito-identity-js @react-native-community/netinfo @react-native-async-storage/async-storage @react-native-picker/picker

Workarounds

  • Use --legacy-peer-deps when installing picker npm install @react-native-picker/picker --legacy-peer-deps
  • Use an older version of react-native npx [email protected] init $PROJECTNAME --version 0.68.0
  • Use a package manager that doesn't enforce peer dependencies such as yarn or npm prior to 7

iartemiev avatar Jun 23 '22 02:06 iartemiev

I have opened an issue with the @react-native-picker/picker library and updated the getting started guide recommending users getting started use the last working version of react-native to avoid running into this issue.

When @react-native-picker/picker is compatible with the latest version of react-native we will roll back the docs update.

stocaaro avatar Jun 23 '22 19:06 stocaaro

Leaving this here as a reminder: We'll need to revert these changes in our canaries after this issue has been resolved.

iartemiev avatar Jun 23 '22 20:06 iartemiev

I'm facing the same issue.

israx avatar Jul 31 '22 15:07 israx