[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*
|
|
|
|
* @providesModule Inspector
|
|
|
|
* @flow
|
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var Dimensions = require('Dimensions');
|
|
|
|
var InspectorOverlay = require('InspectorOverlay');
|
|
|
|
var InspectorPanel = require('InspectorPanel');
|
|
|
|
var InspectorUtils = require('InspectorUtils');
|
|
|
|
var React = require('React');
|
2016-04-08 02:43:49 +00:00
|
|
|
var ReactNative = require('ReactNative');
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
var StyleSheet = require('StyleSheet');
|
|
|
|
var UIManager = require('NativeModules').UIManager;
|
|
|
|
var View = require('View');
|
|
|
|
|
2015-07-23 23:56:23 +00:00
|
|
|
if (window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
2015-07-14 19:03:17 +00:00
|
|
|
// required for devtools to be able to edit react native styles
|
2015-07-23 23:56:23 +00:00
|
|
|
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.resolveRNStyle = require('flattenStyle');
|
2015-07-14 19:03:17 +00:00
|
|
|
}
|
|
|
|
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
class Inspector extends React.Component {
|
2015-07-14 19:03:17 +00:00
|
|
|
_subs: ?Array<() => void>;
|
|
|
|
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
constructor(props: Object) {
|
|
|
|
super(props);
|
2015-07-14 19:03:17 +00:00
|
|
|
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
this.state = {
|
2015-07-22 23:36:46 +00:00
|
|
|
devtoolsAgent: null,
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
panelPos: 'bottom',
|
|
|
|
inspecting: true,
|
2015-06-23 22:30:54 +00:00
|
|
|
perfing: false,
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
inspected: null,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2015-07-14 19:03:17 +00:00
|
|
|
componentDidMount() {
|
2015-07-23 23:56:23 +00:00
|
|
|
if (window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
2015-07-14 19:03:17 +00:00
|
|
|
this.attachToDevtools = this.attachToDevtools.bind(this);
|
2015-07-23 23:56:23 +00:00
|
|
|
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.on('react-devtools', this.attachToDevtools);
|
2015-07-14 19:03:17 +00:00
|
|
|
// if devtools is already started
|
2015-07-23 23:56:23 +00:00
|
|
|
if (window.__REACT_DEVTOOLS_GLOBAL_HOOK__.reactDevtoolsAgent) {
|
|
|
|
this.attachToDevtools(window.__REACT_DEVTOOLS_GLOBAL_HOOK__.reactDevtoolsAgent);
|
2015-07-14 19:03:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
if (this._subs) {
|
|
|
|
this._subs.map(fn => fn());
|
|
|
|
}
|
2015-07-23 23:56:23 +00:00
|
|
|
if (window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
|
|
|
|
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.off('react-devtools', this.attachToDevtools);
|
2015-07-14 19:03:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-22 23:36:46 +00:00
|
|
|
attachToDevtools(agent: Object) {
|
2015-07-14 19:03:17 +00:00
|
|
|
var _hideWait = null;
|
2015-07-22 23:36:46 +00:00
|
|
|
var hlSub = agent.sub('highlight', ({node, name, props}) => {
|
2015-07-14 19:03:17 +00:00
|
|
|
clearTimeout(_hideWait);
|
|
|
|
UIManager.measure(node, (x, y, width, height, left, top) => {
|
|
|
|
this.setState({
|
|
|
|
hierarchy: [],
|
|
|
|
inspected: {
|
|
|
|
frame: {left, top, width, height},
|
|
|
|
style: props ? props.style : {},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2015-07-22 23:36:46 +00:00
|
|
|
var hideSub = agent.sub('hideHighlight', () => {
|
|
|
|
if (this.state.inspected === null) {
|
|
|
|
return;
|
|
|
|
}
|
2015-07-14 19:03:17 +00:00
|
|
|
// we wait to actually hide in order to avoid flicker
|
|
|
|
_hideWait = setTimeout(() => {
|
|
|
|
this.setState({
|
|
|
|
inspected: null,
|
|
|
|
});
|
|
|
|
}, 100);
|
|
|
|
});
|
|
|
|
this._subs = [hlSub, hideSub];
|
|
|
|
|
2015-07-22 23:36:46 +00:00
|
|
|
agent.on('shutdown', () => {
|
|
|
|
this.setState({devtoolsAgent: null});
|
2015-07-14 19:03:17 +00:00
|
|
|
this._subs = null;
|
|
|
|
});
|
|
|
|
this.setState({
|
2015-07-22 23:36:46 +00:00
|
|
|
devtoolsAgent: agent,
|
2015-07-14 19:03:17 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
setSelection(i: number) {
|
|
|
|
var instance = this.state.hierarchy[i];
|
2015-12-08 18:09:16 +00:00
|
|
|
// if we inspect a stateless component we can't use the getPublicInstance method
|
|
|
|
// therefore we use the internal _instance property directly.
|
|
|
|
var publicInstance = instance._instance || {};
|
2016-04-08 02:43:49 +00:00
|
|
|
UIManager.measure(ReactNative.findNodeHandle(instance), (x, y, width, height, left, top) => {
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
this.setState({
|
|
|
|
inspected: {
|
|
|
|
frame: {left, top, width, height},
|
|
|
|
style: publicInstance.props ? publicInstance.props.style : {},
|
|
|
|
},
|
|
|
|
selection: i,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
onTouchInstance(instance: Object, frame: Object, pointerY: number) {
|
2015-07-22 23:36:46 +00:00
|
|
|
if (this.state.devtoolsAgent) {
|
|
|
|
this.state.devtoolsAgent.selectFromReactInstance(instance, true);
|
2015-07-14 19:03:17 +00:00
|
|
|
}
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
var hierarchy = InspectorUtils.getOwnerHierarchy(instance);
|
2015-12-08 18:09:16 +00:00
|
|
|
// if we inspect a stateless component we can't use the getPublicInstance method
|
|
|
|
// therefore we use the internal _instance property directly.
|
|
|
|
var publicInstance = instance._instance || {};
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
var props = publicInstance.props || {};
|
|
|
|
this.setState({
|
|
|
|
panelPos: pointerY > Dimensions.get('window').height / 2 ? 'top' : 'bottom',
|
|
|
|
selection: hierarchy.length - 1,
|
|
|
|
hierarchy,
|
|
|
|
inspected: {
|
|
|
|
style: props.style || {},
|
|
|
|
frame,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-06-23 22:30:54 +00:00
|
|
|
setPerfing(val: bool) {
|
|
|
|
this.setState({
|
|
|
|
perfing: val,
|
|
|
|
inspecting: false,
|
|
|
|
inspected: null,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
setInspecting(val: bool) {
|
|
|
|
this.setState({
|
|
|
|
inspecting: val,
|
2015-06-23 22:30:54 +00:00
|
|
|
inspected: null
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2015-06-18 12:42:45 +00:00
|
|
|
var panelContainerStyle = (this.state.panelPos === 'bottom') ? {bottom: 0} : {top: 0};
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
return (
|
2015-06-18 12:42:45 +00:00
|
|
|
<View style={styles.container} pointerEvents="box-none">
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
{this.state.inspecting &&
|
|
|
|
<InspectorOverlay
|
|
|
|
rootTag={this.props.rootTag}
|
|
|
|
inspected={this.state.inspected}
|
|
|
|
inspectedViewTag={this.props.inspectedViewTag}
|
|
|
|
onTouchInstance={this.onTouchInstance.bind(this)}
|
|
|
|
/>}
|
2015-06-18 12:42:45 +00:00
|
|
|
<View style={[styles.panelContainer, panelContainerStyle]}>
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
<InspectorPanel
|
2015-07-22 23:36:46 +00:00
|
|
|
devtoolsIsOpen={!!this.state.devtoolsAgent}
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
inspecting={this.state.inspecting}
|
2015-06-23 22:30:54 +00:00
|
|
|
perfing={this.state.perfing}
|
|
|
|
setPerfing={this.setPerfing.bind(this)}
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
setInspecting={this.setInspecting.bind(this)}
|
|
|
|
inspected={this.state.inspected}
|
|
|
|
hierarchy={this.state.hierarchy}
|
|
|
|
selection={this.state.selection}
|
|
|
|
setSelection={this.setSelection.bind(this)}
|
|
|
|
/>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var styles = StyleSheet.create({
|
|
|
|
container: {
|
|
|
|
position: 'absolute',
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
top: 0,
|
|
|
|
left: 0,
|
|
|
|
right: 0,
|
2015-06-18 12:42:45 +00:00
|
|
|
bottom: 0,
|
[ReactNative] refactor the inspector
Summary:
The `InspectorOverlay` component was getting unwieldy, so I broke it into three components:
- Inspector
- InspectorOverlay
- InspectorPanel
and added @flow types.
The inspector was also living under the `ReactIOS` directory, and I moved it
up into the `Libraries` directory, as the inspector will soon be usable [on
Android](https://phabricator.fb.com/D2138319).
All features of the inspector should remain functional, with the addition of
one feature:
- you can toggle "touch to inspect" by tapping the "Inspect" button at the
bottom of the inspection panel. When inspection is disabled, the panel remains, but you can interact with
the app normally without touches being intercepted
@public
Test Plan:
Open the inspector:
- touch to inspect things, verify that margin, padding, size and position are
reported correctly, and that the component hierarchy is navigable.
- tap the "Inspect" button, and verify that you can interact with the app
normally.
{F22548949}
[Video of toggling inspection](https://www.latest.facebook.com/pxlcld/mrs9)
2015-06-11 20:50:48 +00:00
|
|
|
},
|
|
|
|
panelContainer: {
|
|
|
|
position: 'absolute',
|
|
|
|
left: 0,
|
|
|
|
right: 0,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = Inspector;
|