From 4d61462290c1f6611fb9022a9ed05e7efe645484 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Wed, 27 Mar 2019 08:13:09 +0100 Subject: [PATCH] fix search and related content --- app/src/component/relatedContent/index.js | 2 +- app/src/component/relatedContent/view.js | 10 +++++----- app/src/component/uriBar/view.js | 2 +- app/src/page/search/index.js | 9 +++++++-- app/src/page/search/view.js | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/app/src/component/relatedContent/index.js b/app/src/component/relatedContent/index.js index 0bafb6e5..428c418d 100644 --- a/app/src/component/relatedContent/index.js +++ b/app/src/component/relatedContent/index.js @@ -14,7 +14,7 @@ const select = (state, props) => ({ }); const perform = dispatch => ({ - search: query => dispatch(doSearch(query, 10, undefined, true)), + search: query => dispatch(doSearch(query, 20, undefined, true)), }); export default connect( diff --git a/app/src/component/relatedContent/view.js b/app/src/component/relatedContent/view.js index 1583bae1..c17a6352 100644 --- a/app/src/component/relatedContent/view.js +++ b/app/src/component/relatedContent/view.js @@ -1,10 +1,10 @@ import React from 'react'; import { ActivityIndicator, FlatList, Text, View } from 'react-native'; -import { navigateToUri } from '../../utils/helper'; -import Colors from '../../styles/colors'; -import FileListItem from '../fileListItem'; -import fileListStyle from '../../styles/fileList'; -import relatedContentStyle from '../../styles/relatedContent'; +import { navigateToUri } from 'utils/helper'; +import Colors from 'styles/colors'; +import FileListItem from 'component/fileListItem'; +import fileListStyle from 'styles/fileList'; +import relatedContentStyle from 'styles/relatedContent'; export default class RelatedContent extends React.PureComponent { constructor() { diff --git a/app/src/component/uriBar/view.js b/app/src/component/uriBar/view.js index 6dc82f9a..2d11fc0d 100644 --- a/app/src/component/uriBar/view.js +++ b/app/src/component/uriBar/view.js @@ -9,7 +9,7 @@ import discoverStyle from 'styles/discover'; import uriBarStyle from 'styles/uriBar'; class UriBar extends React.PureComponent { - static INPUT_TIMEOUT = 500; + static INPUT_TIMEOUT = 1000; // 1 second textInput = null; diff --git a/app/src/page/search/index.js b/app/src/page/search/index.js index c5afc9a9..580b745d 100644 --- a/app/src/page/search/index.js +++ b/app/src/page/search/index.js @@ -1,9 +1,12 @@ import { connect } from 'react-redux'; import { doSearch, + doUpdateSearchQuery, makeSelectSearchUris, selectIsSearching, - selectSearchValue + selectSearchValue, + makeSelectQueryWithOptions, + selectSearchUrisByQuery } from 'lbry-redux'; import { doPushDrawerStack } from 'redux/actions/drawer'; import Constants from 'constants'; @@ -12,11 +15,13 @@ import SearchPage from './view'; const select = (state) => ({ isSearching: selectIsSearching(state), query: selectSearchValue(state), - uris: makeSelectSearchUris(selectSearchValue(state))(state) + uris: makeSelectSearchUris(makeSelectQueryWithOptions(null, 25)(state))(state), + urisByQuery: selectSearchUrisByQuery(state), }); const perform = dispatch => ({ search: (query) => dispatch(doSearch(query, 25)), + updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)), pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SEARCH)), }); diff --git a/app/src/page/search/view.js b/app/src/page/search/view.js index 56eb00ee..b2364078 100644 --- a/app/src/page/search/view.js +++ b/app/src/page/search/view.js @@ -45,7 +45,7 @@ class SearchPage extends React.PureComponent { } render() { - const { isSearching, navigation, query, uris } = this.props; + const { isSearching, navigation, query, uris, urisByQuery } = this.props; const { searchQuery } = navigation.state.params; return (