From ea5bc6bac122ac9e0b45b5200f1456d47801fa18 Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Fri, 14 Oct 2022 10:11:42 -0400 Subject: [PATCH] [React Native FB] dynamic feature flag for ref access warning (#25471) --- .../forks/ReactFeatureFlags.native-fb-dynamic.js | 12 ++++++------ packages/shared/forks/ReactFeatureFlags.native-fb.js | 5 ++--- scripts/flow/xplat.js | 1 + 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js b/packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js index 6e9aaacf0e158..d2fd9887aec5e 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb-dynamic.js @@ -7,10 +7,8 @@ * @flow strict */ -// NOTE: There are no flags, currently. Uncomment the stuff below if we add one. - -// import typeof * as ExportsType from './ReactFeatureFlags.native-fb-dynamic'; -// import typeof * as DynamicFlagsType from 'ReactNativeInternalFeatureFlags'; +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, @@ -22,5 +20,7 @@ // flag here but it won't be set to `true` in any of our test runs. Need to // update the test configuration. -// // Flow magic to verify the exports of this file match the original version. -// ((((null: any): ExportsType): FeatureFlagsType): ExportsType); +export const enableUseRefAccessWarning = __VARIANT__; + +// Flow magic to verify the exports of this file match the original version. +((((null: any): ExportsType): DynamicFlagsType): ExportsType); diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js index e81b1d3d37252..8fb6f5359c300 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js @@ -13,11 +13,11 @@ import typeof * as ExportsType from './ReactFeatureFlags.native-fb'; // 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'; +import * as dynamicFlags from 'ReactNativeInternalFeatureFlags'; // We destructure each value before re-exporting to avoid a dynamic look-up on // the exports object every time a flag is read. -// export const {} = dynamicFlags; +export const {enableUseRefAccessWarning} = dynamicFlags; // The rest of the flags are static for better dead code elimination. export const enableDebugTracing = false; @@ -67,7 +67,6 @@ export const deferRenderPhaseUpdateToNextBatch = false; export const enableStrictEffects = __DEV__; export const createRootStrictEffectsByDefault = false; -export const enableUseRefAccessWarning = false; export const disableSchedulerTimeoutInWorkLoop = false; export const enableLazyContextPropagation = false; diff --git a/scripts/flow/xplat.js b/scripts/flow/xplat.js index 45c12d2a6f607..99137729a902a 100644 --- a/scripts/flow/xplat.js +++ b/scripts/flow/xplat.js @@ -8,4 +8,5 @@ */ declare module 'ReactNativeInternalFeatureFlags' { + declare export var enableUseRefAccessWarning: boolean; }