Fabric: Using ShadowNodeTraits::Trait::MeasurableYogaNode in TextInput

Summary:
It is the correct way to deal with the measure function.

I believe it can fix the crash we see with TextInput state update. The crash is probably caused by invalid value of `shadowNodeRawPtr` in `YogaLayoutableShadowNode::yogaNodeCloneCallbackConnector`.
It's hard to reconstruct the full chain of events but I think it's related: Yoga's dirty flag influences cloning, so the improper setting of this flag can misalign "natural" ShadowNode cloning (influenced by changes in the tree) and YGNode-initiated cloning (triggered by layout process).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D25937710

fbshipit-source-id: a4e7c9dd8f5e6598fc662f4c6ee8061fd795e20d
This commit is contained in:
Valentin Shergin 2021-01-16 15:51:22 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 8684ef499f
Коммит 3d166a0a4c
2 изменённых файлов: 1 добавлений и 2 удалений

Просмотреть файл

@ -34,8 +34,6 @@ class TextInputComponentDescriptor final
std::static_pointer_cast<TextInputShadowNode>(shadowNode);
concreteShadowNode->setTextLayoutManager(textLayoutManager_);
concreteShadowNode->dirtyLayout();
concreteShadowNode->enableMeasurement();
}
private:

Просмотреть файл

@ -37,6 +37,7 @@ class TextInputShadowNode : public ConcreteViewShadowNode<
auto traits = ConcreteViewShadowNode::BaseTraits();
traits.set(ShadowNodeTraits::Trait::TextKind);
traits.set(ShadowNodeTraits::Trait::LeafYogaNode);
traits.set(ShadowNodeTraits::Trait::MeasurableYogaNode);
return traits;
}