Fix linking expo
package when Expo autolinking is not used
#26932
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
This
react-native.config.js
is a nice way to preventexpo
package being linked when Expo modules are not set. However, this is not perfect, especially that we now support out of tree platforms (i.e. the config doesn't handle macOS right now).Currently, running
pod install
in areact-native-macos
project that hasexpo
in dependencies but doesn't have the setup for Expo autolinking would fail because it's unable to find pod specification forExpoModulesCore
(which cannot be linked by React Native Community CLI).How
When
use_expo_modules!
is not defined, don't include the dependency onExpoModulesCore
and print appropriate warning instead.Sadly, this doesn't fix the problem when autolinking is imported but
use_expo_modules!
is not used. I'm not sure if we can do something with that, but this solution seems to be better than nothing.Test Plan
npx react-native init
npm install expo
npx react-native-macos-init
doesn't fail onpod install
step and shows the warning that instructs me to set up Expo modules