I ran a global check for anything containing either __expo or Expo, but the only thing that is found is in node_modules > expo > build > depreciatedGlobal.js > logWarning() …which is your warning telling me about this warning!
The only instance of it in my whole project is the one i’ve mentioned above, and i’ve noticed it only happens on Android?!
i’m not sure i understand - there are several places in that screenshot that access Expo.Constants, such as react-native-safe-area-view. that’s exactly what you’re looking for. i’d recommend not using react-native-safe-area-view (now deprecated) and switching to react-native-safe-area-context instead
So react-native-safe-area-view and react-native-reanimated are installed. The latter is not surprising, since it’s listed in your dependencies. Let’s look at them one at a time.
yarn why is useful for seeing why something is installed if you don’t have it listed in your dependencies. Unfortunately I don’t believe npm has a similar command:
$ yarn why react-native-safe-area-view
yarn why v1.22.10
[1/4] Why do we have the module "react-native-safe-area-view"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "email@example.com"
info Reasons this module exists
- "react-navigation#@react-navigation#native" depends on it
- Hoisted from "react-navigation#@react-navigation#native#react-native-safe-area-view"
info Disk size without dependencies: "801KB"
info Disk size with unique dependencies: "1.07MB"
info Disk size with transitive dependencies: "1.35MB"
info Number of shared dependencies: 2
Done in 0.35s.
So that tells us that react-native-safe-area-view is installed because it’s a dependency of react-navigation. (Or at least the version of react-navigation that you have installed.)
Next, install react-native-gesture-handler and react-native-reanimated
so that explains why you have react-native-reanimated installed.
It turns out that upgrading to React Navigation 5.x gets rid of the react-native-safe-area-view dependency. Unfortunately version 5 still wants you to install react-native-reanimated and when you do that you get version 1.13.2 which has references to Expo.Constants.
Even if you install react-native-reanimated@^2.0.0 there is still a reference to Expo.Constants, although only in:
@notbrent since React Navigation tells you to install react-native-reanimated which contains references to Expo.Constants, what is the recommended way to get rid of these warnings when using React Navigation?
Thanks very much for the help with this, it explains a lot
The only problem is, how do I fix the issue of these dependencies (that I don’t use) referencing something that is going to be removed in the next update, which is more than likely going to break my app?
Unless I am mistaken, react-native-reanimated is only referred to by @react-navigation/drawer.
I created a new Expo project, installed React Navigation version 5 as per the Getting Started guide, then installed @react-navigation/drawer. Again I found references to Expo.Constants in react-native-navigation.
Then I replaced the contents of App.js with the example from here.
When I ran expo start and opened/closed the drawer etc. I did not get any warnings about Expo.Constants.
I see that was merged after the 2.0.0 release, so I currently still get the following:
$ expo init test
✔ Choose a template: › blank a minimal app as clean as an empty canvas
$ cd test
$ yarn add react-native-reanimated@^2.0.0
info Direct dependencies
$ find node_modules/react-native-reanimated -type f -print0 | xargs -0 grep -l 'Expo\.Constants'
Is the plan to have Expo SDK 41 depend on react-native-reanimated version 2.0.1?
Will React Navigation version 3 still work in Expo SDK version 41 with react-native-reanimated version 2.x?