Compare commits

...

1 Commits

Author SHA1 Message Date
Dan Abramov
497aac2a66 [Fabric] Clear host instance fields 2021-11-04 18:14:03 +00:00

View File

@@ -125,28 +125,32 @@ class ReactFabricHostComponent {
}
blur() {
TextInputState.blurTextInput(this);
if (this._internalInstanceHandle != null) {
TextInputState.blurTextInput(this);
}
}
focus() {
TextInputState.focusTextInput(this);
if (this._internalInstanceHandle != null) {
TextInputState.focusTextInput(this);
}
}
measure(callback: MeasureOnSuccessCallback) {
const {stateNode} = this._internalInstanceHandle;
if (stateNode != null) {
const fiber = this._internalInstanceHandle;
if (fiber != null && fiber.stateNode != null) {
fabricMeasure(
stateNode.node,
fiber.stateNode.node,
mountSafeCallback_NOT_REALLY_SAFE(this, callback),
);
}
}
measureInWindow(callback: MeasureInWindowOnSuccessCallback) {
const {stateNode} = this._internalInstanceHandle;
if (stateNode != null) {
const fiber = this._internalInstanceHandle;
if (fiber != null && fiber.stateNode != null) {
fabricMeasureInWindow(
stateNode.node,
fiber.stateNode.node,
mountSafeCallback_NOT_REALLY_SAFE(this, callback),
);
}
@@ -169,7 +173,12 @@ class ReactFabricHostComponent {
return;
}
if (
this._internalInstanceHandle == null ||
relativeToNativeNode._internalInstanceHandle == null
) {
return;
}
const toStateNode = this._internalInstanceHandle.stateNode;
const fromStateNode =
relativeToNativeNode._internalInstanceHandle.stateNode;
@@ -522,6 +531,8 @@ export function preparePortalMount(portalInstance: Instance): void {
// noop
}
export function detachDeletedInstance(node: Instance): void {
// noop
export function detachDeletedInstance(instance: Instance): void {
const canonical = instance.canonical;
canonical.currentProps = null;
canonical._internalInstanceHandle = null;
}