@samitouri / QOS-React-2 / commits / ade764157f

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

Eli White committed Nov 11, 2019 at 12:58 UTC ade764157ff7ff27ab11ed8b61791a7edef8e683
2 files changed +4 -8
packages/react-native-renderer/src/ReactFabricEventEmitter.js
+2 -4
@@ -43,11 +43,9 @@ export function dispatchEvent(
43 );
44 }
45
46 - let eventTarget;
46 + let eventTarget = null;
47 if (enableNativeTargetAsInstance) {
48 - if (targetFiber == null) {
49 - eventTarget = null;
50 - } else {
48 + if (targetFiber != null) {
49 eventTarget = targetFiber.stateNode.canonical;
50 }
51 } else {
packages/react-native-renderer/src/ReactNativeEventEmitter.js
+2 -4
@@ -100,11 +100,9 @@ function _receiveRootNodeIDEvent(
100 const nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT;
101 const inst = getInstanceFromNode(rootNodeID);
102
103 - let target;
103 + let target = null;
104 if (enableNativeTargetAsInstance) {
105 - if (inst == null) {
106 - target = null;
107 - } else {
105 + if (inst != null) {
106 target = inst.stateNode;
107 }
108 } else {