Skip to content

Commit 93c438d

Browse files
sahrensfacebook-github-bot
authored andcommitted
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
1 parent 46d6766 commit 93c438d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Libraries/Renderer/src/renderers/native/ReactNativeStack.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ var ReactNative = {
3737
// The injected findNodeHandle() strategy returns the instance wrapper though.
3838
// See NativeMethodsMixin#setNativeProps for more info on why this is done.
3939
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();
4145
},
4246

4347
render: render,

0 commit comments

Comments
 (0)