mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Replace usage of FabricUIManager methods with NativeDOM methods where available (#51341)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51341 Changelog: [internal] `measure`, `measureInWindow` and `measureLayout` have been defined in the `NativeDOM` C++ TurboModule for a while, but we didn't migrate the callsites in the DOM APIs to use them. This does that migration so we can remove a few `$FlowFixMe`s and use a cleaner API. Reviewed By: javache Differential Revision: D74800814 fbshipit-source-id: 117e4a8798036f2266e25cfc0931e91c148eaf52
This commit is contained in:
committed by
Facebook GitHub Bot
parent
f4c9df5b38
commit
f49083db69
@@ -153,18 +153,14 @@ class ReactNativeElement extends ReadOnlyElement implements NativeMethods {
|
||||
measure(callback: MeasureOnSuccessCallback) {
|
||||
const node = getNativeElementReference(this);
|
||||
if (node != null) {
|
||||
// $FlowExpectedError[incompatible-type] This is an element instance so the native node reference is always a shadow node.
|
||||
const shadowNode: ShadowNode = node;
|
||||
nullthrows(getFabricUIManager()).measure(shadowNode, callback);
|
||||
NativeDOM.measure(node, callback);
|
||||
}
|
||||
}
|
||||
|
||||
measureInWindow(callback: MeasureInWindowOnSuccessCallback) {
|
||||
const node = getNativeElementReference(this);
|
||||
if (node != null) {
|
||||
// $FlowExpectedError[incompatible-type] This is an element instance so the native node reference is always a shadow node.
|
||||
const shadowNode: ShadowNode = node;
|
||||
nullthrows(getFabricUIManager()).measureInWindow(shadowNode, callback);
|
||||
NativeDOM.measureInWindow(node, callback);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,14 +183,9 @@ class ReactNativeElement extends ReadOnlyElement implements NativeMethods {
|
||||
const fromStateNode = getNativeElementReference(relativeToNativeNode);
|
||||
|
||||
if (toStateNode != null && fromStateNode != null) {
|
||||
// $FlowExpectedError[incompatible-type] This is an element instance so the native node reference is always a shadow node.
|
||||
const toStateShadowNode: ShadowNode = toStateNode;
|
||||
// $FlowExpectedError[incompatible-type] This is an element instance so the native node reference is always a shadow node.
|
||||
const fromStateShadowNode: ShadowNode = fromStateNode;
|
||||
|
||||
nullthrows(getFabricUIManager()).measureLayout(
|
||||
toStateShadowNode,
|
||||
fromStateShadowNode,
|
||||
NativeDOM.measureLayout(
|
||||
toStateNode,
|
||||
fromStateNode,
|
||||
onFail != null ? onFail : noop,
|
||||
onSuccess != null ? onSuccess : noop,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user