LoginSignup
6
0

More than 3 years have passed since last update.

React NativeでTab navigationを使おうとしたら "Unable to resolve module 'react-native-screens' from~" というエラーが出てきた

Last updated at Posted at 2020-08-07

必要なパッケージをインストール後、ここに書いてあるコードを丸々コピペしてexpoを起動したら以下のようなエラーが出てきた。

Unable to resolve module 'react-native-screens' from 'node_modules/@react-navigation/bottom-tabs/src/views/BttomTabView.tsx': react-native-screens could not be found within the project.

 If you are sure the module exists, try these steps:
  1. Clear watchman watches: watchman watch-del-all
  2. Delete node_modeules: rm -rf node_modules and run yarn install
  3. Reset Metro's cache: yarn start --reset-cache
  4. Remove the cache: rm -rf /tmp/metro-*

試した対処法

エラーコードの通りに試してみる

$ watchman del-all
$ rm -rf node_modules && yarn install
$ yarn cache clean
$ rm -rf /tmp/metro-*

しかし、同じエラーが表示されて解決せず…

react-native-gesture-handlerreact-native-reanimatedreact-native-screensをインストールする

$ yarn add react-native-gesture-handler react-native-reanimated react-native-screens

ググったらこれで解決したという人がいたので試してみたが、今度は新たに
console.error: "RCTView generated view config for validAttributes does not match native, missing: accessibilityValue"
というエラーが表示されてしまった

解決策

  1. $ rm -rf node_modules && yarn install

  2. $ expo upgrade

  3. $ yarn add react-native-gesture-handler react-native-reanimated react-native-screens

  4. $ expo start

自分の使っているexpoのバージョンは37.0.0だったので、それを38.0.0にアップデートしてから必要なパッケージをインストールしたところ解決した

参考

navigation - Unable to resolve module 'react-native-screen' - Stack Overflow

6
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
0