Merge pull request #502 from lbryio/search-fix

fix search and related content
This commit is contained in:
Akinwale Ariwodola 2019-03-28 18:01:47 +01:00 committed by GitHub
commit 4a684b0bec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 9 deletions

View file

@ -1,10 +1,10 @@
import React from 'react'; import React from 'react';
import { ActivityIndicator, FlatList, Text, View } from 'react-native'; import { ActivityIndicator, FlatList, Text, View } from 'react-native';
import { navigateToUri } from '../../utils/helper'; import { navigateToUri } from 'utils/helper';
import Colors from '../../styles/colors'; import Colors from 'styles/colors';
import FileListItem from '../fileListItem'; import FileListItem from 'component/fileListItem';
import fileListStyle from '../../styles/fileList'; import fileListStyle from 'styles/fileList';
import relatedContentStyle from '../../styles/relatedContent'; import relatedContentStyle from 'styles/relatedContent';
export default class RelatedContent extends React.PureComponent<Props> { export default class RelatedContent extends React.PureComponent<Props> {
constructor() { constructor() {

View file

@ -9,7 +9,7 @@ import discoverStyle from 'styles/discover';
import uriBarStyle from 'styles/uriBar'; import uriBarStyle from 'styles/uriBar';
class UriBar extends React.PureComponent { class UriBar extends React.PureComponent {
static INPUT_TIMEOUT = 500; static INPUT_TIMEOUT = 1000; // 1 second
textInput = null; textInput = null;

View file

@ -1,9 +1,12 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { import {
doSearch, doSearch,
doUpdateSearchQuery,
makeSelectSearchUris, makeSelectSearchUris,
selectIsSearching, selectIsSearching,
selectSearchValue selectSearchValue,
makeSelectQueryWithOptions,
selectSearchUrisByQuery
} from 'lbry-redux'; } from 'lbry-redux';
import { doPushDrawerStack } from 'redux/actions/drawer'; import { doPushDrawerStack } from 'redux/actions/drawer';
import Constants from 'constants'; import Constants from 'constants';
@ -12,11 +15,13 @@ import SearchPage from './view';
const select = (state) => ({ const select = (state) => ({
isSearching: selectIsSearching(state), isSearching: selectIsSearching(state),
query: selectSearchValue(state), query: selectSearchValue(state),
uris: makeSelectSearchUris(selectSearchValue(state))(state) uris: makeSelectSearchUris(makeSelectQueryWithOptions(null, 25)(state))(state),
urisByQuery: selectSearchUrisByQuery(state),
}); });
const perform = dispatch => ({ const perform = dispatch => ({
search: (query) => dispatch(doSearch(query, 25)), search: (query) => dispatch(doSearch(query, 25)),
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SEARCH)), pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SEARCH)),
}); });

View file

@ -45,7 +45,7 @@ class SearchPage extends React.PureComponent {
} }
render() { render() {
const { isSearching, navigation, query, uris } = this.props; const { isSearching, navigation, query, uris, urisByQuery } = this.props;
const { searchQuery } = navigation.state.params; const { searchQuery } = navigation.state.params;
return ( return (