Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dynamic flags to React Native #21291

Merged
merged 2 commits into from
Apr 15, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/shared/forks/ReactFeatureFlags.native-fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

import typeof * as FeatureFlagsType from 'shared/ReactFeatureFlags';
import typeof * as ExportsType from './ReactFeatureFlags.native-fb';
import * as DynamicFeatureFlags from './ReactFeatureFlags.www-dynamic';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a new file specific to RN, like './ReactFeatureFlags.native-fb-dynamic'.

Then you need to setup Jest to route to the correct file, like we do for www:

jest.mock(
'ReactFeatureFlags',
() => jest.requireActual('shared/forks/ReactFeatureFlags.www-dynamic'),
{virtual: true}
);

The trouble is that we don't have an RN specific test run. Could you move all our RN tests into their own Jest project, like we do for DevTools? That's the direction we're headed, where each renderer has its own project. Like how the yarn flow command works.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right - I'm just going to hardcode the setting to false for now then to unblock and come back to this while working out how this flag works in www


// Re-export dynamic flags.
const dynamicFeatureFlags: DynamicFeatureFlags = require('ReactFeatureFlags');
export const {enableSyncDefaultUpdates} = dynamicFeatureFlags;

// The rest of the flags are static for better dead code elimination.
export const enableDebugTracing = false;
Expand Down Expand Up @@ -60,7 +65,6 @@ export const enableUseRefAccessWarning = false;
export const enableRecursiveCommitTraversal = false;
export const disableSchedulerTimeoutInWorkLoop = false;
export const enableLazyContextPropagation = false;
export const enableSyncDefaultUpdates = true;

// Flow magic to verify the exports of this file match the original version.
// eslint-disable-next-line no-unused-vars
Expand Down