add feature flag to enable explicit yoga node cleaning in TextInput (#43913)

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

changelog: [internal]

We have this turned on in ParagraphShadowNode, let's roll it out for TextInput as well.

I came across this while profiling scroll performance when TextInput is part of the view hierarchy.

Reviewed By: javache

Differential Revision: D55751341

fbshipit-source-id: 2af20ddb5a4fb9b0ccd33217e60e8b9e8a95b920
This commit is contained in:
Samuel Susla
2024-04-06 05:09:54 -07:00
committed by Facebook GitHub Bot
parent 0e4aed1061
commit 35d5754b36
23 changed files with 177 additions and 30 deletions
@@ -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<<074ec00cfb1585c529df9391492c21e4>>
* @generated SignedSource<<cc44495e0b264e2d56e155a164a774e7>>
*/
/**
@@ -46,6 +46,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enableBackgroundExecutor(): Boolean = accessor.enableBackgroundExecutor()
/**
* Clean yoga node when <TextInput /> does not change.
*/
@JvmStatic
public fun enableCleanTextInputYogaNode(): Boolean = accessor.enableCleanTextInputYogaNode()
/**
* When enabled, Fabric will use customDrawOrder in ReactViewGroup (similar to old architecture).
*/
@@ -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<<c4038f6f8d4c7f9ead85e45f8d989e69>>
* @generated SignedSource<<99c459dce42767a7da84810fbceea73e>>
*/
/**
@@ -23,6 +23,7 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
private var commonTestFlagCache: Boolean? = null
private var batchRenderingUpdatesInEventLoopCache: Boolean? = null
private var enableBackgroundExecutorCache: Boolean? = null
private var enableCleanTextInputYogaNodeCache: Boolean? = null
private var enableCustomDrawOrderFabricCache: Boolean? = null
private var enableFixForClippedSubviewsCrashCache: Boolean? = null
private var enableMicrotasksCache: Boolean? = null
@@ -62,6 +63,15 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}
override fun enableCleanTextInputYogaNode(): Boolean {
var cached = enableCleanTextInputYogaNodeCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableCleanTextInputYogaNode()
enableCleanTextInputYogaNodeCache = cached
}
return cached
}
override fun enableCustomDrawOrderFabric(): Boolean {
var cached = enableCustomDrawOrderFabricCache
if (cached == null) {
@@ -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<<490e64811f966f5e8399ed835db6b846>>
* @generated SignedSource<<e3a1a041fc9d4f8ea504d064ea01607a>>
*/
/**
@@ -34,6 +34,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
@DoNotStrip @JvmStatic public external fun enableBackgroundExecutor(): Boolean
@DoNotStrip @JvmStatic public external fun enableCleanTextInputYogaNode(): Boolean
@DoNotStrip @JvmStatic public external fun enableCustomDrawOrderFabric(): Boolean
@DoNotStrip @JvmStatic public external fun enableFixForClippedSubviewsCrash(): Boolean
@@ -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<<0e0913ae19c39f88c2e2536c2b5087e1>>
* @generated SignedSource<<cc645d933e253361d5933f56501a35e9>>
*/
/**
@@ -29,6 +29,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun enableBackgroundExecutor(): Boolean = false
override fun enableCleanTextInputYogaNode(): Boolean = false
override fun enableCustomDrawOrderFabric(): Boolean = false
override fun enableFixForClippedSubviewsCrash(): Boolean = false
@@ -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<<4d92852851feacdbf9d4f3c4ead3124a>>
* @generated SignedSource<<dc699311bdbebb8db4ee313611d192b5>>
*/
/**
@@ -27,6 +27,7 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
private var commonTestFlagCache: Boolean? = null
private var batchRenderingUpdatesInEventLoopCache: Boolean? = null
private var enableBackgroundExecutorCache: Boolean? = null
private var enableCleanTextInputYogaNodeCache: Boolean? = null
private var enableCustomDrawOrderFabricCache: Boolean? = null
private var enableFixForClippedSubviewsCrashCache: Boolean? = null
private var enableMicrotasksCache: Boolean? = null
@@ -69,6 +70,16 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun enableCleanTextInputYogaNode(): Boolean {
var cached = enableCleanTextInputYogaNodeCache
if (cached == null) {
cached = currentProvider.enableCleanTextInputYogaNode()
accessedFeatureFlags.add("enableCleanTextInputYogaNode")
enableCleanTextInputYogaNodeCache = cached
}
return cached
}
override fun enableCustomDrawOrderFabric(): Boolean {
var cached = enableCustomDrawOrderFabricCache
if (cached == null) {
@@ -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<<f68e85831f9af20785ff0cbf431a4dc5>>
* @generated SignedSource<<51dd25e88ebf2ac9929c477e710d3d8d>>
*/
/**
@@ -29,6 +29,8 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun enableBackgroundExecutor(): Boolean
@DoNotStrip public fun enableCleanTextInputYogaNode(): Boolean
@DoNotStrip public fun enableCustomDrawOrderFabric(): Boolean
@DoNotStrip public fun enableFixForClippedSubviewsCrash(): Boolean
@@ -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<<a04c3da47e634d788d6edb24fac0bf02>>
* @generated SignedSource<<ade99ab28f82affa77445231caed9e9d>>
*/
/**
@@ -57,6 +57,12 @@ class ReactNativeFeatureFlagsProviderHolder
return method(javaProvider_);
}
bool enableCleanTextInputYogaNode() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableCleanTextInputYogaNode");
return method(javaProvider_);
}
bool enableCustomDrawOrderFabric() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableCustomDrawOrderFabric");
@@ -142,6 +148,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableBackgroundExecutor(
return ReactNativeFeatureFlags::enableBackgroundExecutor();
}
bool JReactNativeFeatureFlagsCxxInterop::enableCleanTextInputYogaNode(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableCleanTextInputYogaNode();
}
bool JReactNativeFeatureFlagsCxxInterop::enableCustomDrawOrderFabric(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableCustomDrawOrderFabric();
@@ -223,6 +234,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enableBackgroundExecutor",
JReactNativeFeatureFlagsCxxInterop::enableBackgroundExecutor),
makeNativeMethod(
"enableCleanTextInputYogaNode",
JReactNativeFeatureFlagsCxxInterop::enableCleanTextInputYogaNode),
makeNativeMethod(
"enableCustomDrawOrderFabric",
JReactNativeFeatureFlagsCxxInterop::enableCustomDrawOrderFabric),
@@ -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<<b0b829e8b839a5f39837867e92925c61>>
* @generated SignedSource<<ca2e44ed44d1ba779bb4ac49d795299f>>
*/
/**
@@ -39,6 +39,9 @@ class JReactNativeFeatureFlagsCxxInterop
static bool enableBackgroundExecutor(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableCleanTextInputYogaNode(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableCustomDrawOrderFabric(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
@@ -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<<05aace8ad7171ff940f014643e050ff0>>
* @generated SignedSource<<f1a871bce940e7558363902e56a1ed5e>>
*/
/**
@@ -33,6 +33,10 @@ bool ReactNativeFeatureFlags::enableBackgroundExecutor() {
return getAccessor().enableBackgroundExecutor();
}
bool ReactNativeFeatureFlags::enableCleanTextInputYogaNode() {
return getAccessor().enableCleanTextInputYogaNode();
}
bool ReactNativeFeatureFlags::enableCustomDrawOrderFabric() {
return getAccessor().enableCustomDrawOrderFabric();
}
@@ -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<<730c667fb34f911b92318c26cfa32cf5>>
* @generated SignedSource<<881b149aca14f4f73e45e02089787a88>>
*/
/**
@@ -52,6 +52,11 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool enableBackgroundExecutor();
/**
* Clean yoga node when <TextInput /> does not change.
*/
RN_EXPORT static bool enableCleanTextInputYogaNode();
/**
* When enabled, Fabric will use customDrawOrder in ReactViewGroup (similar to old architecture).
*/
@@ -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<<c91ec1127cfd0ad95c861008be5711bf>>
* @generated SignedSource<<a6f3bb8f6215eb4178483add1df7c626>>
*/
/**
@@ -83,6 +83,24 @@ bool ReactNativeFeatureFlagsAccessor::enableBackgroundExecutor() {
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::enableCleanTextInputYogaNode() {
auto flagValue = enableCleanTextInputYogaNode_.load();
if (!flagValue.has_value()) {
// This block is not exclusive but it is not necessary.
// If multiple threads try to initialize the feature flag, we would only
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(3, "enableCleanTextInputYogaNode");
flagValue = currentProvider_->enableCleanTextInputYogaNode();
enableCleanTextInputYogaNode_ = flagValue;
}
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::enableCustomDrawOrderFabric() {
auto flagValue = enableCustomDrawOrderFabric_.load();
@@ -92,7 +110,7 @@ bool ReactNativeFeatureFlagsAccessor::enableCustomDrawOrderFabric() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(3, "enableCustomDrawOrderFabric");
markFlagAsAccessed(4, "enableCustomDrawOrderFabric");
flagValue = currentProvider_->enableCustomDrawOrderFabric();
enableCustomDrawOrderFabric_ = flagValue;
@@ -110,7 +128,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFixForClippedSubviewsCrash() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(4, "enableFixForClippedSubviewsCrash");
markFlagAsAccessed(5, "enableFixForClippedSubviewsCrash");
flagValue = currentProvider_->enableFixForClippedSubviewsCrash();
enableFixForClippedSubviewsCrash_ = flagValue;
@@ -128,7 +146,7 @@ bool ReactNativeFeatureFlagsAccessor::enableMicrotasks() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(5, "enableMicrotasks");
markFlagAsAccessed(6, "enableMicrotasks");
flagValue = currentProvider_->enableMicrotasks();
enableMicrotasks_ = flagValue;
@@ -146,7 +164,7 @@ bool ReactNativeFeatureFlagsAccessor::enableMountHooksAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(6, "enableMountHooksAndroid");
markFlagAsAccessed(7, "enableMountHooksAndroid");
flagValue = currentProvider_->enableMountHooksAndroid();
enableMountHooksAndroid_ = flagValue;
@@ -164,7 +182,7 @@ bool ReactNativeFeatureFlagsAccessor::enableSpannableBuildingUnification() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(7, "enableSpannableBuildingUnification");
markFlagAsAccessed(8, "enableSpannableBuildingUnification");
flagValue = currentProvider_->enableSpannableBuildingUnification();
enableSpannableBuildingUnification_ = flagValue;
@@ -182,7 +200,7 @@ bool ReactNativeFeatureFlagsAccessor::enableSynchronousStateUpdates() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(8, "enableSynchronousStateUpdates");
markFlagAsAccessed(9, "enableSynchronousStateUpdates");
flagValue = currentProvider_->enableSynchronousStateUpdates();
enableSynchronousStateUpdates_ = flagValue;
@@ -200,7 +218,7 @@ bool ReactNativeFeatureFlagsAccessor::enableUIConsistency() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(9, "enableUIConsistency");
markFlagAsAccessed(10, "enableUIConsistency");
flagValue = currentProvider_->enableUIConsistency();
enableUIConsistency_ = flagValue;
@@ -218,7 +236,7 @@ bool ReactNativeFeatureFlagsAccessor::inspectorEnableCxxInspectorPackagerConnect
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(10, "inspectorEnableCxxInspectorPackagerConnection");
markFlagAsAccessed(11, "inspectorEnableCxxInspectorPackagerConnection");
flagValue = currentProvider_->inspectorEnableCxxInspectorPackagerConnection();
inspectorEnableCxxInspectorPackagerConnection_ = flagValue;
@@ -236,7 +254,7 @@ bool ReactNativeFeatureFlagsAccessor::inspectorEnableModernCDPRegistry() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(11, "inspectorEnableModernCDPRegistry");
markFlagAsAccessed(12, "inspectorEnableModernCDPRegistry");
flagValue = currentProvider_->inspectorEnableModernCDPRegistry();
inspectorEnableModernCDPRegistry_ = flagValue;
@@ -254,7 +272,7 @@ bool ReactNativeFeatureFlagsAccessor::useModernRuntimeScheduler() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(12, "useModernRuntimeScheduler");
markFlagAsAccessed(13, "useModernRuntimeScheduler");
flagValue = currentProvider_->useModernRuntimeScheduler();
useModernRuntimeScheduler_ = flagValue;
@@ -272,7 +290,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(13, "useNativeViewConfigsInBridgelessMode");
markFlagAsAccessed(14, "useNativeViewConfigsInBridgelessMode");
flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode();
useNativeViewConfigsInBridgelessMode_ = flagValue;
@@ -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<<d0ed3514b47846bb1ceb69aa6a3c94fe>>
* @generated SignedSource<<48b454c264577c4e85eb6b9b46d5d2c5>>
*/
/**
@@ -34,6 +34,7 @@ class ReactNativeFeatureFlagsAccessor {
bool commonTestFlag();
bool batchRenderingUpdatesInEventLoop();
bool enableBackgroundExecutor();
bool enableCleanTextInputYogaNode();
bool enableCustomDrawOrderFabric();
bool enableFixForClippedSubviewsCrash();
bool enableMicrotasks();
@@ -55,11 +56,12 @@ class ReactNativeFeatureFlagsAccessor {
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
bool wasOverridden_;
std::array<std::atomic<const char*>, 14> accessedFeatureFlags_;
std::array<std::atomic<const char*>, 15> accessedFeatureFlags_;
std::atomic<std::optional<bool>> commonTestFlag_;
std::atomic<std::optional<bool>> batchRenderingUpdatesInEventLoop_;
std::atomic<std::optional<bool>> enableBackgroundExecutor_;
std::atomic<std::optional<bool>> enableCleanTextInputYogaNode_;
std::atomic<std::optional<bool>> enableCustomDrawOrderFabric_;
std::atomic<std::optional<bool>> enableFixForClippedSubviewsCrash_;
std::atomic<std::optional<bool>> enableMicrotasks_;
@@ -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<<82ad92aa5bd70e278b4c2aceb2cb4859>>
* @generated SignedSource<<6b07d06ca1f100cca35e2b8b108f1993>>
*/
/**
@@ -39,6 +39,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
return false;
}
bool enableCleanTextInputYogaNode() override {
return false;
}
bool enableCustomDrawOrderFabric() override {
return false;
}
@@ -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<<388fefb77dab0a5229417412d4f4a21c>>
* @generated SignedSource<<633090e21068e67cff5aa9b0d4f9e323>>
*/
/**
@@ -28,6 +28,7 @@ class ReactNativeFeatureFlagsProvider {
virtual bool commonTestFlag() = 0;
virtual bool batchRenderingUpdatesInEventLoop() = 0;
virtual bool enableBackgroundExecutor() = 0;
virtual bool enableCleanTextInputYogaNode() = 0;
virtual bool enableCustomDrawOrderFabric() = 0;
virtual bool enableFixForClippedSubviewsCrash() = 0;
virtual bool enableMicrotasks() = 0;
@@ -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<<2c451878b4abdfd143fdc00f3a8f1159>>
* @generated SignedSource<<8b20f7b7385c91e54cd385d6af54691b>>
*/
/**
@@ -52,6 +52,11 @@ bool NativeReactNativeFeatureFlags::enableBackgroundExecutor(
return ReactNativeFeatureFlags::enableBackgroundExecutor();
}
bool NativeReactNativeFeatureFlags::enableCleanTextInputYogaNode(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableCleanTextInputYogaNode();
}
bool NativeReactNativeFeatureFlags::enableCustomDrawOrderFabric(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableCustomDrawOrderFabric();
@@ -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<<deb1d977999fc23ef8f72630001808b2>>
* @generated SignedSource<<0dcfc928ff0eca1cb37766170d9b4379>>
*/
/**
@@ -41,6 +41,8 @@ class NativeReactNativeFeatureFlags
bool enableBackgroundExecutor(jsi::Runtime& runtime);
bool enableCleanTextInputYogaNode(jsi::Runtime& runtime);
bool enableCustomDrawOrderFabric(jsi::Runtime& runtime);
bool enableFixForClippedSubviewsCrash(jsi::Runtime& runtime);
@@ -9,6 +9,7 @@
#include <fbjni/fbjni.h>
#include <react/debug/react_native_assert.h>
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/jni/ReadableNativeMap.h>
#include <react/renderer/attributedstring/AttributedStringBox.h>
#include <react/renderer/attributedstring/TextAttributes.h>
@@ -26,6 +27,24 @@ namespace facebook::react {
extern const char AndroidTextInputComponentName[] = "AndroidTextInput";
AndroidTextInputShadowNode::AndroidTextInputShadowNode(
const ShadowNode& sourceShadowNode,
const ShadowNodeFragment& fragment)
: ConcreteViewShadowNode(sourceShadowNode, fragment) {
auto& sourceTextInputShadowNode =
static_cast<const AndroidTextInputShadowNode&>(sourceShadowNode);
if (ReactNativeFeatureFlags::enableCleanTextInputYogaNode()) {
if (!fragment.children && !fragment.props &&
sourceTextInputShadowNode.getIsLayoutClean()) {
// This ParagraphShadowNode was cloned but did not change
// in a way that affects its layout. Let's mark it clean
// to stop Yoga from traversing it.
cleanLayout();
}
}
}
void AndroidTextInputShadowNode::setContextContainer(
ContextContainer* contextContainer) {
ensureUnsealed();
@@ -37,6 +37,10 @@ class AndroidTextInputShadowNode final : public ConcreteViewShadowNode<
using ConcreteViewShadowNode::ConcreteViewShadowNode;
AndroidTextInputShadowNode(
const ShadowNode& sourceShadowNode,
const ShadowNodeFragment& fragment);
void setContextContainer(ContextContainer* contextContainer);
/*
@@ -8,6 +8,7 @@
#include "TextInputShadowNode.h"
#include <react/debug/react_native_assert.h>
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/renderer/attributedstring/AttributedStringBox.h>
#include <react/renderer/attributedstring/TextAttributes.h>
#include <react/renderer/core/LayoutConstraints.h>
@@ -19,6 +20,24 @@ namespace facebook::react {
extern const char TextInputComponentName[] = "TextInput";
TextInputShadowNode::TextInputShadowNode(
const ShadowNode& sourceShadowNode,
const ShadowNodeFragment& fragment)
: ConcreteViewShadowNode(sourceShadowNode, fragment) {
auto& sourceTextInputShadowNode =
static_cast<const TextInputShadowNode&>(sourceShadowNode);
if (ReactNativeFeatureFlags::enableCleanTextInputYogaNode()) {
if (!fragment.children && !fragment.props &&
sourceTextInputShadowNode.getIsLayoutClean()) {
// This ParagraphShadowNode was cloned but did not change
// in a way that affects its layout. Let's mark it clean
// to stop Yoga from traversing it.
cleanLayout();
}
}
}
AttributedStringBox TextInputShadowNode::attributedStringBoxToMeasure(
const LayoutContext& layoutContext) const {
bool hasMeaningfulState =
@@ -32,6 +32,10 @@ class TextInputShadowNode final : public ConcreteViewShadowNode<
public:
using ConcreteViewShadowNode::ConcreteViewShadowNode;
TextInputShadowNode(
const ShadowNode& sourceShadowNode,
const ShadowNodeFragment& fragment);
static ShadowNodeTraits BaseTraits() {
auto traits = ConcreteViewShadowNode::BaseTraits();
traits.set(ShadowNodeTraits::Trait::LeafYogaNode);
@@ -42,6 +42,10 @@ const definitions: FeatureFlagDefinitions = {
description:
'Enables the use of a background executor to compute layout and commit updates on Fabric (this system is deprecated and should not be used).',
},
enableCleanTextInputYogaNode: {
defaultValue: false,
description: 'Clean yoga node when <TextInput /> does not change.',
},
enableCustomDrawOrderFabric: {
defaultValue: false,
description:
@@ -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<<1d670e4e74d58e40c3e5c9dba2ceb560>>
* @generated SignedSource<<ee6090277aad4b98818b1a3ecb913a23>>
* @flow strict-local
*/
@@ -43,6 +43,7 @@ export type ReactNativeFeatureFlags = {
commonTestFlag: Getter<boolean>,
batchRenderingUpdatesInEventLoop: Getter<boolean>,
enableBackgroundExecutor: Getter<boolean>,
enableCleanTextInputYogaNode: Getter<boolean>,
enableCustomDrawOrderFabric: Getter<boolean>,
enableFixForClippedSubviewsCrash: Getter<boolean>,
enableMicrotasks: Getter<boolean>,
@@ -108,6 +109,10 @@ export const batchRenderingUpdatesInEventLoop: Getter<boolean> = createNativeFla
* Enables the use of a background executor to compute layout and commit updates on Fabric (this system is deprecated and should not be used).
*/
export const enableBackgroundExecutor: Getter<boolean> = createNativeFlagGetter('enableBackgroundExecutor', false);
/**
* Clean yoga node when <TextInput /> does not change.
*/
export const enableCleanTextInputYogaNode: Getter<boolean> = createNativeFlagGetter('enableCleanTextInputYogaNode', false);
/**
* When enabled, Fabric will use customDrawOrder in ReactViewGroup (similar to old architecture).
*/
@@ -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<<d2b677b2a67f597ba4d38625a752e180>>
* @generated SignedSource<<9e0489da8f2a77565018ee983f7fae7e>>
* @flow strict-local
*/
@@ -26,6 +26,7 @@ export interface Spec extends TurboModule {
+commonTestFlag?: () => boolean;
+batchRenderingUpdatesInEventLoop?: () => boolean;
+enableBackgroundExecutor?: () => boolean;
+enableCleanTextInputYogaNode?: () => boolean;
+enableCustomDrawOrderFabric?: () => boolean;
+enableFixForClippedSubviewsCrash?: () => boolean;
+enableMicrotasks?: () => boolean;