Skip to content

Commit

Permalink
Patch to correct issues with asset loading at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
AmandaRiu committed Jul 31, 2021
1 parent 0544993 commit dce0398
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions patches/react-native+0.64.0.patch
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,27 @@ index 52cbda4..3e3b71e 100644
hidesWhenStopped: true,
size: 'small',
};
diff --git a/node_modules/react-native/Libraries/Image/AssetSourceResolver.js b/node_modules/react-native/Libraries/Image/AssetSourceResolver.js
index 5ebd97a..3f511b9 100644
--- a/node_modules/react-native/Libraries/Image/AssetSourceResolver.js
+++ b/node_modules/react-native/Libraries/Image/AssetSourceResolver.js
@@ -92,9 +92,18 @@ class AssetSourceResolver {
*/
assetServerURL(): ResolvedAssetSource {
invariant(!!this.serverUrl, 'need server to load from');
+ /**
+ * The monorepo configuration we have set up is suffering from local static
+ * images not displaying. It would appear the server URL is incorrect. This
+ * is not a proper fix, but a stopgap.
+ * - https://git.io/JBV4e
+ * - https://git.io/JBV4k
+ */
+ const brokenMonorepoAsset = /(^assets\/\.\.\/)(?!\.\.\/|node_modules)(.*)/g;
return this.fromSource(
this.serverUrl +
- getScaledAssetPath(this.asset) +
+ getScaledAssetPath(this.asset)
+ .replace(brokenMonorepoAsset, '$1packages/$2') +
'?platform=' +
Platform.OS +
'&hash=' +

0 comments on commit dce0398

Please sign in to comment.