Skip to content

Commit bb1853f

Browse files
committed
[Native] If statement cleanup for null targets (#17346)
1 parent a9d9fc7 commit bb1853f

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

packages/react-native-renderer/src/ReactFabricEventEmitter.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,9 @@ export function dispatchEvent(
4343
);
4444
}
4545

46-
let eventTarget;
46+
let eventTarget = null;
4747
if (enableNativeTargetAsInstance) {
48-
if (targetFiber == null) {
49-
eventTarget = null;
50-
} else {
48+
if (targetFiber != null) {
5149
eventTarget = targetFiber.stateNode.canonical;
5250
}
5351
} else {

packages/react-native-renderer/src/ReactNativeEventEmitter.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,9 @@ function _receiveRootNodeIDEvent(
100100
const nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT;
101101
const inst = getInstanceFromNode(rootNodeID);
102102

103-
let target;
103+
let target = null;
104104
if (enableNativeTargetAsInstance) {
105-
if (inst == null) {
106-
target = null;
107-
} else {
105+
if (inst != null) {
108106
target = inst.stateNode;
109107
}
110108
} else {

0 commit comments

Comments
 (0)