Skip to content
Permalink
Browse files

Fix issue #21065 getInspectorDataForViewTag is not a function (#21237)

Summary:
Fix renderer.getInspectorDataForViewTag is not a function when try Toggle Inspector

Fixes #21065

Release Notes:
--------------
[BUGFIX] [MINOR] [/react-native/Libraries/Inspector/Inspector.js]
Pull Request resolved: #21237

Differential Revision: D13838339

Pulled By: cpojer

fbshipit-source-id: 363a4beba211e7868395578c7941cbda119bc753
  • Loading branch information...
TranLuongTuanAnh authored and facebook-github-bot committed Jan 28, 2019
1 parent 90850ca commit 46f3285a3f240f9325a548e677a1927402d76bd7
Showing with 10 additions and 4 deletions.
  1. +10 −4 Libraries/Inspector/Inspector.js
@@ -47,14 +47,20 @@ function findRenderers(): $ReadOnlyArray<ReactRenderer> {
function getInspectorDataForViewTag(touchedViewTag: number) {
for (let i = 0; i < renderers.length; i++) {
const renderer = renderers[i];
const inspectorData = renderer.getInspectorDataForViewTag(touchedViewTag);
if (inspectorData.hierarchy.length > 0) {
return inspectorData;
if (
Object.prototype.hasOwnProperty.call(
renderer,
'getInspectorDataForViewTag',
)
) {
const inspectorData = renderer.getInspectorDataForViewTag(touchedViewTag);
if (inspectorData.hierarchy.length > 0) {
return inspectorData;
}
}
}
throw new Error('Expected to find at least one React renderer.');
}

class Inspector extends React.Component<
{
inspectedViewTag: ?number,

0 comments on commit 46f3285

Please sign in to comment.
You can’t perform that action at this time.