Include native module for ReactNativeFeatureFlags by default in all apps using TurboModules (#42431)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42431

Changelog: [internal]

Reviewed By: dmytrorykun

Differential Revision: D52905704

fbshipit-source-id: df1a0ec71ba468d8352f2af92bf87b5175c0d72c
This commit is contained in:
Rubén Norte
2024-02-22 08:39:12 -08:00
committed by Facebook GitHub Bot
parent d979452d24
commit 71ee246183
8 changed files with 51 additions and 3 deletions
@@ -101,6 +101,7 @@ add_react_common_subdir(react/utils)
add_react_common_subdir(react/bridging)
add_react_common_subdir(react/renderer/mapbuffer)
add_react_common_subdir(react/nativemodule/core)
add_react_common_subdir(react/nativemodule/featureflags)
add_react_common_subdir(jserrorhandler)
add_react_common_subdir(react/runtime)
add_react_common_subdir(react/runtime/hermes)
@@ -21,4 +21,5 @@ target_link_libraries(react_newarchdefaults
react_nativemodule_core
react_codegen_rncore
react_cxxreactpackage
react_nativemodule_featureflags
jsi)
@@ -9,6 +9,7 @@
#include <algorithm>
#include <react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h>
#include <rncore.h>
namespace facebook::react {
@@ -67,8 +68,16 @@ std::shared_ptr<TurboModule> DefaultTurboModuleManagerDelegate::getTurboModule(
auto moduleProvider = DefaultTurboModuleManagerDelegate::cxxModuleProvider;
if (moduleProvider) {
return moduleProvider(name, jsInvoker);
auto module = moduleProvider(name, jsInvoker);
if (module) {
return module;
}
}
if (name == NativeReactNativeFeatureFlags::kModuleName) {
return std::make_shared<NativeReactNativeFeatureFlags>(jsInvoker);
}
return nullptr;
}
@@ -0,0 +1,25 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)
add_compile_options(
-fexceptions
-frtti
-std=c++20
-Wall
-Wpedantic
-DLOG_TAG=\"ReactNative\")
file(GLOB react_nativemodule_featureflags_SRC CONFIGURE_DEPENDS *.cpp)
add_library(react_nativemodule_featureflags SHARED ${react_nativemodule_featureflags_SRC})
target_include_directories(react_nativemodule_featureflags PUBLIC ${REACT_COMMON_DIR})
target_link_libraries(react_nativemodule_featureflags
react_featureflags
react_codegen_rncore
reactnative)
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<2466af777a1d69da2c3810e5a2d53a70>>
* @generated SignedSource<<003a5e1b1e52d504e9cd29583b475041>>
*/
/**
@@ -20,7 +20,9 @@
#include "NativeReactNativeFeatureFlags.h"
#include <react/featureflags/ReactNativeFeatureFlags.h>
#ifdef RN_DISABLE_OSS_PLUGIN_HEADER
#include "Plugins.h"
#endif
std::shared_ptr<facebook::react::TurboModule>
NativeReactNativeFeatureFlagsModuleProvider(
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<30481dc57cc7f389d1ed87d097caedda>>
* @generated SignedSource<<e3760a947742d471dc64dde3f719fb0b>>
*/
/**
@@ -19,7 +19,11 @@
#pragma once
#if __has_include("rncoreJSI.h") // Cmake headers on Android
#include "rncoreJSI.h"
#else
#include <FBReactNativeSpec/FBReactNativeSpecJSI.h>
#endif
namespace facebook::react {
@@ -28,7 +28,9 @@ ${DO_NOT_MODIFY_COMMENT}
#include "NativeReactNativeFeatureFlags.h"
#include <react/featureflags/ReactNativeFeatureFlags.h>
#ifdef RN_DISABLE_OSS_PLUGIN_HEADER
#include "Plugins.h"
#endif
std::shared_ptr<facebook::react::TurboModule>
NativeReactNativeFeatureFlagsModuleProvider(
@@ -27,7 +27,11 @@ ${DO_NOT_MODIFY_COMMENT}
#pragma once
#if __has_include("rncoreJSI.h") // Cmake headers on Android
#include "rncoreJSI.h"
#else
#include <FBReactNativeSpec/FBReactNativeSpecJSI.h>
#endif
namespace facebook::react {