mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
RN: Migrate to ESM - Libraries/Components/Image (#51434)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51434 Migrates files to use ESM to mitigate the existing lint warning. I am suppressing `RelativeImageStub` to preserve compatibility with the dynamic asset exports generated by Metro (i.e. not ESM with `default` exports). Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D74943031 fbshipit-source-id: ac4b2afd96fe5446acb4452395d7cb42bb5a6c17
This commit is contained in:
committed by
Facebook GitHub Bot
parent
1218a8a6d0
commit
f1697544cd
+4
-10
@@ -8,13 +8,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {PackagerAsset} from '@react-native/assets-registry/registry';
|
||||
|
||||
const AssetRegistry = require('@react-native/assets-registry/registry') as {
|
||||
registerAsset: (asset: PackagerAsset) => number,
|
||||
getAssetByID: (assetId: number) => PackagerAsset,
|
||||
};
|
||||
|
||||
module.exports = AssetRegistry;
|
||||
export {
|
||||
registerAsset,
|
||||
getAssetByID,
|
||||
} from '@react-native/assets-registry/registry';
|
||||
|
||||
@@ -27,4 +27,5 @@ const RelativeImageStub = (AssetRegistry.registerAsset({
|
||||
type: 'png',
|
||||
}): number);
|
||||
|
||||
// eslint-disable-next-line lint/no-commonjs-exports
|
||||
module.exports = RelativeImageStub;
|
||||
|
||||
@@ -4219,11 +4219,10 @@ declare export default typeof RCTNativeAppEventEmitter;
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Image/AssetRegistry.js 1`] = `
|
||||
"declare const AssetRegistry: {
|
||||
registerAsset: (asset: PackagerAsset) => number,
|
||||
getAssetByID: (assetId: number) => PackagerAsset,
|
||||
};
|
||||
declare module.exports: typeof AssetRegistry;
|
||||
"export {
|
||||
registerAsset,
|
||||
getAssetByID,
|
||||
} from \\"@react-native/assets-registry/registry\\";
|
||||
"
|
||||
`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user