@samitouri / QOS-React-2 / commits / 5c56b873ef

Update React Native shims to use export syntax (#31426)

## Summary I'm working to get the main `react-native` package parsable by modern Flow tooling (both `flow-bundler`, `flow-api-translator`), and one blocker is legacy `module.exports` syntax. This diff updates files which are [synced to `react-native`](https://github.com/facebook/react-native/tree/main/packages/react-native/Libraries/Renderer/shims) from this repo. ## How did you test this change? Files were pasted into `react-native-github` under fbsource, where Flow validates ✅.

Alex Hunt committed Nov 7, 2024 at 14:53 UTC 5c56b873efb300b4d1afc4ba6f16acf17e4e5800
4 files changed +6 -6
scripts/rollup/shims/react-native/ReactFabric.js
+2 -2
@@ -15,7 +15,7 @@ import {BatchedBridge} from 'react-native/Libraries/ReactPrivate/ReactNativePriv
15
16 import type {ReactFabricType} from './ReactNativeTypes';
17
18 -let ReactFabric;
18 +let ReactFabric: ReactFabricType;
19
20 if (__DEV__) {
21 ReactFabric = require('../implementations/ReactFabric-dev');
@@ -29,4 +29,4 @@ if (global.RN$Bridgeless !== true) {
29 BatchedBridge.registerCallableModule('ReactFabric', ReactFabric);
30 }
31
32 -module.exports = (ReactFabric: ReactFabricType);
32 +export default ReactFabric;
scripts/rollup/shims/react-native/ReactFeatureFlags.js
+1 -1
@@ -15,4 +15,4 @@ const ReactFeatureFlags = {
15 debugRenderPhaseSideEffects: false,
16 };
17
18 -module.exports = ReactFeatureFlags;
18 +export default ReactFeatureFlags;
scripts/rollup/shims/react-native/ReactNative.js
+2 -2
@@ -12,7 +12,7 @@
12
13 import type {ReactNativeType} from './ReactNativeTypes';
14
15 -let ReactNative;
15 +let ReactNative: ReactNativeType;
16
17 if (__DEV__) {
18 ReactNative = require('../implementations/ReactNativeRenderer-dev');
@@ -20,4 +20,4 @@ if (__DEV__) {
20 ReactNative = require('../implementations/ReactNativeRenderer-prod');
21 }
22
23 -module.exports = (ReactNative: ReactNativeType);
23 +export default ReactNative;
scripts/rollup/shims/react-native/createReactNativeComponentClass.js
+1 -1
@@ -31,4 +31,4 @@ const createReactNativeComponentClass = function (
31 return register(name, callback);
32 };
33
34 -module.exports = createReactNativeComponentClass;
34 +export default createReactNativeComponentClass;