Files
react-native/packages
Rubén NorteandFacebook GitHub Bot db70b791ba Add ReactNativeFeatureFlagsDynamicProvider to allow configuration in C++ using dynamic values (#48093)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48093

Changelog: [internal]

We're going to add support for specifying feature flags in Fantom tests in pragmas. E.g.:

```
/**
 * fantom_flags commonTestFlag:true
 */
```

Users will be able to specify any feature flags in their tests, so we need a way to pass that information from the test file to the runner, and the runner has to be able to apply this dynamic configuration.

Because the API is statically typed in C++, we need to define a method for every possible feature flag configurable through this API. We could do it in userland, but we'd have to manually add a method every time there was a new feature flag we wanted to support.

Instead of doing that, this introduces a new abstraction in the feature flag system that codegens it for you.

The API is basically:

```
  folly::dynamic values = folly::dynamic::object();

  values["commonTestFlag"] = true;

  ReactNativeFeatureFlags::override(
      std::make_unique<ReactNativeFeatureFlagsDynamicProvider>(values));

  EXPECT_EQ(ReactNativeFeatureFlags::commonTestFlag(), true);
```

Then we can use this abstraction in Fantom to pass all the configured flags as `folly::dynamic` through this API.

Reviewed By: javache

Differential Revision: D66760118

fbshipit-source-id: c32329e5ca76923c3e0b9c0eb1fe8c3268e1f57b
2024-12-05 17:06:11 -08:00
..
2024-09-12 09:23:23 -07:00
2024-12-02 03:22:32 -08:00
2024-09-12 09:23:23 -07:00
2024-09-12 09:23:23 -07:00
2024-09-12 09:23:23 -07:00
2024-09-12 09:23:23 -07:00