Skip to content

Commit 48de2f6

Browse files
committed
Update RN dynamic flag types
1 parent aaa4acb commit 48de2f6

File tree

3 files changed

+7
-17
lines changed

3 files changed

+7
-17
lines changed

packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
* @flow strict
88
*/
99

10-
import typeof * as ExportsType from './ReactFeatureFlags.native-fb-dynamic';
11-
import typeof * as DynamicFlagsType from 'ReactNativeInternalFeatureFlags';
12-
1310
// In xplat, these flags are controlled by GKs. Because most GKs have some
1411
// population running in either mode, we should run our tests that way, too,
1512
//
@@ -18,14 +15,11 @@ import typeof * as DynamicFlagsType from 'ReactNativeInternalFeatureFlags';
1815
//
1916
// TODO: __VARIANT__ isn't supported for React Native flags yet. You can set the
2017
// flag here but it won't be set to `true` in any of our test runs. Need to
21-
// update the test configuration.
18+
// add a test configuration for React Native.
2219

2320
export const alwaysThrottleRetries = __VARIANT__;
2421
export const enableComponentStackLocations = __VARIANT__;
2522
export const enableDeferRootSchedulingToMicrotask = __VARIANT__;
2623
export const enableUseRefAccessWarning = __VARIANT__;
2724
export const passChildrenWhenCloningPersistedNodes = __VARIANT__;
2825
export const useMicrotasksForSchedulingInFabric = __VARIANT__;
29-
30-
// Flow magic to verify the exports of this file match the original version.
31-
((((null: any): ExportsType): DynamicFlagsType): ExportsType);

packages/shared/forks/ReactFeatureFlags.native-fb.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99

1010
import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags';
1111
import typeof * as ExportsType from './ReactFeatureFlags.native-fb';
12+
import typeof * as DynamicExportsType from './ReactFeatureFlags.native-fb-dynamic';
1213

13-
// NOTE: There are no flags, currently. Uncomment the stuff below if we add one.
14-
// Re-export dynamic flags from the internal module. Intentionally using *
15-
// because this import is compiled to a `require` call.
16-
import * as dynamicFlags from 'ReactNativeInternalFeatureFlags';
14+
// Re-export dynamic flags from the internal module.
15+
// Intentionally using * because this import is compiled to a `require` call.
16+
import * as dynamicFlagsUntyped from 'ReactNativeInternalFeatureFlags';
17+
const dynamicFlags: DynamicExportsType = (dynamicFlagsUntyped: any);
1718

1819
// We destructure each value before re-exporting to avoid a dynamic look-up on
1920
// the exports object every time a flag is read.

scripts/flow/xplat.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,5 @@
88
*/
99

1010
declare module 'ReactNativeInternalFeatureFlags' {
11-
declare export var alwaysThrottleRetries: boolean;
12-
declare export var enableComponentStackLocations: boolean;
13-
declare export var enableDeferRootSchedulingToMicrotask: boolean;
14-
declare export var enableUseRefAccessWarning: boolean;
15-
declare export var passChildrenWhenCloningPersistedNodes: boolean;
16-
declare export var useMicrotasksForSchedulingInFabric: boolean;
11+
declare module.exports: any;
1712
}

0 commit comments

Comments
 (0)