Skip to content

Commit 05521ad

Browse files
andrewdacenkofacebook-github-bot
authored andcommitted
Add react/featureflags (facebook#52003)
Summary: Pull Request resolved: facebook#52003 Changelog: [Internal] This is a react common dep check that we can build and run tester. Reviewed By: christophpurrer Differential Revision: D76531041 fbshipit-source-id: 0a43fdb91aa61f7e6461ff8a94ea6e2732b55dbb
1 parent cf6569b commit 05521ad

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

private/react-native-fantom/tester/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ add_react_third_party_ndk_subdir(folly)
3737

3838
# Common targets
3939
add_react_common_subdir(yoga)
40+
add_react_common_subdir(react/featureflags)
4041

4142
file(GLOB SOURCES "src/*.cpp" "src/*.h")
4243
add_executable(fantom_tester ${SOURCES})
@@ -48,6 +49,7 @@ target_link_libraries(fantom_tester
4849
double-conversion
4950
fast_float
5051
folly_runtime
52+
react_featureflags
5153
yogacore)
5254

5355
target_compile_options(fantom_tester

private/react-native-fantom/tester/build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@ cmake -S "$SCRIPT_DIR" -B "$BUILD_DIR" \
1515
-DREACT_COMMON_DIR="${REACT_NATIVE_ROOT_DIR}/ReactCommon"
1616

1717
cmake --build "$BUILD_DIR" --target fantom_tester
18+
19+
while getopts ":r" opt; do
20+
case $opt in
21+
r) "$BUILD_DIR/fantom_tester" ;;
22+
\?) echo "Invalid option: -$OPTARG"; exit 1;;
23+
esac
24+
done

private/react-native-fantom/tester/src/main.cpp

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,38 @@
66
*/
77

88
#include <glog/logging.h>
9+
#include <react/featureflags/ReactNativeFeatureFlags.h>
10+
#include <react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h>
911
#include <yoga/YGEnums.h>
1012
#include <yoga/YGValue.h>
1113
#include <format>
1214
#include <iostream>
15+
#include <memory>
1316

14-
int main() {
15-
google::InitGoogleLogging("fantom_tester");
17+
using namespace facebook::react;
18+
19+
static void setUpLogging() {
20+
google::InitGoogleLogging("react-native-fantom");
1621
FLAGS_logtostderr = true;
22+
}
1723

18-
LOG(INFO) << "Hello, I am fantom_tester using glog!";
24+
static void setUpFeatureFlags() {
25+
folly::dynamic dynamicFeatureFlags = folly::dynamic::object();
26+
27+
dynamicFeatureFlags["enableBridgelessArchitecture"] = true;
28+
dynamicFeatureFlags["cxxNativeAnimatedEnabled"] = true;
1929

30+
ReactNativeFeatureFlags::override(
31+
std::make_unique<ReactNativeFeatureFlagsDynamicProvider>(
32+
dynamicFeatureFlags));
33+
}
34+
35+
int main() {
36+
setUpLogging();
37+
38+
setUpFeatureFlags();
39+
40+
LOG(INFO) << "Hello, I am fantom_tester using glog!";
2041
LOG(INFO) << std::format(
2142
"[Yoga] undefined == zero: {}", YGValueZero == YGValueUndefined);
2243

0 commit comments

Comments
 (0)