mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 22:50:10 +08:00
Expose first implementation of the legacy method UIManager.measureInWindow on Fabric
Summary: This diff exposes the Legacy method UIManager.measureInWindow as part of Fabric Reviewed By: shergin Differential Revision: D15110795 fbshipit-source-id: 2b4bf47452f7272fd3edc4e580e65ae7ec2f2622
This commit is contained in:
committed by
Facebook Github Bot
parent
1d65244376
commit
5200ea8a1a
@@ -350,6 +350,33 @@ jsi::Value UIManagerBinding::get(
|
||||
});
|
||||
}
|
||||
|
||||
if (methodName == "measureInWindow") {
|
||||
return jsi::Function::createFromHostFunction(
|
||||
runtime,
|
||||
name,
|
||||
2,
|
||||
[&uiManager](
|
||||
jsi::Runtime &runtime,
|
||||
const jsi::Value &thisValue,
|
||||
const jsi::Value *arguments,
|
||||
size_t count) -> jsi::Value {
|
||||
auto layoutMetrics = uiManager.getRelativeLayoutMetrics(
|
||||
*shadowNodeFromValue(runtime, arguments[0]), nullptr);
|
||||
|
||||
auto onSuccessFunction =
|
||||
arguments[1].getObject(runtime).getFunction(runtime);
|
||||
auto frame = layoutMetrics.frame;
|
||||
|
||||
onSuccessFunction.call(
|
||||
runtime,
|
||||
{jsi::Value{runtime, (double)frame.origin.x},
|
||||
jsi::Value{runtime, (double)frame.origin.y},
|
||||
jsi::Value{runtime, (double)frame.size.width},
|
||||
jsi::Value{runtime, (double)frame.size.height}});
|
||||
return jsi::Value::undefined();
|
||||
});
|
||||
}
|
||||
|
||||
if (methodName == "setNativeProps") {
|
||||
return jsi::Function::createFromHostFunction(
|
||||
runtime,
|
||||
|
||||
Reference in New Issue
Block a user