React Native ExpoにReact Native Elementsをインストールするとnpmエラー


React Native Elementsをインストールするとnpmパッケージのバージョンが合わずにエラー。

% expo init my-project
% cd my-project
% npm install @rneui/themed @rneui/base
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: my-project-element@1.0.0
npm ERR! Found: react-native-safe-area-context@4.2.4
npm ERR! node_modules/react-native-safe-area-context
npm ERR!   react-native-safe-area-context@"4.2.4" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-safe-area-context@"^3.1.9" from @rneui/base@4.0.0-rc.4
npm ERR! node_modules/@rneui/base
npm ERR!   @rneui/base@"*" from the root project
npm ERR!   peer @rneui/base@"4.0.0-rc.4" from @rneui/themed@4.0.0-rc.4
npm ERR!   node_modules/@rneui/themed
npm ERR!     @rneui/themed@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/user/.npm/eresolve-report.txt for a full report.


React Native ExpoはYarnを使っているため、npmだとうまくインストールできない?



% yarn add @rneui/themed @rneui/base
yarn add v1.22.10
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "react-native > react-native-codegen > jscodeshift@0.13.1" has unmet peer dependency "@babel/preset-env@^7.1.6".
warning " > @rneui/base@4.0.0-rc.4" has incorrect peer dependency "react-native-safe-area-context@^3.1.9".
warning " > @rneui/base@4.0.0-rc.4" has unmet peer dependency "react-native-vector-icons@>7.0.0".
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
success Saved 6 new dependencies.
info Direct dependencies
├─ @rneui/base@4.0.0-rc.4
└─ @rneui/themed@4.0.0-rc.4
info All dependencies
├─ @rneui/base@4.0.0-rc.4
├─ @rneui/themed@4.0.0-rc.4
├─ @types/react-native-vector-icons@6.4.10
├─ hoist-non-react-statics@3.3.2
├─ react-native-ratings@8.1.0
└─ react-native-size-matters@0.4.0
✨  Done in 8.01s.