[Native] If statement cleanup for null targets (#17346)

This commit is contained in:
Eli White 2019-11-11 12:58:30 -08:00 committed by GitHub
parent 3dcec3a925
commit ade764157f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 8 deletions

View File

@ -43,11 +43,9 @@ export function dispatchEvent(
);
}
let eventTarget;
let eventTarget = null;
if (enableNativeTargetAsInstance) {
if (targetFiber == null) {
eventTarget = null;
} else {
if (targetFiber != null) {
eventTarget = targetFiber.stateNode.canonical;
}
} else {

View File

@ -100,11 +100,9 @@ function _receiveRootNodeIDEvent(
const nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT;
const inst = getInstanceFromNode(rootNodeID);
let target;
let target = null;
if (enableNativeTargetAsInstance) {
if (inst == null) {
target = null;
} else {
if (inst != null) {
target = inst.stateNode;
}
} else {