mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Backward-compatible behaviour of measureInWindow and measure
Summary: Before this change, in case of incorrect measurements, Fabric's implementation of `measure` and `measureInWindow` incorrectly returned negative height and width. Now it returns zeros (as classic React Native does). Fabric: This does not fix `measureLayout` called for virtual nodes. This is not so trivially to fix and it will be done separately. Changelog: [Internal] Fabric-specific internal change. Reviewed By: JoshuaGross, yungsters, mdvacca Differential Revision: D21433239 fbshipit-source-id: fbaf5ee35c690506822c634daac4426542c2cdcf
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d14b89bd8a
commit
fa5b4c9e0c
@@ -535,10 +535,15 @@ jsi::Value UIManagerBinding::get(
|
||||
*shadowNodeFromValue(runtime, arguments[0]),
|
||||
nullptr,
|
||||
{/* .includeTransform = */ true});
|
||||
auto frame = layoutMetrics.frame;
|
||||
auto onSuccessFunction =
|
||||
arguments[1].getObject(runtime).getFunction(runtime);
|
||||
|
||||
if (layoutMetrics == EmptyLayoutMetrics) {
|
||||
onSuccessFunction.call(runtime, {0, 0, 0, 0, 0, 0});
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
|
||||
auto frame = layoutMetrics.frame;
|
||||
onSuccessFunction.call(
|
||||
runtime,
|
||||
{0,
|
||||
@@ -568,8 +573,13 @@ jsi::Value UIManagerBinding::get(
|
||||
|
||||
auto onSuccessFunction =
|
||||
arguments[1].getObject(runtime).getFunction(runtime);
|
||||
auto frame = layoutMetrics.frame;
|
||||
|
||||
if (layoutMetrics == EmptyLayoutMetrics) {
|
||||
onSuccessFunction.call(runtime, {0, 0, 0, 0});
|
||||
return jsi::Value::undefined();
|
||||
}
|
||||
|
||||
auto frame = layoutMetrics.frame;
|
||||
onSuccessFunction.call(
|
||||
runtime,
|
||||
{jsi::Value{runtime, (double)frame.origin.x},
|
||||
|
||||
Reference in New Issue
Block a user