InspectorPanel -> Delete PropTypes (#21392)

Summary:
Related to #21342
Pull Request resolved: https://github.com/facebook/react-native/pull/21392

Reviewed By: TheSavior

Differential Revision: D10129812

Pulled By: RSNara

fbshipit-source-id: 79e900b56eb043452ce8e13e998a9ad8d4443897
This commit is contained in:
Dishant Kaushik 2018-10-01 14:22:09 -07:00 committed by Facebook Github Bot
parent 80066db654
commit c8705330d7
1 changed files with 41 additions and 19 deletions

View File

@ -14,14 +14,43 @@ const ElementProperties = require('ElementProperties');
const NetworkOverlay = require('NetworkOverlay');
const PerformanceOverlay = require('PerformanceOverlay');
const React = require('React');
const PropTypes = require('prop-types');
const ScrollView = require('ScrollView');
const StyleSheet = require('StyleSheet');
const Text = require('Text');
const TouchableHighlight = require('TouchableHighlight');
const View = require('View');
class InspectorPanel extends React.Component<$FlowFixMeProps> {
import type {ViewStyleProp} from 'StyleSheet';
type Props = $ReadOnly<{|
devtoolsIsOpen?: ?boolean,
inspecting: boolean,
setInspecting: (val: boolean) => void,
perfing: boolean,
setPerfing: (val: boolean) => void,
touchTargeting?: ?boolean,
setTouchTargeting?: ?(val: boolean) => void,
networking?: ?boolean,
setNetworking?: ?(val: boolean) => void,
hierarchy?: any,
selection: number,
setSelection: number => mixed,
inspected?: ?{|
style?: ?ViewStyleProp,
frame?: ?{|
top?: ?number,
left?: ?number,
width?: ?number,
height: ?number,
|},
source?: ?{|
fileName?: string,
lineNumber?: number,
|},
|},
|}>;
class InspectorPanel extends React.Component<Props> {
renderWaiting() {
if (this.props.inspecting) {
return (
@ -57,22 +86,22 @@ class InspectorPanel extends React.Component<$FlowFixMeProps> {
<View style={styles.container}>
{!this.props.devtoolsIsOpen && contents}
<View style={styles.buttonRow}>
<Button
<InspectorPanelButton
title={'Inspect'}
pressed={this.props.inspecting}
onClick={this.props.setInspecting}
/>
<Button
<InspectorPanelButton
title={'Perf'}
pressed={this.props.perfing}
onClick={this.props.setPerfing}
/>
<Button
<InspectorPanelButton
title={'Network'}
pressed={this.props.networking}
onClick={this.props.setNetworking}
/>
<Button
<InspectorPanelButton
title={'Touchables'}
pressed={this.props.touchTargeting}
onClick={this.props.setTouchTargeting}
@ -83,20 +112,13 @@ class InspectorPanel extends React.Component<$FlowFixMeProps> {
}
}
InspectorPanel.propTypes = {
devtoolsIsOpen: PropTypes.bool,
inspecting: PropTypes.bool,
setInspecting: PropTypes.func,
inspected: PropTypes.object,
perfing: PropTypes.bool,
setPerfing: PropTypes.func,
touchTargeting: PropTypes.bool,
setTouchTargeting: PropTypes.func,
networking: PropTypes.bool,
setNetworking: PropTypes.func,
};
type InspectorPanelButtonProps = $ReadOnly<{|
onClick: (val: boolean) => void,
pressed?: ?boolean,
title?: ?string,
|}>;
class Button extends React.Component<$FlowFixMeProps> {
class InspectorPanelButton extends React.Component<InspectorPanelButtonProps> {
render() {
return (
<TouchableHighlight