Skip to content

Commit

Permalink
Use IsNativeControlWithSelfLayout in ReplaceView (#10394)
Browse files Browse the repository at this point in the history
* Use `IsNativeControlWithSelfLayout` in ReplaceView

Since we strictly speaking don't need to reset the self measure func
when swapping out a native view, we can just use the
`IsNativeControlWithSelfLayout` check.

* Change files
  • Loading branch information
rozele committed Sep 12, 2022
1 parent c767e45 commit 87c0e9d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Use `IsNativeControlWithSelfLayout` in ReplaceView",
"packageName": "react-native-windows",
"email": "erozell@outlook.com",
"dependentChangeType": "patch"
}
3 changes: 1 addition & 2 deletions vnext/Microsoft.ReactNative/Modules/NativeUIManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -850,8 +850,7 @@ void NativeUIManager::ReplaceView(ShadowNode &shadowNode) {
if (it != m_tagsToYogaNodes.end()) {
YGNodeRef yogaNode = it->second.get();

YGMeasureFunc func = pViewManager->GetYogaCustomMeasureFunc();
if (func != nullptr) {
if (pViewManager->IsNativeControlWithSelfLayout()) {
auto context = std::make_unique<YogaContext>(node.GetView());
YGNodeSetContext(yogaNode, reinterpret_cast<void *>(context.get()));

Expand Down

0 comments on commit 87c0e9d

Please sign in to comment.