diff --git a/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp b/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp index b52841fb8ea322..df3c9ada438899 100644 --- a/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp +++ b/packages/react-native/ReactCommon/react/renderer/scheduler/Scheduler.cpp @@ -139,6 +139,14 @@ Scheduler::Scheduler( reduceDeleteCreateMutationLayoutAnimation_ = true; #endif +#ifdef ANDROID + CoreFeatures::enableMicrotasks = + reactNativeConfig_->getBool("react_fabric:enable_microtasks_android"); +#else + CoreFeatures::enableMicrotasks = + reactNativeConfig_->getBool("react_fabric:enable_microtasks_ios"); +#endif + CoreFeatures::blockPaintForUseLayoutEffect = reactNativeConfig_->getBool( "react_fabric:block_paint_for_use_layout_effect"); diff --git a/packages/react-native/ReactCommon/react/runtime/hermes/HermesInstance.cpp b/packages/react-native/ReactCommon/react/runtime/hermes/HermesInstance.cpp index 55efa0eb6b5bc6..d682224485af81 100644 --- a/packages/react-native/ReactCommon/react/runtime/hermes/HermesInstance.cpp +++ b/packages/react-native/ReactCommon/react/runtime/hermes/HermesInstance.cpp @@ -105,6 +105,17 @@ std::unique_ptr HermesInstance::createJSRuntime( auto heapSizeMB = heapSizeConfig > 0 ? static_cast<::hermes::vm::gcheapsize_t>(heapSizeConfig) : 3072; + +#ifdef ANDROID + bool enableMicrotasks = reactNativeConfig + ? reactNativeConfig->getBool("react_fabric:enable_microtasks_android") + : false; +#else + bool enableMicrotasks = reactNativeConfig + ? reactNativeConfig->getBool("react_fabric:enable_microtasks_ios") + : false; +#endif + ::hermes::vm::RuntimeConfig::Builder runtimeConfigBuilder = ::hermes::vm::RuntimeConfig::Builder() .withGCConfig(::hermes::vm::GCConfig::Builder() @@ -119,6 +130,7 @@ std::unique_ptr HermesInstance::createJSRuntime( .build()) .withES6Proxy(false) .withEnableSampleProfiling(true) + .withMicrotaskQueue(enableMicrotasks) .withVMExperimentFlags(vmExperimentFlags); if (cm) {