allow scrolling for displaying more search results #110
3 changed files with 9 additions and 8 deletions
|
@ -136,6 +136,8 @@ const Constants = {
|
||||||
|
|
||||||
DEFAULT_PAGE_SIZE: 10,
|
DEFAULT_PAGE_SIZE: 10,
|
||||||
|
|
||||||
|
SEARCH_RESULTS_PAGE_SIZE: 25,
|
||||||
|
|
||||||
ALL_PLACEHOLDER: '_all',
|
ALL_PLACEHOLDER: '_all',
|
||||||
|
|
||||||
MORE_PLACEHOLDER: '_more',
|
MORE_PLACEHOLDER: '_more',
|
||||||
|
|
|
@ -18,23 +18,23 @@ import { selectCurrentRoute } from 'redux/selectors/drawer';
|
||||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||||
import SearchPage from './view';
|
import SearchPage from './view';
|
||||||
|
|
||||||
const numSearchResults = 25;
|
|
||||||
|
|
||||||
const select = state => ({
|
const select = state => ({
|
||||||
claimSearchByQuery: selectClaimSearchByQuery(state),
|
claimSearchByQuery: selectClaimSearchByQuery(state),
|
||||||
currentRoute: selectCurrentRoute(state),
|
currentRoute: selectCurrentRoute(state),
|
||||||
isSearching: selectIsSearching(state),
|
isSearching: selectIsSearching(state),
|
||||||
query: selectSearchValue(state),
|
query: selectSearchValue(state),
|
||||||
resolvingUris: selectResolvingUris(state),
|
resolvingUris: selectResolvingUris(state),
|
||||||
uris: makeSelectSearchUris(makeSelectQueryWithOptions(null, numSearchResults)(state))(state),
|
uris: makeSelectSearchUris(makeSelectQueryWithOptions(null, Constants.SEARCH_RESULTS_PAGE_SIZE)(state))(state),
|
||||||
results: makeSelectResolvedSearchResults(makeSelectQueryWithOptions(null, numSearchResults)(state))(state),
|
results: makeSelectResolvedSearchResults(makeSelectQueryWithOptions(null, Constants.SEARCH_RESULTS_PAGE_SIZE)(state))(
|
||||||
|
state,
|
||||||
|
),
|
||||||
lastPageReached: makeSelectResolvedSearchResultsLastPageReached(
|
lastPageReached: makeSelectResolvedSearchResultsLastPageReached(
|
||||||
makeSelectQueryWithOptions(null, numSearchResults)(state),
|
makeSelectQueryWithOptions(null, Constants.SEARCH_RESULTS_PAGE_SIZE)(state),
|
||||||
)(state),
|
)(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = dispatch => ({
|
const perform = dispatch => ({
|
||||||
search: (query, from) => dispatch(doResolvedSearch(query, numSearchResults, from, false, {})),
|
search: (query, from) => dispatch(doResolvedSearch(query, Constants.SEARCH_RESULTS_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: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SEARCH)),
|
||||||
|
|
|
@ -20,7 +20,6 @@ import FloatingWalletBalance from 'component/floatingWalletBalance';
|
||||||
import UriBar from 'component/uriBar';
|
import UriBar from 'component/uriBar';
|
||||||
import searchStyle from 'styles/search';
|
import searchStyle from 'styles/search';
|
||||||
|
|
||||||
const pageSize = 25;
|
|
||||||
const softLimit = 500;
|
const softLimit = 500;
|
||||||
|
|
||||||
class SearchPage extends React.PureComponent {
|
class SearchPage extends React.PureComponent {
|
||||||
|
@ -195,7 +194,7 @@ class SearchPage extends React.PureComponent {
|
||||||
};
|
};
|
||||||
|
|
||||||
handleVerticalEndReached = () => {
|
handleVerticalEndReached = () => {
|
||||||
// fetch more content
|
// fetch more results
|
||||||
const { lastPageReached, results, search, isSearching } = this.props;
|
const { lastPageReached, results, search, isSearching } = this.props;
|
||||||
if (lastPageReached || (results && results.length > softLimit)) {
|
if (lastPageReached || (results && results.length > softLimit)) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue