From bf7f8364658b7872a8e36e02e17ae5656cdf9954 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Fri, 31 Jan 2020 08:52:07 +0100 Subject: [PATCH] fix search restore and background play bug --- src/page/search/index.js | 2 +- src/page/search/view.js | 55 ++++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/page/search/index.js b/src/page/search/index.js index edb4b1f..8643ae8 100644 --- a/src/page/search/index.js +++ b/src/page/search/index.js @@ -35,7 +35,7 @@ const perform = dispatch => ({ search: (query, from) => dispatch(doResolvedSearch(query, Constants.DEFAULT_PAGE_SIZE, from, false, {})), claimSearch: options => dispatch(doClaimSearch(options)), updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)), - pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SEARCH)), + pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)), resolveUris: uris => dispatch(doResolveUris(uris)), setPlayerVisible: () => dispatch(doSetPlayerVisible(false)), }); diff --git a/src/page/search/view.js b/src/page/search/view.js index 6e94974..a27a026 100644 --- a/src/page/search/view.js +++ b/src/page/search/view.js @@ -52,9 +52,9 @@ class SearchPage extends React.PureComponent { } onComponentFocused = () => { - const { pushDrawerStack, setPlayerVisible, query, search } = this.props; - pushDrawerStack(); + const { pushDrawerStack, setPlayerVisible, navigation, query, search } = this.props; setPlayerVisible(); + pushDrawerStack(Constants.DRAWER_ROUTE_SEARCH, navigation.state.params ? navigation.state.params : null); NativeModules.Firebase.setCurrentScreen('Search').then(result => { const searchQuery = query || this.getSearchQuery(); if (searchQuery && searchQuery.trim().length > 0) { @@ -221,32 +221,31 @@ class SearchPage extends React.PureComponent { )} - {(!isSearching || this.state.currentFrom > 0) && ( - item.claimId} - initialNumToRender={10} - maxToRenderPerBatch={20} - onEndReached={this.handleVerticalEndReached} - onEndReachedThreshold={0.2} - removeClippedSubviews - ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null} - ListHeaderComponent={this.listHeaderComponent(this.state.showTagResult, this.state.currentQuery)} - renderItem={({ item }) => ( - - )} - /> - )} + item.claimId} + initialNumToRender={10} + maxToRenderPerBatch={20} + onEndReached={this.handleVerticalEndReached} + onEndReachedThreshold={0.2} + removeClippedSubviews + ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null} + ListHeaderComponent={this.listHeaderComponent(this.state.showTagResult, this.state.currentQuery)} + renderItem={({ item }) => ( + + )} + /> + {this.state.currentFrom > 0 && isSearching && (