From 7dd4f96e65991df7ab8313a8a412528acaca7a61 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Wed, 21 Aug 2019 16:49:53 +0100 Subject: [PATCH] tweaks to publish gallery and featured search result --- src/page/publish/view.js | 24 ++++++++++++++++++++---- src/page/search/view.js | 33 +++++++++++++++++---------------- src/styles/publish.js | 7 +++++++ 3 files changed, 44 insertions(+), 20 deletions(-) diff --git a/src/page/publish/view.js b/src/page/publish/view.js index 3da6f68..80f22dc 100644 --- a/src/page/publish/view.js +++ b/src/page/publish/view.js @@ -83,6 +83,7 @@ class PublishPage extends React.PureComponent { // gallery videos videos: null, + allThumbnailsChecked: false, checkedThumbnails: [], // camera @@ -131,6 +132,7 @@ class PublishPage extends React.PureComponent { const { navigation } = this.props; // this.didFocusListener = navigation.addListener('didFocus', this.onComponentFocused); DeviceEventEmitter.addListener('onGalleryThumbnailChecked', this.handleGalleryThumbnailChecked); + DeviceEventEmitter.addListener('onAllGalleryThumbnailsChecked', this.handleAllGalleryThumbnailsChecked); } componentWillUnmount() { @@ -138,6 +140,7 @@ class PublishPage extends React.PureComponent { this.didFocusListener.remove(); } DeviceEventEmitter.removeListener('onGalleryThumbnailChecked', this.handleGalleryThumbnailChecked); + DeviceEventEmitter.removeListener('onAllGalleryThumbnailsChecked', this.handleAllGalleryThumbnailsChecked); } handleGalleryThumbnailChecked = evt => { @@ -150,6 +153,10 @@ class PublishPage extends React.PureComponent { this.setState({ checkedThumbnails }); }; + handleAllGalleryThumbnailsChecked = () => { + this.setState({ allThumbnailsChecked: true }); + }; + onComponentFocused = () => { const { pushDrawerStack, setPlayerVisible } = this.props; pushDrawerStack(); @@ -594,7 +601,15 @@ class PublishPage extends React.PureComponent { render() { const { balance, navigation, notify, publishFormValues } = this.props; - const { canUseCamera, currentPhase, checkedThumbnails, loadingVideos, thumbnailPath, videos } = this.state; + const { + allThumbnailsChecked, + canUseCamera, + currentPhase, + checkedThumbnails, + loadingVideos, + thumbnailPath, + videos, + } = this.state; let content; if (Constants.PHASE_SELECTOR === currentPhase) { @@ -633,9 +648,10 @@ class PublishPage extends React.PureComponent { - {loadingVideos && ( + {(loadingVideos || !allThumbnailsChecked) && ( - + + Please wait while we load your videos... )} {!loadingVideos && (!videos || videos.length === 0) && ( @@ -645,7 +661,7 @@ class PublishPage extends React.PureComponent { )} - {videos && thumbnailPath && checkedThumbnails.length > 0 && ( + {videos && thumbnailPath && allThumbnailsChecked && ( { - const { navigation } = this.props; - const { currentUri } = this.state; - - return ( - navigateToUri(navigation, currentUri)} - /> - ); - }; - listEmptyComponent = () => { const { query } = this.props; return ( @@ -111,12 +96,28 @@ class SearchPage extends React.PureComponent { ); }; + listHeaderComponent = () => { + const { navigation } = this.props; + const { currentUri } = this.state; + + return ( + navigateToUri(navigation, this.state.currentUri)} + /> + ); + }; + render() { const { isSearching, navigation, query, uris, urisByQuery } = this.props; return ( + {isSearching && ( @@ -133,7 +134,7 @@ class SearchPage extends React.PureComponent { maxToRenderPerBatch={20} removeClippedSubviews ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null} - ListHeaderComponent={this.listHeaderComponent()} + ListHeaderComponent={this.state.currentUri ? this.listHeaderComponent() : null} renderItem={({ item }) => ( )} diff --git a/src/styles/publish.js b/src/styles/publish.js index f53a837..ebe7694 100644 --- a/src/styles/publish.js +++ b/src/styles/publish.js @@ -148,6 +148,13 @@ const publishStyle = StyleSheet.create({ flex: 1, alignItems: 'center', justifyContent: 'center', + flexDirection: 'row', + }, + loadingText: { + color: Colors.White, + fontFamily: 'Inter-UI-Regular', + fontSize: 16, + marginLeft: 8, }, titleRow: { flexDirection: 'row',