Skip to content

Commit 3d44a6a

Browse files
Brian Vaughnbvaughn
authored andcommitted
Improved stack/fiber type-check to avoid false negative match when inst._rootNodeID is 0
1 parent 51733c9 commit 3d44a6a

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/renderers/native/ReactNativeComponentTree.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ function getInstanceFromTag(tag) {
6161

6262
function getTagFromInstance(inst) {
6363
// TODO (bvaughn) Clean up once Stack is deprecated
64-
var tag = inst._rootNodeID || inst.stateNode._nativeTag;
64+
var tag = typeof inst.tag !== 'number'
65+
? inst._rootNodeID
66+
: inst.stateNode._nativeTag;
6567
invariant(tag, 'All native instances should have a tag.');
6668
return tag;
6769
}

src/renderers/native/ReactNativeGlobalResponderHandler.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ var ReactNativeGlobalResponderHandler = {
1616
onChange: function(from, to, blockNativeResponder) {
1717
if (to !== null) {
1818
// TODO (bvaughn) Clean up once Stack is deprecated
19-
UIManager.setJSResponder(
20-
to._rootNodeID || to.stateNode._nativeTag,
21-
blockNativeResponder
22-
);
19+
var tag = typeof to.tag !== 'number'
20+
? to._rootNodeID
21+
: to.stateNode._nativeTag;
22+
UIManager.setJSResponder(tag, blockNativeResponder);
2323
} else {
2424
UIManager.clearJSResponder();
2525
}

0 commit comments

Comments
 (0)