Updated ReactNative findNodeHandle() to handle number case (#9238)

This commit is contained in:
Brian Vaughn
2017-03-23 19:43:22 +00:00
committed by Dan Abramov
parent 700894a202
commit 07a963a5f4
2 changed files with 9 additions and 2 deletions
+4 -1
View File
@@ -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) {
+5 -1
View File
@@ -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,