From d818626910c5fb06e8a2d58dbe283b217dc6ccb5 Mon Sep 17 00:00:00 2001 From: Dishant Kaushik Date: Fri, 28 Sep 2018 00:15:54 -0400 Subject: [PATCH 1/7] InspectorPanel -> Delete PropTypes --- Libraries/Inspector/InspectorPanel.js | 37 +++++++++++++++++++-------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/Libraries/Inspector/InspectorPanel.js b/Libraries/Inspector/InspectorPanel.js index 9e309bacc0d457..1331e2e6e7c940 100644 --- a/Libraries/Inspector/InspectorPanel.js +++ b/Libraries/Inspector/InspectorPanel.js @@ -21,7 +21,24 @@ const Text = require('Text'); const TouchableHighlight = require('TouchableHighlight'); const View = require('View'); -class InspectorPanel extends React.Component<$FlowFixMeProps> { +import type {ViewProps} from 'ViewPropTypes'; +// Will add this once I get params for the functions +// import type {SyntheticEvent} from 'CoreEventTypes'; + +type Props = $ReadOnly<{| + ...ViewProps, + devtoolsIsOpen?: ?boolean, + inspecting?: ?boolean, + setInspecting?: ?Function, + perfing?: ?boolean, + setPerfing?: ?Function, + touchTargeting?: ?boolean, + setTouchTargeting?: ?Function, + networking?: ?boolean, + setNetworking?: ?Function, +|}>; + +class InspectorPanel extends React.Component { renderWaiting() { if (this.props.inspecting) { return ( @@ -84,19 +101,17 @@ 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, }; -class Button extends React.Component<$FlowFixMeProps> { +type ButtonProps = $ReadOnly<{| + ...ViewProps, + onClick?: ?Function, + pressed?: ?boolean, + title?: ?string, +|}>; + +class Button extends React.Component { render() { return ( Date: Fri, 28 Sep 2018 21:13:48 -0400 Subject: [PATCH 2/7] removed imports that were not required. added suitable function params and return types. Thanks to @RSNara --- Libraries/Inspector/InspectorPanel.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/Libraries/Inspector/InspectorPanel.js b/Libraries/Inspector/InspectorPanel.js index 1331e2e6e7c940..93b783312d4d56 100644 --- a/Libraries/Inspector/InspectorPanel.js +++ b/Libraries/Inspector/InspectorPanel.js @@ -21,21 +21,16 @@ const Text = require('Text'); const TouchableHighlight = require('TouchableHighlight'); const View = require('View'); -import type {ViewProps} from 'ViewPropTypes'; -// Will add this once I get params for the functions -// import type {SyntheticEvent} from 'CoreEventTypes'; - type Props = $ReadOnly<{| - ...ViewProps, devtoolsIsOpen?: ?boolean, inspecting?: ?boolean, - setInspecting?: ?Function, + setInspecting?: ?(val: boolean) => void, perfing?: ?boolean, - setPerfing?: ?Function, + setPerfing?: ?(val: boolean) => void, touchTargeting?: ?boolean, - setTouchTargeting?: ?Function, + setTouchTargeting?: ?(val: boolean) => void, networking?: ?boolean, - setNetworking?: ?Function, + setNetworking?: ?(val: boolean) => void, |}>; class InspectorPanel extends React.Component { @@ -104,14 +99,13 @@ InspectorPanel.propTypes = { inspected: PropTypes.object, }; -type ButtonProps = $ReadOnly<{| - ...ViewProps, +type InspectorPanelButtonProps = $ReadOnly<{| onClick?: ?Function, pressed?: ?boolean, title?: ?string, |}>; -class Button extends React.Component { +class Button extends React.Component { render() { return ( Date: Fri, 28 Sep 2018 21:19:36 -0400 Subject: [PATCH 3/7] renamed Button inside InspectorPanel to InspectorPanelButton --- Libraries/Inspector/InspectorPanel.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Libraries/Inspector/InspectorPanel.js b/Libraries/Inspector/InspectorPanel.js index 93b783312d4d56..058f61c6a73274 100644 --- a/Libraries/Inspector/InspectorPanel.js +++ b/Libraries/Inspector/InspectorPanel.js @@ -69,22 +69,22 @@ class InspectorPanel extends React.Component { {!this.props.devtoolsIsOpen && contents} -