Skip to content

Commit

Permalink
Fix nodeHandle crash
Browse files Browse the repository at this point in the history
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 93c438d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Libraries/Renderer/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 93c438d

Please sign in to comment.