-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FlowCleanup] InspectorPanel -> Delete PropTypes #21392
Changes from 1 commit
d818626
59c68f3
758c13a
d234739
15406ff
a8dd2fd
db5d2f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like the render method of |
||
devtoolsIsOpen?: ?boolean, | ||
inspecting?: ?boolean, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Circle CI errors indicate that we need to strict type it rather than
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the following work? if (value === true) {
// stuff
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. But these props can be either boolean or undefined. I don't know how to write for both?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm... There's only one use of
Lets make the |
||
setInspecting?: ?Function, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unclear type. Using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be: setInspecting?: ?(val: boolean) => void There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. edit: never mind this, missed the custom button component There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @empyrical Hah! You made the same mistake I did. :P More of a reason to rename |
||
perfing?: ?boolean, | ||
setPerfing?: ?Function, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unclear type. Using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be: setPerfing?: ?(val: boolean) => void |
||
touchTargeting?: ?boolean, | ||
setTouchTargeting?: ?Function, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unclear type. Using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be: setTouchTargeting?: ?(val: boolean) => void |
||
networking?: ?boolean, | ||
setNetworking?: ?Function, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unclear type. Using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be: setNetworking?: ?(val: boolean) => void |
||
|}>; | ||
|
||
class InspectorPanel extends React.Component<Props> { | ||
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<{| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Rename to |
||
...ViewProps, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unclear type. Using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need to spread |
||
onClick?: ?Function, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @RSNara I need a similar params/return type here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right. This should also take the same signature:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that I think about it more, a lot of these types are unnecessarily optional. For example, I think |
||
pressed?: ?boolean, | ||
title?: ?string, | ||
|}>; | ||
|
||
class Button extends React.Component<ButtonProps> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: Can we rename this component to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, got confused by that too. I think it would be worth renaming |
||
render() { | ||
return ( | ||
<TouchableHighlight | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid I don't follow these comments. Should they be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my instructions, I suggested that people could stub out functions types with
?Function
and ask for help getting the function signatures in their pull request if they needed help, and looks like you did just that here 👍