RN-306 Don't scroll to results when recent search is removed (#834)
* RN-306 Don't scroll to results when recent search is removed * Feedback review
This commit is contained in:
parent
5422b5b472
commit
010336bb64
1 changed files with 4 additions and 3 deletions
|
|
@ -89,10 +89,11 @@ class Search extends Component {
|
|||
);
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const {searchingStatus, recent} = this.props;
|
||||
componentDidUpdate(prevProps) {
|
||||
const {searchingStatus: status, recent} = this.props;
|
||||
const {searchingStatus: prevStatus} = prevProps;
|
||||
const recentLenght = recent.length;
|
||||
const shouldScroll = searchingStatus === RequestStatus.SUCCESS || searchingStatus === RequestStatus.STARTED;
|
||||
const shouldScroll = prevStatus !== status && (status === RequestStatus.SUCCESS || status === RequestStatus.STARTED);
|
||||
|
||||
if (shouldScroll && !this.state.isFocused) {
|
||||
setTimeout(() => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue