Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Switch SearchBar and ChromeScopes Proptypes to flow props (#4092)
Browse files Browse the repository at this point in the history
  • Loading branch information
inyigo authored and jasonLaster committed Sep 21, 2017
1 parent 9f5f634 commit 303e994
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
37 changes: 19 additions & 18 deletions src/components/Editor/SearchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import type {
} from "../../reducers/ui";
import type { SelectSourceOptions } from "../../actions/sources";
import SearchInput from "../shared/SearchInput";
import "./SearchBar.css";

function getShortcuts() {
const searchAgainKey = L10N.getStr("sourceSearch.search.again.key2");
Expand All @@ -49,28 +50,28 @@ type SearchBarState = {
index: number
};

import "./SearchBar.css";
type Props = {
editor?: SourceEditor,
selectSource: (string, ?SelectSourceOptions) => any,
selectedSource?: SourceRecord,
highlightLineRange: ({ start: number, end: number }) => void,
clearHighlightLineRange: () => void,
searchOn?: boolean,
setActiveSearch: (?ActiveSearchType) => any,
searchResults: SearchResults,
modifiers: FileSearchModifiers,
toggleFileSearchModifier: string => any,
query: string,
setFileSearchQuery: string => any,
updateSearchResults: ({ count: number, index?: number }) => any
};

class SearchBar extends Component {
state: SearchBarState;

props: {
editor?: SourceEditor,
selectSource: (string, ?SelectSourceOptions) => any,
selectedSource?: SourceRecord,
highlightLineRange: ({ start: number, end: number }) => void,
clearHighlightLineRange: () => void,
searchOn?: boolean,
setActiveSearch: (?ActiveSearchType) => any,
searchResults: SearchResults,
modifiers: FileSearchModifiers,
toggleFileSearchModifier: string => any,
query: string,
setFileSearchQuery: string => any,
updateSearchResults: ({ count: number, index?: number }) => any
};
props: Props;

constructor(props) {
constructor(props: Props) {
super(props);
this.state = {
selectedResultIndex: 0,
Expand Down Expand Up @@ -132,7 +133,7 @@ class SearchBar extends Component {
shortcuts.on(searchAgainShortcut, (_, e) => this.traverseResults(e, false));
}

componentDidUpdate(prevProps: any, prevState: any) {
componentDidUpdate(prevProps: Props, prevState: SearchBarState) {
const searchInput = this.searchInput();

if (searchInput) {
Expand Down
17 changes: 8 additions & 9 deletions src/components/SecondaryPanes/ChromeScopes.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// @flow
import React, { PropTypes, Component } from "react";
import ImPropTypes from "react-immutable-proptypes";
import React, { Component } from "react";
import { bindActionCreators } from "redux";
import { connect } from "react-redux";
import classnames from "classnames";

import actions from "../../actions";
import type { Scope, Pause } from "debugger-html";
import { getChromeScopes, getLoadedObjects, getPause } from "../../selectors";
import Svg from "../shared/Svg";
import ManagedTree from "../shared/ManagedTree";
Expand All @@ -32,6 +32,12 @@ function createNode(name, path, contents) {
}

class Scopes extends Component {
props: {
scopes: Array<Scope>,
loadedObjects: Map<string, any>,
loadObjectProperties: Object => void,
pauseInfo: Pause
};
objectCache: Object;
getChildren: Function;
onExpand: Function;
Expand Down Expand Up @@ -194,13 +200,6 @@ class Scopes extends Component {
}
}

Scopes.propTypes = {
scopes: PropTypes.array,
loadedObjects: ImPropTypes.map,
loadObjectProperties: PropTypes.func,
pauseInfo: PropTypes.object
};

Scopes.displayName = "Scopes";

export default connect(
Expand Down

0 comments on commit 303e994

Please sign in to comment.