Updated ReactNative findNodeHandle() to handle number case (#9238)
Brian Vaughn committed
Mar 23, 2017 at 08:16 UTC
c8897f8382f10ac390f8f7f4f15c8ffaeccb6a8c
2 files changed
+9
-2
src/renderers/native/ReactNativeFiber.js
+4
-1
@@ -382,7 +382,10 @@ const ReactNative = {
382
// See NativeMethodsMixin#setNativeProps for more info on why this is done.
383
findNodeHandle(componentOrHandle: any): ?number {
384
const instance: any = findNodeHandle(componentOrHandle);
385
- return instance ? instance._nativeTag : null;
385
+ if (instance == null || typeof instance === 'number') {
386
+ return instance;
387
+ }
388
+ return instance._nativeTag;
389
},
390
391
render(element: Element<any>, containerTag: any, callback: ?Function) {
src/renderers/native/ReactNativeStack.js
+5
-1
@@ -37,7 +37,11 @@ var ReactNative = {
37
// The injected findNodeHandle() strategy returns the instance wrapper though.
38
// See NativeMethodsMixin#setNativeProps for more info on why this is done.
39
findNodeHandle(componentOrHandle: any): ?number {
40
- return findNodeHandle(componentOrHandle).getHostNode();
40
+ const nodeHandle = findNodeHandle(componentOrHandle);
41
+ if (nodeHandle == null || typeof nodeHandle === 'number') {
42
+ return nodeHandle;
43
+ }
44
+ return nodeHandle.getHostNode();
45
},
46
47
render: render,