Skip to content

Commit

Permalink
Updated ReactNative findNodeHandle() to handle number case (#9238)
Browse files Browse the repository at this point in the history
  • Loading branch information
bvaughn authored Mar 23, 2017
1 parent b0b9f37 commit c8897f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/renderers/native/ReactNativeFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,10 @@ const ReactNative = {
// See NativeMethodsMixin#setNativeProps for more info on why this is done.
findNodeHandle(componentOrHandle: any): ?number {
const instance: any = findNodeHandle(componentOrHandle);
return instance ? instance._nativeTag : null;
if (instance == null || typeof instance === 'number') {
return instance;
}
return instance._nativeTag;
},

render(element: Element<any>, containerTag: any, callback: ?Function) {
Expand Down
6 changes: 5 additions & 1 deletion src/renderers/native/ReactNativeStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ var ReactNative = {
// The injected findNodeHandle() strategy returns the instance wrapper though.
// See NativeMethodsMixin#setNativeProps for more info on why this is done.
findNodeHandle(componentOrHandle: any): ?number {
return findNodeHandle(componentOrHandle).getHostNode();
const nodeHandle = findNodeHandle(componentOrHandle);
if (nodeHandle == null || typeof nodeHandle === 'number') {
return nodeHandle;
}
return nodeHandle.getHostNode();
},

render: render,
Expand Down

0 comments on commit c8897f8

Please sign in to comment.