Permalink
Browse files

Fix nodeHandle crash

Summary:
It's supposed to take a component or a handle, per the arg name, so switch on the type (and handle `null`).

`FlatListExample` no longer crashes.

Reviewed By: bvaughn, sebmarkbage

Differential Revision: D4752619

fbshipit-source-id: 720421f648f7c2049b5cc44f006484eb47d22d86
  • Loading branch information...
sahrens authored and facebook-github-bot committed Mar 22, 2017
1 parent 46d6766 commit 93c438d47078111f44aec69c8864b3a26f098842
Showing with 5 additions and 1 deletion.
  1. +5 −1 Libraries/Renderer/src/renderers/native/ReactNativeStack.js
@@ -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,

0 comments on commit 93c438d

Please sign in to comment.