Add ability to dynamically extend the layout inspector sidebar

Summary: This adds the ability to extend the layout inspector's sidebar via SidebarExtensions

Reviewed By: sjkirby

Differential Revision: D8677332

fbshipit-source-id: 1880d5d2185306290a278e8a48e965ad94b98cc0
This commit is contained in:
Hilal Alsibai
2018-07-03 16:25:25 -07:00
committed by Facebook Github Bot
parent f0bf61881e
commit 44f561a683
2 changed files with 12 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
/**
* Copyright 2018-present Facebook.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
* @format
*/
export default [];

View File

@@ -12,6 +12,7 @@ import ManagedDataInspector from '../data-inspector/ManagedDataInspector.js';
import {Component} from 'react';
import {Console} from '../console';
import {GK} from 'sonar';
import SidebarExtensions from '../../../fb-stubs/LayoutInspectorSidebarExtensions.js';
const deepEqual = require('deep-equal');
@@ -109,7 +110,10 @@ export class InspectorSidebar extends Component<Props, State> {
return null;
}
const sections = [];
const sections = SidebarExtensions.map(ext =>
ext(this.props.client, element.id),
);
for (const key in element.data) {
sections.push(
<InspectorSidebarSection