[asset][expo] Add manifest check in expo and expo-asset to avoid yellowbox on bare workflow apps #12230
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
As stated in issue #11888,
expo-asset
(and additionally,expo
'slogging.fx.ts
) accessedConstants.manifest
on bare workflow apps without proper existance checks beforehand. This resulted in annoying yellowbox warnings in bare workflow debug builds.Therefore, this PR fixes #11888.
How
I changed
expo-assets -> PlatformUtils.getManifest
to useIS_MANAGED_ENV
andIS_BARE_ENV_WITH_UPDATES
to determine available sources for the manifest. IfIS_MANAGED_ENV
is true, it will useConstants.manifest
, ifIS_BARE_ENV_WITH_UPDATES
is true, it will useUpdates.manifest
, else it will just return{}
. A similar method is used inexpo -> environment/logging.fx
.This added
expo-updates
as a dependency toexpo
andexpo-asset
.(I also had to change
expo-asset -> AssetSources-test._mockConstants
to setappOwnership
, since that is howIS_MANAGED_ENV
is determined.)Test Plan
yarn test
onexpo
andexpo-assets
I did not write any extra tests for this, since I don't think it's needed.