Skip to content

Commit babe13b

Browse files
committed
add comments
1 parent 10cbf86 commit babe13b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/out-of-tree-platforms/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,14 @@ type ResolverConfig = {
1414
platformNameMap: {[platform: string]: string},
1515
};
1616

17+
/**
18+
* Creates a custom Metro resolver that maps platform extensions to package names.
19+
* To be used in app's `metro.config.js` as `resolver.resolveRequest`.
20+
*/
1721
const getPlatformResolver = (config: ResolverConfig): CustomResolver => {
1822
return (context, moduleName, platform) => {
23+
// `customResolverOptions` is populated through `?resolver.platformExtension` query params
24+
// in the jsBundleURLForBundleRoot method of the react-native/React/Base/RCTBundleURLProvider.mm
1925
const platformExtension = context.customResolverOptions?.platformExtension;
2026
let modifiedModuleName = moduleName;
2127

0 commit comments

Comments
 (0)