mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Updated ReactNative findNodeHandle() to handle number case (#9238)
This commit is contained in:
committed by
Dan Abramov
parent
700894a202
commit
07a963a5f4
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user