Skip to content
This repository was archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
fix search button: get state from child
Browse files Browse the repository at this point in the history
  • Loading branch information
xuebingjie1990 committed Jan 1, 2022
1 parent 3788ec1 commit bda2478
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 9 additions & 2 deletions src/searchResult.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default class ResultsBed extends React.Component {
}

this.setState({ bedData: res });
this.props.setSearchingFalse()
this.props.setSearchingFalse(false);

if (res.length >= 50) {
this.setState({
Expand Down Expand Up @@ -295,7 +295,14 @@ export default class ResultsBed extends React.Component {
}}
/>
</div>
) : null
) : (<div>
<Spinner
animation="border"
size="sm"
style={{ marginRight: "5px", color: "lightgray" }}
/>
<p style={{ color: "lightgray" }}>Loading data </p>
</div>)
) : null;
}
}
8 changes: 6 additions & 2 deletions src/stringSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export default class Search extends React.Component {
});
}

setSearchingFalse(val) {
this.setState({ searching: val });
};

setSearchTerms(event) {
this.setState({
showResults: false,
Expand Down Expand Up @@ -74,7 +78,7 @@ export default class Search extends React.Component {
className="float-left"
style={{
marginRight: "10px",
width: "86%",
width: "84%",
height: "33px",
padding: "5px",
borderColor: "#ced4da",
Expand Down Expand Up @@ -115,7 +119,7 @@ export default class Search extends React.Component {
<ResultsBed
terms={this.state.searchTerms}
genome={this.state.genome}
setSearchingFalse={() => this.setState({ seaching: false })}
setSearchingFalse={this.setSearchingFalse.bind(this)}
/>
) : null}
</Container>
Expand Down

0 comments on commit bda2478

Please sign in to comment.