search tweaks and package updates

This commit is contained in:
Akinwale Ariwodola 2019-12-29 06:48:13 +01:00
parent 36d4bd7e99
commit f77f0a7aa2
5 changed files with 109 additions and 79 deletions

97
package-lock.json generated
View file

@ -2074,9 +2074,9 @@
} }
}, },
"@react-navigation/core": { "@react-navigation/core": {
"version": "3.5.0", "version": "3.5.1",
"resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-3.5.0.tgz", "resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-3.5.1.tgz",
"integrity": "sha512-NLm24lA51R8o8c+iFnwtN9elqRzm4OJ8f1qPBCUNIYW1sb8M5yCD53vRP0fRcPFpr/6Xzs2TJMsWnnebwFp0Rw==", "integrity": "sha512-q7NyhWVYOhVIWqL2GZKa6G78YarXaVTTtOlSDkvy4ZIggo40wZzamlnrJRvsaQX46gsgw45FAWb5SriHh8o7eA==",
"requires": { "requires": {
"hoist-non-react-statics": "^3.3.0", "hoist-non-react-statics": "^3.3.0",
"path-to-regexp": "^1.7.0", "path-to-regexp": "^1.7.0",
@ -2085,9 +2085,9 @@
}, },
"dependencies": { "dependencies": {
"hoist-non-react-statics": { "hoist-non-react-statics": {
"version": "3.3.0", "version": "3.3.1",
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz", "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz",
"integrity": "sha512-0XsbTXxgiaCDYDIWFcwkmerZPSwywfUqYmwT4jzewKTQSWoE6FCMoUVOeBJWK3E/CrWbxRG3m5GzY4lnIwGRBA==", "integrity": "sha512-wbg3bpgA/ZqWrZuMOeJi8+SKMhr7X9TesL/rXMjTzh0p0JUBo3II8DHboYbuIXWRlttrUFxwcu/5kygrCw8fJw==",
"requires": { "requires": {
"react-is": "^16.7.0" "react-is": "^16.7.0"
} }
@ -2095,9 +2095,9 @@
} }
}, },
"@react-navigation/native": { "@react-navigation/native": {
"version": "3.6.1", "version": "3.6.2",
"resolved": "https://registry.npmjs.org/@react-navigation/native/-/native-3.6.1.tgz", "resolved": "https://registry.npmjs.org/@react-navigation/native/-/native-3.6.2.tgz",
"integrity": "sha512-q12/sG4LinEokc7K0DRn0uxoBuLy42TedHNDXN3b9Fj9c2FamUqlLeTZQtjDQc8dLBEeN2Bpp5FSDN8MYxxjAA==", "integrity": "sha512-Cybeou6N82ZeRmgnGlu+wzlV3z5BZQR2dmYaNFV1TNLUGHqtvv8E7oNw9uYcz9Ox5LFbiX+FdNTn2d6ZPlK0kg==",
"requires": { "requires": {
"hoist-non-react-statics": "^3.0.1", "hoist-non-react-statics": "^3.0.1",
"react-native-safe-area-view": "^0.14.1", "react-native-safe-area-view": "^0.14.1",
@ -2105,27 +2105,12 @@
}, },
"dependencies": { "dependencies": {
"hoist-non-react-statics": { "hoist-non-react-statics": {
"version": "3.3.0", "version": "3.3.1",
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz", "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz",
"integrity": "sha512-0XsbTXxgiaCDYDIWFcwkmerZPSwywfUqYmwT4jzewKTQSWoE6FCMoUVOeBJWK3E/CrWbxRG3m5GzY4lnIwGRBA==", "integrity": "sha512-wbg3bpgA/ZqWrZuMOeJi8+SKMhr7X9TesL/rXMjTzh0p0JUBo3II8DHboYbuIXWRlttrUFxwcu/5kygrCw8fJw==",
"requires": { "requires": {
"react-is": "^16.7.0" "react-is": "^16.7.0"
} }
},
"react-native-safe-area-view": {
"version": "0.14.7",
"resolved": "https://registry.npmjs.org/react-native-safe-area-view/-/react-native-safe-area-view-0.14.7.tgz",
"integrity": "sha512-fmuBYpvKDJK33bimo4JXrK2BN2CGw7nof1y1LDRgzqv+FZ3eADSDGshprN8WeQqSZjQ20hJx1CiWk28Edg/v4Q==",
"requires": {
"hoist-non-react-statics": "^2.3.1"
},
"dependencies": {
"hoist-non-react-statics": {
"version": "2.5.5",
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz",
"integrity": "sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw=="
}
}
} }
} }
}, },
@ -9155,9 +9140,9 @@
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==" "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
}, },
"path-to-regexp": { "path-to-regexp": {
"version": "1.7.0", "version": "1.8.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
"integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=", "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
"requires": { "requires": {
"isarray": "0.0.1" "isarray": "0.0.1"
}, },
@ -9526,9 +9511,9 @@
"dev": true "dev": true
}, },
"query-string": { "query-string": {
"version": "6.8.2", "version": "6.9.0",
"resolved": "https://registry.npmjs.org/query-string/-/query-string-6.8.2.tgz", "resolved": "https://registry.npmjs.org/query-string/-/query-string-6.9.0.tgz",
"integrity": "sha512-J3Qi8XZJXh93t2FiKyd/7Ec6GNifsjKXUsVFkSBj/kjLsDylWhnCz4NT1bkPcKotttPW+QbKGqqPH8OoI2pdqw==", "integrity": "sha512-KG4bhCFYapExLsUHrFt+kQVEegF2agm4cpF/VNc6pZVthIfCc/GK8t8VyNIE3nyXG9DK3Tf2EGkxjR6/uRdYsA==",
"requires": { "requires": {
"decode-uri-component": "^0.2.0", "decode-uri-component": "^0.2.0",
"split-on-first": "^1.0.0", "split-on-first": "^1.0.0",
@ -9899,6 +9884,14 @@
"resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-1.4.0.tgz", "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-1.4.0.tgz",
"integrity": "sha512-tO7nSNNP+iRLVbkcSS5GXyDBb7tSI02+XuRL3/S39EAr35rnvUy2JfeLUQG+fWSObJjnMVhasUDEUwlENk8IXw==" "integrity": "sha512-tO7nSNNP+iRLVbkcSS5GXyDBb7tSI02+XuRL3/S39EAr35rnvUy2JfeLUQG+fWSObJjnMVhasUDEUwlENk8IXw=="
}, },
"react-native-safe-area-view": {
"version": "0.14.8",
"resolved": "https://registry.npmjs.org/react-native-safe-area-view/-/react-native-safe-area-view-0.14.8.tgz",
"integrity": "sha512-MtRSIcZNstxv87Jet+UsPhEd1tpGe8cVskDXlP657x6rHpSrbrc+y13ZNXrwAgGNNhqQNX7UJT68ZIq//ZRmvw==",
"requires": {
"hoist-non-react-statics": "^2.3.1"
}
},
"react-native-screens": { "react-native-screens": {
"version": "1.0.0-alpha.23", "version": "1.0.0-alpha.23",
"resolved": "https://registry.npmjs.org/react-native-screens/-/react-native-screens-1.0.0-alpha.23.tgz", "resolved": "https://registry.npmjs.org/react-native-screens/-/react-native-screens-1.0.0-alpha.23.tgz",
@ -10098,14 +10091,14 @@
} }
}, },
"react-navigation": { "react-navigation": {
"version": "3.12.1", "version": "3.13.0",
"resolved": "https://registry.npmjs.org/react-navigation/-/react-navigation-3.12.1.tgz", "resolved": "https://registry.npmjs.org/react-navigation/-/react-navigation-3.13.0.tgz",
"integrity": "sha512-WLjQis/A40cIMpFlw4o26nSLN+CvrZp8MGvJoL5K5H7DMZ/TdwgPa/Nm2sAQA27Hw7hOohQGj+diyxFRZi89Iw==", "integrity": "sha512-r64bTImY2aNye8wtd39ubouVB6ZMJqjVQYKxH4LFmOav4FsI59fQTDN7sZzyJa29owowYw/wVkh+NWGT+tdD1A==",
"requires": { "requires": {
"@react-navigation/core": "~3.5.0", "@react-navigation/core": "~3.5.1",
"@react-navigation/native": "~3.6.1", "@react-navigation/native": "~3.6.2",
"react-navigation-drawer": "~1.4.0", "react-navigation-drawer": "~1.4.0",
"react-navigation-stack": "~1.5.0", "react-navigation-stack": "1.5.3",
"react-navigation-tabs": "~1.2.0" "react-navigation-tabs": "~1.2.0"
}, },
"dependencies": { "dependencies": {
@ -10118,9 +10111,9 @@
} }
}, },
"react-navigation-stack": { "react-navigation-stack": {
"version": "1.5.5", "version": "1.5.3",
"resolved": "https://registry.npmjs.org/react-navigation-stack/-/react-navigation-stack-1.5.5.tgz", "resolved": "https://registry.npmjs.org/react-navigation-stack/-/react-navigation-stack-1.5.3.tgz",
"integrity": "sha512-qMhOhmUmyPNfFGWMbwv5flrNVsFU4JZSBWnONSgVGK4KWGW8DbobXBi4i4sBAC9Kg8EqJK0qyWcxnkMJJtfMWA==", "integrity": "sha512-MQcwDVbZUYsTtDJb5cFOSm+K+e7KpUCoROaGoUOR+JHWE3uuaJ3pd/Nu+32a57J98TNBf4qq0+2TPJWl6z6IBg==",
"requires": { "requires": {
"prop-types": "^15.7.2" "prop-types": "^15.7.2"
} }
@ -10261,16 +10254,16 @@
} }
}, },
"redux-persist": { "redux-persist": {
"version": "5.10.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/redux-persist/-/redux-persist-5.10.0.tgz", "resolved": "https://registry.npmjs.org/redux-persist/-/redux-persist-6.0.0.tgz",
"integrity": "sha512-sSJAzNq7zka3qVHKce1hbvqf0Vf5DuTVm7dr4GtsqQVOexnrvbV47RWFiPxQ8fscnyiuWyD2O92DOxPl0tGCRg==" "integrity": "sha512-71LLMbUq2r02ng2We9S215LtPu3fY0KgaGE0k8WRgl6RkqxtGfl7HUozz1Dftwsb0D/5mZ8dwAaPbtnzfvbEwQ=="
}, },
"redux-persist-filesystem-storage": { "redux-persist-filesystem-storage": {
"version": "1.4.1", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/redux-persist-filesystem-storage/-/redux-persist-filesystem-storage-1.4.1.tgz", "resolved": "https://registry.npmjs.org/redux-persist-filesystem-storage/-/redux-persist-filesystem-storage-2.1.0.tgz",
"integrity": "sha512-QDBlRWdFpn4JMrdLZcimwT7d3yc0xkSnA5j9xKWAY2Qw9rd3Uzlt76qXwEuuQ4M3qgKu/nLE8Roazl5BUcxfcA==", "integrity": "sha512-KFj4opJCu8WXUveNV8YKZ1OMGiQm0kiTjWHSSYJ2hmQNrhEa7MOMiIcTImfNDO3vfRl9U+bidKDhQebtCeWrCw==",
"requires": { "requires": {
"rn-fetch-blob": "0.10.15" "rn-fetch-blob": "^0.10.16"
}, },
"dependencies": { "dependencies": {
"glob": { "glob": {
@ -10287,9 +10280,9 @@
} }
}, },
"rn-fetch-blob": { "rn-fetch-blob": {
"version": "0.10.15", "version": "0.10.16",
"resolved": "https://registry.npmjs.org/rn-fetch-blob/-/rn-fetch-blob-0.10.15.tgz", "resolved": "https://registry.npmjs.org/rn-fetch-blob/-/rn-fetch-blob-0.10.16.tgz",
"integrity": "sha512-/m/gurTaPAvR3J843uehHhznj5k89x7XClyO5ejmbspNLNQ4ByF+kZs80wiiKGWntj+Wqo0jJu1goArXEfc0kA==", "integrity": "sha512-hZV+nF0HK4CWmspXGMw7/G8Q8qugpS/wbKiNLsFpdBZR8XYzjFZNvBWgGyC0F5JWQn3sjmK2w/FJjBlwdQWNQg==",
"requires": { "requires": {
"base-64": "0.1.0", "base-64": "0.1.0",
"glob": "7.0.6" "glob": "7.0.6"

View file

@ -34,14 +34,14 @@
"react-native-super-grid": "^3.0.4", "react-native-super-grid": "^3.0.4",
"react-native-vector-icons": "^6.6.0", "react-native-vector-icons": "^6.6.0",
"react-native-video": "lbryio/react-native-video#7992ff945872f9bd00a3736d9ff1318f343abf47", "react-native-video": "lbryio/react-native-video#7992ff945872f9bd00a3736d9ff1318f343abf47",
"react-navigation": "^3.11.0", "react-navigation": "^3.13.0",
"react-navigation-drawer": "^2.3.3", "react-navigation-drawer": "^2.3.3",
"react-navigation-redux-helpers": "^3.0.2", "react-navigation-redux-helpers": "^3.0.2",
"react-navigation-stack": "^1.8.1", "react-navigation-stack": "^1.8.1",
"react-redux": "^5.0.3", "react-redux": "^5.0.3",
"redux": "^4.0.4", "redux": "^4.0.4",
"redux-persist": "^5.10.0", "redux-persist": "^6.0.0",
"redux-persist-filesystem-storage": "^1.3.2", "redux-persist-filesystem-storage": "^2.1.0",
"redux-persist-transform-compress": "^4.2.0", "redux-persist-transform-compress": "^4.2.0",
"redux-persist-transform-filter": "0.0.18", "redux-persist-transform-filter": "0.0.18",
"redux-thunk": "^2.3.0", "redux-thunk": "^2.3.0",

View file

@ -178,7 +178,7 @@ class FileListItem extends React.PureComponent {
{!title && !name && <Text style={fileListStyle.uri}>{uri}</Text>} {!title && !name && <Text style={fileListStyle.uri}>{uri}</Text>}
{!title && !name && ( {!title && !name && (
<View style={fileListStyle.row}> <View style={fileListStyle.row}>
<ActivityIndicator size={'small'} color={featuredResult ? Colors.White : Colors.LbryGreen} /> <ActivityIndicator size={'small'} color={featuredResult ? Colors.White : Colors.NextLbryGreen} />
</View> </View>
)} )}
</View> </View>
@ -209,7 +209,7 @@ class FileListItem extends React.PureComponent {
normalizeURI(shortChannelUri || fullChannelUri), normalizeURI(shortChannelUri || fullChannelUri),
null, null,
false, false,
fullChannelUri fullChannelUri,
); );
}} }}
/> />

View file

@ -1,14 +1,15 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { import {
doClaimSearch, doClaimSearch,
doResolveUris,
doSearch, doSearch,
doUpdateSearchQuery, doUpdateSearchQuery,
makeSelectSearchUris, makeSelectSearchUris,
selectClaimSearchByQuery, selectClaimSearchByQuery,
selectIsSearching, selectIsSearching,
selectResolvingUris,
selectSearchValue, selectSearchValue,
makeSelectQueryWithOptions, makeSelectQueryWithOptions,
selectSearchUrisByQuery,
} from 'lbry-redux'; } from 'lbry-redux';
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer'; import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
import { selectCurrentRoute } from 'redux/selectors/drawer'; import { selectCurrentRoute } from 'redux/selectors/drawer';
@ -22,8 +23,8 @@ const select = state => ({
currentRoute: selectCurrentRoute(state), currentRoute: selectCurrentRoute(state),
isSearching: selectIsSearching(state), isSearching: selectIsSearching(state),
query: selectSearchValue(state), query: selectSearchValue(state),
resolvingUris: selectResolvingUris(state),
uris: makeSelectSearchUris(makeSelectQueryWithOptions(null, numSearchResults)(state))(state), uris: makeSelectSearchUris(makeSelectQueryWithOptions(null, numSearchResults)(state))(state),
urisByQuery: selectSearchUrisByQuery(state),
}); });
const perform = dispatch => ({ const perform = dispatch => ({
@ -31,10 +32,11 @@ const perform = dispatch => ({
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)),
resolveUris: uris => dispatch(doResolveUris(uris)),
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)), setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
}); });
export default connect( export default connect(
select, select,
perform perform,
)(SearchPage); )(SearchPage);

View file

@ -26,6 +26,7 @@ class SearchPage extends React.PureComponent {
showTagResult: false, showTagResult: false,
claimSearchRun: false, claimSearchRun: false,
claimSearchOptions: null, claimSearchOptions: null,
resultsResolved: false,
}; };
static navigationOptions = { static navigationOptions = {
@ -80,11 +81,37 @@ class SearchPage extends React.PureComponent {
this.setState({ this.setState({
currentQuery: query, currentQuery: query,
currentUri: isURIValid(query) ? normalizeURI(query) : null, currentUri: isURIValid(query) ? normalizeURI(query) : null,
resultsResolved: false,
}); });
search(query); search(query);
} }
} }
allContentResolved() {
const { uris, resolvingUris } = this.props;
if (!this.state.resultsResolved) {
return false;
}
if (uris) {
let allResolved = true;
uris.forEach(uri => {
allResolved = allResolved && !resolvingUris.includes(uri);
});
return allResolved;
}
return false;
}
shouldComponentUpdate() {
const { isSearching, uris } = this.props;
return (isSearching && (!uris || uris.length === 0)) || (!isSearching && this.allContentResolved());
}
componentDidUpdate() {
const { isSearching, resolveUris, uris } = this.props;
}
getSearchQuery() { getSearchQuery() {
const { navigation } = this.props; const { navigation } = this.props;
if (navigation && navigation.state && navigation.state.params) { if (navigation && navigation.state && navigation.state.params) {
@ -130,11 +157,11 @@ class SearchPage extends React.PureComponent {
this.setState({ claimSearchOptions: options, claimSearchRun: true }, () => claimSearch(options)); this.setState({ claimSearchOptions: options, claimSearchRun: true }, () => claimSearch(options));
} }
if (this.state.claimSearchRun && this.state.claimSearchOptions) { /* if (this.state.claimSearchRun && this.state.claimSearchOptions) {
const claimSearchKey = createNormalizedClaimSearchKey(this.state.claimSearchOptions); const claimSearchKey = createNormalizedClaimSearchKey(this.state.claimSearchOptions);
const claimSearchUris = claimSearchByQuery[claimSearchKey]; const claimSearchUris = claimSearchByQuery[claimSearchKey];
this.setState({ showTagResult: claimSearchUris && claimSearchUris.length > 0 }); this.setState({ showTagResult: claimSearchUris && claimSearchUris.length > 0 });
} } */
return ( return (
<View> <View>
@ -155,7 +182,7 @@ class SearchPage extends React.PureComponent {
}; };
render() { render() {
const { isSearching, navigation, query, uris, urisByQuery } = this.props; const { isSearching, navigation, query, uris } = this.props;
return ( return (
<View style={searchStyle.container}> <View style={searchStyle.container}>
@ -167,22 +194,30 @@ class SearchPage extends React.PureComponent {
</View> </View>
)} )}
<FlatList {!isSearching && (
extraData={this.state} <FlatList
style={searchStyle.scrollContainer} extraData={this.state}
contentContainerStyle={searchStyle.scrollPadding} style={searchStyle.scrollContainer}
keyboardShouldPersistTaps={'handled'} contentContainerStyle={searchStyle.scrollPadding}
data={uris} keyboardShouldPersistTaps={'handled'}
keyExtractor={(item, index) => item} data={uris}
initialNumToRender={10} keyExtractor={(item, index) => item}
maxToRenderPerBatch={20} initialNumToRender={8}
removeClippedSubviews maxToRenderPerBatch={20}
ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null} removeClippedSubviews
ListHeaderComponent={this.state.currentUri ? this.listHeaderComponent(this.state.showTagResult) : null} ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null}
renderItem={({ item }) => ( ListHeaderComponent={this.state.currentUri ? this.listHeaderComponent(this.state.showTagResult) : null}
<FileListItem key={item} uri={item} style={searchStyle.resultItem} navigation={navigation} /> renderItem={({ item }) => (
)} <FileListItem
/> key={item}
uri={item}
style={searchStyle.resultItem}
batchResolve
navigation={navigation}
/>
)}
/>
)}
<FloatingWalletBalance navigation={navigation} /> <FloatingWalletBalance navigation={navigation} />
</View> </View>
); );