Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
1
Help us understand the problem. What are the problem?

More than 1 year has passed since last update.

posted at

updated at

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

必要なパッケージをインストール後、ここに書いてあるコードを丸々コピペして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

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
1
Help us understand the problem. What are the problem?