fix search restore and background play bug
This commit is contained in:
parent
017787ef25
commit
bf7f836465
2 changed files with 28 additions and 29 deletions
|
@ -35,7 +35,7 @@ const perform = dispatch => ({
|
||||||
search: (query, from) => dispatch(doResolvedSearch(query, Constants.DEFAULT_PAGE_SIZE, from, false, {})),
|
search: (query, from) => dispatch(doResolvedSearch(query, Constants.DEFAULT_PAGE_SIZE, from, false, {})),
|
||||||
claimSearch: options => dispatch(doClaimSearch(options)),
|
claimSearch: options => dispatch(doClaimSearch(options)),
|
||||||
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
|
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
|
||||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SEARCH)),
|
pushDrawerStack: (routeName, params) => dispatch(doPushDrawerStack(routeName, params)),
|
||||||
resolveUris: uris => dispatch(doResolveUris(uris)),
|
resolveUris: uris => dispatch(doResolveUris(uris)),
|
||||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||||
});
|
});
|
||||||
|
|
|
@ -52,9 +52,9 @@ class SearchPage extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
onComponentFocused = () => {
|
onComponentFocused = () => {
|
||||||
const { pushDrawerStack, setPlayerVisible, query, search } = this.props;
|
const { pushDrawerStack, setPlayerVisible, navigation, query, search } = this.props;
|
||||||
pushDrawerStack();
|
|
||||||
setPlayerVisible();
|
setPlayerVisible();
|
||||||
|
pushDrawerStack(Constants.DRAWER_ROUTE_SEARCH, navigation.state.params ? navigation.state.params : null);
|
||||||
NativeModules.Firebase.setCurrentScreen('Search').then(result => {
|
NativeModules.Firebase.setCurrentScreen('Search').then(result => {
|
||||||
const searchQuery = query || this.getSearchQuery();
|
const searchQuery = query || this.getSearchQuery();
|
||||||
if (searchQuery && searchQuery.trim().length > 0) {
|
if (searchQuery && searchQuery.trim().length > 0) {
|
||||||
|
@ -221,32 +221,31 @@ class SearchPage extends React.PureComponent {
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{(!isSearching || this.state.currentFrom > 0) && (
|
<FlatList
|
||||||
<FlatList
|
extraData={this.state}
|
||||||
extraData={this.state}
|
style={searchStyle.scrollContainer}
|
||||||
style={searchStyle.scrollContainer}
|
contentContainerStyle={searchStyle.scrollPadding}
|
||||||
contentContainerStyle={searchStyle.scrollPadding}
|
keyboardShouldPersistTaps={'handled'}
|
||||||
keyboardShouldPersistTaps={'handled'}
|
data={results}
|
||||||
data={results}
|
keyExtractor={(item, index) => item.claimId}
|
||||||
keyExtractor={(item, index) => item.claimId}
|
initialNumToRender={10}
|
||||||
initialNumToRender={10}
|
maxToRenderPerBatch={20}
|
||||||
maxToRenderPerBatch={20}
|
onEndReached={this.handleVerticalEndReached}
|
||||||
onEndReached={this.handleVerticalEndReached}
|
onEndReachedThreshold={0.2}
|
||||||
onEndReachedThreshold={0.2}
|
removeClippedSubviews
|
||||||
removeClippedSubviews
|
ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null}
|
||||||
ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null}
|
ListHeaderComponent={this.listHeaderComponent(this.state.showTagResult, this.state.currentQuery)}
|
||||||
ListHeaderComponent={this.listHeaderComponent(this.state.showTagResult, this.state.currentQuery)}
|
renderItem={({ item }) => (
|
||||||
renderItem={({ item }) => (
|
<ClaimResultItem
|
||||||
<ClaimResultItem
|
key={item.claimId}
|
||||||
key={item.claimId}
|
uri={item ? normalizeURI(`${item.name}#${item.claimId}`) : null}
|
||||||
uri={item ? normalizeURI(`${item.name}#${item.claimId}`) : null}
|
result={item}
|
||||||
result={item}
|
style={searchStyle.resultItem}
|
||||||
style={searchStyle.resultItem}
|
navigation={navigation}
|
||||||
navigation={navigation}
|
/>
|
||||||
/>
|
)}
|
||||||
)}
|
/>
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{this.state.currentFrom > 0 && isSearching && (
|
{this.state.currentFrom > 0 && isSearching && (
|
||||||
<View style={searchStyle.moreLoading}>
|
<View style={searchStyle.moreLoading}>
|
||||||
<ActivityIndicator size="small" color={Colors.NextLbryGreen} />
|
<ActivityIndicator size="small" color={Colors.NextLbryGreen} />
|
||||||
|
|
Loading…
Reference in a new issue