Skip to content

Commit

Permalink
Update RN dynamic flag types
Browse files Browse the repository at this point in the history
  • Loading branch information
rickhanlonii committed Feb 23, 2024
1 parent aaa4acb commit 48de2f6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
8 changes: 1 addition & 7 deletions packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
* @flow strict
*/

import typeof * as ExportsType from './ReactFeatureFlags.native-fb-dynamic';
import typeof * as DynamicFlagsType from 'ReactNativeInternalFeatureFlags';

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

export const alwaysThrottleRetries = __VARIANT__;
export const enableComponentStackLocations = __VARIANT__;
export const enableDeferRootSchedulingToMicrotask = __VARIANT__;
export const enableUseRefAccessWarning = __VARIANT__;
export const passChildrenWhenCloningPersistedNodes = __VARIANT__;
export const useMicrotasksForSchedulingInFabric = __VARIANT__;

// Flow magic to verify the exports of this file match the original version.
((((null: any): ExportsType): DynamicFlagsType): ExportsType);
9 changes: 5 additions & 4 deletions packages/shared/forks/ReactFeatureFlags.native-fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@

import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags';
import typeof * as ExportsType from './ReactFeatureFlags.native-fb';
import typeof * as DynamicExportsType from './ReactFeatureFlags.native-fb-dynamic';

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

// We destructure each value before re-exporting to avoid a dynamic look-up on
// the exports object every time a flag is read.
Expand Down
7 changes: 1 addition & 6 deletions scripts/flow/xplat.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,5 @@
*/

declare module 'ReactNativeInternalFeatureFlags' {
declare export var alwaysThrottleRetries: boolean;
declare export var enableComponentStackLocations: boolean;
declare export var enableDeferRootSchedulingToMicrotask: boolean;
declare export var enableUseRefAccessWarning: boolean;
declare export var passChildrenWhenCloningPersistedNodes: boolean;
declare export var useMicrotasksForSchedulingInFabric: boolean;
declare module.exports: any;
}

0 comments on commit 48de2f6

Please sign in to comment.