From efbd87d82b0c2fb8cbd30329972349eedf1722a1 Mon Sep 17 00:00:00 2001 From: u-e Date: Sat, 22 Dec 2018 22:03:18 +0300 Subject: [PATCH 01/19] updated posts --- .../postCard/container/postCardContainer.js | 3 +- src/components/posts/view/postsView.js | 4 +- src/providers/steem/dsteem.js | 3 +- src/utils/markdownToHtml.js | 41 ++++++++++-- src/utils/postParser.js | 66 ++++++++++--------- 5 files changed, 75 insertions(+), 42 deletions(-) diff --git a/src/components/postCard/container/postCardContainer.js b/src/components/postCard/container/postCardContainer.js index fb608fb17..23790fbf6 100644 --- a/src/components/postCard/container/postCardContainer.js +++ b/src/components/postCard/container/postCardContainer.js @@ -44,7 +44,8 @@ class PostCardContainer extends PureComponent { navigation.navigate({ routeName: ROUTES.SCREENS.POST, params: { - content, + author: content.author, + permlink: content.permlink, }, key: content.permlink, }); diff --git a/src/components/posts/view/postsView.js b/src/components/posts/view/postsView.js index 7d54217be..a8729a88d 100644 --- a/src/components/posts/view/postsView.js +++ b/src/components/posts/view/postsView.js @@ -65,7 +65,7 @@ class PostsView extends Component { _loadPosts = (filter = null) => { const { getFor, tag, currentAccountUsername } = this.props; - const { posts, startAuthor, startPermlink } = this.state; + const { posts, startAuthor, startPermlink, refreshing } = this.state; let options; this.setState({ isLoading: true }); @@ -81,7 +81,7 @@ class PostsView extends Component { }; } - if (startAuthor && startPermlink) { + if (startAuthor && startPermlink && !refreshing) { options.start_author = startAuthor; options.start_permlink = startPermlink; } diff --git a/src/providers/steem/dsteem.js b/src/providers/steem/dsteem.js index 0e2c17678..0bad02f3e 100644 --- a/src/providers/steem/dsteem.js +++ b/src/providers/steem/dsteem.js @@ -258,8 +258,9 @@ export const getActiveVotes = (author, permlink) => client.database.call('get_ac export const getPostsSummary = async (by, query, currentUserName) => { try { let posts = await client.database.getDiscussions(by, query); + if (posts) { - posts = await parsePosts(posts, currentUserName); + posts = await parsePosts(posts, currentUserName, true); } return posts; } catch (error) { diff --git a/src/utils/markdownToHtml.js b/src/utils/markdownToHtml.js index a43c64415..63674d3bd 100644 --- a/src/utils/markdownToHtml.js +++ b/src/utils/markdownToHtml.js @@ -18,6 +18,7 @@ const pullRightLeftRegex = /(
(.*?)(<[/]div>))/g; const linkRegex = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi; const markdownImageRegex = /!\[[^\]]*\]\((.*?)\s*("(?:.*[^"])")?\s*\)/g; const urlRegex = /(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?/gm; +const aTagRegex = /(<\s*a[^>]*>(.*?)<\s*[/]\s*a>)/g; export const markDown2Html = (input) => { if (!input) { @@ -37,8 +38,12 @@ export const markDown2Html = (input) => { output = createYoutubeIframe(output); } - if (dTubeRegex.test(output)) { - output = createDtubeIframe(output); + // if (dTubeRegex.test(output)) { + // output = createDtubeIframe(output); + // } + + if (aTagRegex.test(output)) { + output = handleATag(output); } if (pullRightLeftRegex.test(output)) { @@ -46,7 +51,7 @@ export const markDown2Html = (input) => { } // if (imgRegex.test(output)) { - // output = createImage(output); + // output = handleImage(output); // } if (vimeoRegex.test(output)) { @@ -86,13 +91,13 @@ export const markDown2Html = (input) => { return output; }; -export const replaceAuthorNames = input => input.replace(authorNameRegex, (match, preceeding1, preceeding2, user) => { +const replaceAuthorNames = input => input.replace(authorNameRegex, (match, preceeding1, preceeding2, user) => { const userLower = user.toLowerCase(); const preceedings = (preceeding1 || '') + (preceeding2 || ''); return `${preceedings}@${user}`; }); -export const replaceTags = input => input.replace(tagsRegex, (tag) => { +const replaceTags = input => input.replace(tagsRegex, (tag) => { if (/#[\d]+$/.test(tag)) return tag; const preceding = /^\s|>/.test(tag) ? tag[0] : ''; tag = tag.replace('>', ''); @@ -101,7 +106,24 @@ export const replaceTags = input => input.replace(tagsRegex, (tag) => { return `${preceding}${tag.trim()}`; }); -export const removeOnlyPTag = input => input; +const handleATag = input => input.replace(aTagRegex, (link) => { + if (dTubeRegex.test(link)) { + const dTubeMatch = link.match(dTubeRegex)[0]; + const execLink = dTubeRegex.exec(dTubeMatch); + + if (execLink[2] && execLink[3]) { + const embedLink = `https://emb.d.tube/#!/${execLink[2]}/${execLink[3]}`; + + return iframeBody(embedLink); + } + if (dTubeMatch) { + return iframeBody(dTubeMatch); + } + return link; + } + + return link; +}); const changeMarkdownImage = input => input.replace(markdownImageRegex, (link) => { const markdownMatch = link.match(markdownImageRegex); @@ -121,7 +143,7 @@ const createCenterImage = input => input.replace(imgCenterRegex, (link) => { _link = _link.split('>')[1]; _link = _link.split('<')[0]; - return `><`; + return `><`; }); const changePullRightLeft = input => input.replace(pullRightLeftRegex, (item) => { @@ -144,6 +166,11 @@ const createImage = input => input.replace( link => ``, ); +const handleImage = input => input.replace( + imgRegex, + link => ``, +); + const createFromDoubleImageLink = input => input.replace(onlyImageDoubleLinkRegex, (link) => { const _link = link.trim(); return ``; diff --git a/src/utils/postParser.js b/src/utils/postParser.js index c1871aae6..f0a772a05 100644 --- a/src/utils/postParser.js +++ b/src/utils/postParser.js @@ -4,50 +4,54 @@ import { getPostSummary } from './formatter'; import { getReputation } from './reputation'; import { getTimeFromNow } from './time'; -export const parsePosts = (posts, currentUserName) => (!posts ? null : posts.map(post => parsePost(post, currentUserName))); +export const parsePosts = (posts, currentUserName, isSummary) => (!posts ? null : posts.map(post => parsePost(post, currentUserName, isSummary))); -export const parsePost = (post, currentUserName) => { +export const parsePost = (post, currentUserName, isSummary = false) => { if (!post) { return null; } + const _post = post; - post.json_metadata = JSON.parse(post.json_metadata); - post.image = postImage(post.json_metadata, post.body); - post.pending_payout_value = parseFloat(post.pending_payout_value).toFixed(2); - post.created = getTimeFromNow(post.created); - post.vote_count = post.active_votes.length; - post.author_reputation = getReputation(post.author_reputation); - post.avatar = `https://steemitimages.com/u/${post.author}/avatar/small`; - post.body = markDown2Html(post.body); - post.summary = getPostSummary(post.body, 150); - post.raw_body = post.body; - post.active_votes.sort((a, b) => b.rshares - a.rshares); - const totalPayout = parseFloat(post.pending_payout_value) - + parseFloat(post.total_payout_value) - + parseFloat(post.curator_payout_value); + _post.json_metadata = JSON.parse(post.json_metadata); + _post.image = postImage(post.json_metadata, post.body); + _post.pending_payout_value = parseFloat(post.pending_payout_value).toFixed(2); + _post.created = getTimeFromNow(post.created); + _post.vote_count = post.active_votes.length; + _post.author_reputation = getReputation(post.author_reputation); + _post.avatar = `https://steemitimages.com/u/${post.author}/avatar/small`; + _post.active_votes.sort((a, b) => b.rshares - a.rshares); - const voteRshares = post.active_votes.reduce((a, b) => a + parseFloat(b.rshares), 0); - const ratio = totalPayout / voteRshares; + _post.body = markDown2Html(post.body); + if (isSummary) _post.summary = getPostSummary(post.body, 150); if (currentUserName) { - post.is_voted = isVoted(post.active_votes, currentUserName); + _post.is_voted = isVoted(_post.active_votes, currentUserName); } else { - post.is_voted = false; + _post.is_voted = false; } - for (const i in post.active_votes) { - post.vote_perecent = post.active_votes[i].voter === currentUserName ? post.active_votes[i].percent : null; - post.active_votes[i].value = (post.active_votes[i].rshares * ratio).toFixed(2); - post.active_votes[i].reputation = getReputation(post.active_votes[i].reputation); - post.active_votes[i].percent = post.active_votes[i].percent / 100; - post.active_votes[i].created = getTimeFromNow(post.active_votes[i].time); - post.active_votes[i].is_down_vote = Math.sign(post.active_votes[i].percent) < 0; - post.active_votes[i].avatar = `https://steemitimages.com/u/${ - post.active_votes[i].voter - }/avatar/small`; + const totalPayout = parseFloat(_post.pending_payout_value) + + parseFloat(_post.total_payout_value) + + parseFloat(_post.curator_payout_value); + + const voteRshares = _post.active_votes.reduce((a, b) => a + parseFloat(b.rshares), 0); + const ratio = totalPayout / voteRshares; + + if (_post.active_votes && _post.active_votes.length > 0) { + for (const i in _post.active_votes) { + _post.vote_perecent = post.active_votes[i].voter === currentUserName ? post.active_votes[i].percent : null; + _post.active_votes[i].value = (post.active_votes[i].rshares * ratio).toFixed(2); + _post.active_votes[i].reputation = getReputation(post.active_votes[i].reputation); + _post.active_votes[i].percent = post.active_votes[i].percent / 100; + _post.active_votes[i].created = getTimeFromNow(post.active_votes[i].time); + _post.active_votes[i].is_down_vote = Math.sign(post.active_votes[i].percent) < 0; + _post.active_votes[i].avatar = `https://steemitimages.com/u/${ + _post.active_votes[i].voter + }/avatar/small`; + } } - return post; + return _post; }; const isVoted = (activeVotes, currentUserName) => activeVotes.some(v => v.voter === currentUserName && v.percent > 0); From 92922235c4a7c5ba5e18772c10234bd6eecb7f6f Mon Sep 17 00:00:00 2001 From: u-e Date: Sat, 22 Dec 2018 22:26:28 +0300 Subject: [PATCH 02/19] changed opening post --- src/components/postCard/container/postCardContainer.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/postCard/container/postCardContainer.js b/src/components/postCard/container/postCardContainer.js index 23790fbf6..0134b283f 100644 --- a/src/components/postCard/container/postCardContainer.js +++ b/src/components/postCard/container/postCardContainer.js @@ -23,7 +23,7 @@ class PostCardContainer extends PureComponent { }; } - _handleOnUserPress = (username) => { + _handleOnUserPress = () => { const { navigation, currentAccount, content } = this.props; if (content && currentAccount.name !== content.author) { navigation.navigate({ @@ -32,7 +32,7 @@ class PostCardContainer extends PureComponent { username: content.author, reputation: content.author_reputation, }, - key: username, + key: content.author, }); } }; @@ -44,8 +44,7 @@ class PostCardContainer extends PureComponent { navigation.navigate({ routeName: ROUTES.SCREENS.POST, params: { - author: content.author, - permlink: content.permlink, + content, }, key: content.permlink, }); From 272f2fc7a159b1a3911477c39ade09d7a00aeb5c Mon Sep 17 00:00:00 2001 From: u-e Date: Sun, 23 Dec 2018 16:53:49 +0300 Subject: [PATCH 03/19] created scroll top && profile fetch --- .../bottomTabBar/view/bottomTabBarView.js | 2 +- .../editorElements/tagArea/view/tagAreaView.js | 2 +- src/components/posts/view/postsView.js | 11 ++++++++++- .../profileSummary/view/profileSummaryView.js | 1 - src/screens/home/container/homeContainer.js | 14 +++++++++++++- src/screens/home/screen/homeScreen.js | 5 +++-- src/screens/profile/container/profileContainer.js | 15 +++++++++------ 7 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/components/bottomTabBar/view/bottomTabBarView.js b/src/components/bottomTabBar/view/bottomTabBarView.js index a00d9064e..e9bc2fa84 100644 --- a/src/components/bottomTabBar/view/bottomTabBarView.js +++ b/src/components/bottomTabBar/view/bottomTabBarView.js @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import { TouchableWithoutFeedback, TouchableOpacity, SafeAreaView } from 'react-native'; +import { TouchableOpacity, SafeAreaView } from 'react-native'; import { connect } from 'react-redux'; import ViewOverflow from 'react-native-view-overflow'; diff --git a/src/components/editorElements/tagArea/view/tagAreaView.js b/src/components/editorElements/tagArea/view/tagAreaView.js index ddae03f9b..0e4aaa9d4 100644 --- a/src/components/editorElements/tagArea/view/tagAreaView.js +++ b/src/components/editorElements/tagArea/view/tagAreaView.js @@ -103,7 +103,7 @@ export default class TagAreaView extends Component { {chips.map((chip, i) => ( { + ref={(input) => { this.inputs[i] = input; }} isPin={i === 0 && chips[1]} diff --git a/src/components/posts/view/postsView.js b/src/components/posts/view/postsView.js index a8729a88d..6d34cd80d 100644 --- a/src/components/posts/view/postsView.js +++ b/src/components/posts/view/postsView.js @@ -39,6 +39,10 @@ class PostsView extends Component { componentWillReceiveProps(nextProps) { const { currentAccountUsername } = this.props; + if (nextProps.isScrollToTop) { + this.flatList.scrollToOffset({ x: 0, y: 0, animated: true }); + } + if ( currentAccountUsername !== nextProps.currentAccountUsername && nextProps.currentAccountUsername @@ -65,7 +69,9 @@ class PostsView extends Component { _loadPosts = (filter = null) => { const { getFor, tag, currentAccountUsername } = this.props; - const { posts, startAuthor, startPermlink, refreshing } = this.state; + const { + posts, startAuthor, startPermlink, refreshing, + } = this.state; let options; this.setState({ isLoading: true }); @@ -220,6 +226,9 @@ class PostsView extends Component { initialNumToRender={10} ListFooterComponent={this._renderFooter} onScrollBeginDrag={() => this._handleOnScrollStart()} + ref={(ref) => { + this.flatList = ref; + }} /> ) : isNoPost ? ( } - this.setState({ isScrollToTop: false })); + } + } // Component Functions render() { const { isLoggedIn, isLoginDone, currentAccount } = this.props; + const { isScrollToTop } = this.state; return ( ); } @@ -36,8 +46,10 @@ class HomeContainer extends PureComponent { const mapStateToProps = state => ({ isLoggedIn: state.application.isLoggedIn, isLoginDone: state.application.isLoginDone, + nav: state.nav, currentAccount: state.account.currentAccount, + activeBottomTab: state.ui.activeBottomTab, }); export default connect(mapStateToProps)(HomeContainer); diff --git a/src/screens/home/screen/homeScreen.js b/src/screens/home/screen/homeScreen.js index b60c65a94..b8dc93e80 100644 --- a/src/screens/home/screen/homeScreen.js +++ b/src/screens/home/screen/homeScreen.js @@ -20,7 +20,7 @@ class HomeScreen extends PureComponent { render() { const { - currentAccount, intl, isLoggedIn, isLoginDone, + currentAccount, intl, isLoggedIn, isLoginDone, isScrollToTop, } = this.props; const _filterOptions = [ 'NEW POSTS', @@ -65,6 +65,7 @@ class HomeScreen extends PureComponent { filterOptions={_filterOptions} getFor="feed" tag={tag || currentAccount.name} + isScrollToTop={isScrollToTop} /> - + diff --git a/src/screens/profile/container/profileContainer.js b/src/screens/profile/container/profileContainer.js index b8df81455..fb304fd3e 100644 --- a/src/screens/profile/container/profileContainer.js +++ b/src/screens/profile/container/profileContainer.js @@ -1,6 +1,6 @@ import React, { Component, Fragment } from 'react'; import { connect } from 'react-redux'; - +import { withNavigation } from 'react-navigation'; // Utilitites import { @@ -37,7 +37,7 @@ class ProfileContainer extends Component { } componentDidMount = () => { - const { navigation, isLoggedIn, currentAccount } = this.props; + const { navigation, isLoggedIn } = this.props; const selectedUser = navigation.state && navigation.state.params; if (!isLoggedIn && !selectedUser) { @@ -58,13 +58,11 @@ class ProfileContainer extends Component { } this.setState({ isReverseHeader: true }); - } else { - this._loadProfile(currentAccount.name); } }; componentWillReceiveProps(nextProps) { - const { navigation, currentAccount } = this.props; + const { navigation, currentAccount, activeBottomTab } = this.props; const currentUsername = currentAccount.name !== nextProps.currentAccount.name && nextProps.currentAccount.name; const isParamsChange = nextProps.navigation.state && navigation.state @@ -75,6 +73,10 @@ class ProfileContainer extends Component { this._loadProfile(currentUsername); } + if (activeBottomTab !== nextProps.activeBottomTab && nextProps.activeBottomTab === 'ProfileTabbar') { + this._loadProfile(currentAccount.name); + } + if (isParamsChange) { const selectedUser = nextProps.navigation.state && nextProps.navigation.state.params; @@ -296,6 +298,7 @@ const mapStateToProps = state => ({ isLoggedIn: state.application.isLoggedIn, currentAccount: state.account.currentAccount, isDarkTheme: state.application.isDarkTheme, + activeBottomTab: state.ui.activeBottomTab, }); -export default connect(mapStateToProps)(ProfileContainer); +export default connect(mapStateToProps)(withNavigation(ProfileContainer)); From c920cb266e6daa1226e3b911e0ff0adf2e0ec927 Mon Sep 17 00:00:00 2001 From: u-e Date: Mon, 24 Dec 2018 11:29:21 +0300 Subject: [PATCH 04/19] cfixed filters --- src/components/posts/view/postsView.js | 49 ++++++++++++++++++-------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/src/components/posts/view/postsView.js b/src/components/posts/view/postsView.js index 6d34cd80d..75ec476bf 100644 --- a/src/components/posts/view/postsView.js +++ b/src/components/posts/view/postsView.js @@ -37,9 +37,9 @@ class PostsView extends Component { } componentWillReceiveProps(nextProps) { - const { currentAccountUsername } = this.props; + const { currentAccountUsername, isScrollToTop } = this.props; - if (nextProps.isScrollToTop) { + if (this.flatList && isScrollToTop !== nextProps.isScrollToTop && nextProps.isScrollToTop) { this.flatList.scrollToOffset({ x: 0, y: 0, animated: true }); } @@ -67,16 +67,18 @@ class PostsView extends Component { } } - _loadPosts = (filter = null) => { + _loadPosts = () => { const { getFor, tag, currentAccountUsername } = this.props; const { - posts, startAuthor, startPermlink, refreshing, + posts, startAuthor, startPermlink, refreshing, selectedFilterIndex, } = this.state; + const filter = selectedFilterIndex !== 0 ? filters[selectedFilterIndex] : getFor; let options; + let newPosts = []; this.setState({ isLoading: true }); - if (!filter && tag) { + if (!filter && tag || filter === "feed") { options = { tag, limit: 3, @@ -92,20 +94,35 @@ class PostsView extends Component { options.start_permlink = startPermlink; } - getPostsSummary(filter || getFor, options, currentAccountUsername) + getPostsSummary(filter, options, currentAccountUsername) .then((result) => { if (result.length > 0) { let _posts = result; if (_posts.length > 0) { if (posts.length > 0) { - _posts.shift(); - _posts = [...posts, ..._posts]; + if (refreshing) { + newPosts = _posts.filter(post => posts.includes(post)); + _posts = [...newPosts, ...posts]; + } else { + _posts.shift(); + _posts = [...posts, ..._posts]; + } } + + if (refreshing && newPosts.length > 0) { + this.setState({ + posts: _posts, + }); + } else if (!refreshing) { + this.setState({ + posts: _posts, + startAuthor: result[result.length - 1] && result[result.length - 1].author, + startPermlink: result[result.length - 1] && result[result.length - 1].permlink, + }); + } + this.setState({ - posts: _posts, - startAuthor: result[result.length - 1] && result[result.length - 1].author, - startPermlink: result[result.length - 1] && result[result.length - 1].permlink, refreshing: false, isPostsLoading: false, }); @@ -146,12 +163,16 @@ class PostsView extends Component { return null; }; - _handleOnDropdownSelect = (index) => { - this.setState({ + _handleOnDropdownSelect = async (index) => { + await this.setState({ isPostsLoading: true, selectedFilterIndex: index, + posts: [], + startAuthor: '', + startPermlink: '', + isNoPost: false, }); - this._loadPosts(filters[index]); + this._loadPosts(); }; _onRightIconPress = () => { From 0a296e1ef66023e8993ea8cb4ecf0dd49e0fe578 Mon Sep 17 00:00:00 2001 From: u-e Date: Mon, 24 Dec 2018 12:25:41 +0300 Subject: [PATCH 05/19] fixed follower screen --- src/components/posts/view/postsView.js | 2 +- .../follows/container/followsContainer.js | 26 ++++++++++--------- src/screens/follows/screen/followsScreen.js | 8 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/components/posts/view/postsView.js b/src/components/posts/view/postsView.js index 75ec476bf..b5247ab1f 100644 --- a/src/components/posts/view/postsView.js +++ b/src/components/posts/view/postsView.js @@ -78,7 +78,7 @@ class PostsView extends Component { this.setState({ isLoading: true }); - if (!filter && tag || filter === "feed") { + if ((!filter && tag) || filter === 'feed' || getFor === 'blog') { options = { tag, limit: 3, diff --git a/src/screens/follows/container/followsContainer.js b/src/screens/follows/container/followsContainer.js index e1d7d443f..6447f341d 100644 --- a/src/screens/follows/container/followsContainer.js +++ b/src/screens/follows/container/followsContainer.js @@ -13,17 +13,17 @@ import { getFollowers, getFollowing, getFollowSearch } from '../../../providers/ import FollowsScreen from '../screen/followsScreen'; /* - * Props Name Description Value - *@props --> props name here description here Value Type Here - * - */ + * Props Name Description Value + *@props --> props name here description here Value Type Here + * + */ class FollowsContainer extends Component { constructor(props) { super(props); this.state = { username: null, - users: [], + users: null, count: null, isFollowingPress: null, startWith: '', @@ -44,7 +44,7 @@ class FollowsContainer extends Component { isFollowingPress, }); - await this._loadFollows(username, isFollowingPress); + this._loadFollows(username, isFollowingPress); } } @@ -56,7 +56,7 @@ class FollowsContainer extends Component { username, users, isFollowingPress, startWith, count, } = this.state; - if (users && count === users.length + 1) return; + if ((users && count < 100) || (users && count === users.length + 1)) return; const name = username || _username; const isFollowing = isFollowingPress || _isFollowingPress; @@ -66,16 +66,16 @@ class FollowsContainer extends Component { if (!isFollowing) { await getFollowers(name, startWith).then((result) => { _users = result; - _startWith = users && users[users.length - 1] && users[users.length - 1].follower; + _startWith = result && result[result.length - 1] && result[result.length - 1].follower; }); } else { await getFollowing(name, startWith).then((result) => { _users = result; - _startWith = users && users[users.length - 1] && users[users.length - 1].following; + _startWith = result && result[result.length - 1] && result[result.length - 1].following; }); } - !_username && _users.shift(); + if (!_username) _users.shift(); this.setState({ users: !_username ? [...users, ..._users] : _users, @@ -99,7 +99,10 @@ class FollowsContainer extends Component { newData = await getFollowSearch(username, text); } - this.setState({ filterResult: newData }); + this.setState({ + filterResult: newData, + isLoading: false, + }); }; _handleOnUserPress = (username) => { @@ -133,7 +136,6 @@ class FollowsContainer extends Component { isLoading={isLoading} handleSearch={this._handleSearch} handleOnUserPress={this._handleOnUserPress} - {...this.props} /> ); } diff --git a/src/screens/follows/screen/followsScreen.js b/src/screens/follows/screen/followsScreen.js index ae60842b8..ece07821e 100644 --- a/src/screens/follows/screen/followsScreen.js +++ b/src/screens/follows/screen/followsScreen.js @@ -21,9 +21,7 @@ class FollowsScreen extends PureComponent { constructor(props) { super(props); - this.state = { - data: props.data, - }; + this.state = {}; } // Component Life Cycles @@ -78,8 +76,8 @@ class FollowsScreen extends PureComponent { {(filterResult && data && filterResult.length > 0) || data.length > 0 ? ( item.voter} - onEndReached={loadMore} + keyExtractor={(item, index) => index.toString()} + onEndReached={() => loadMore()} removeClippedSubviews={false} renderItem={({ item, index }) => this._renderItem(item, index)} ListFooterComponent={this._renderFooter} From 3372838e7720501350d61f3f4227703bbef9959d Mon Sep 17 00:00:00 2001 From: u-e Date: Mon, 24 Dec 2018 12:58:54 +0300 Subject: [PATCH 06/19] routing usagusage from constant && enhanced --- src/components/bottomTabBar/view/bottomTabBarView.js | 4 ++-- src/redux/reducers/uiReducer.js | 2 +- src/screens/home/container/homeContainer.js | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/bottomTabBar/view/bottomTabBarView.js b/src/components/bottomTabBar/view/bottomTabBarView.js index e9bc2fa84..31eb734e6 100644 --- a/src/components/bottomTabBar/view/bottomTabBarView.js +++ b/src/components/bottomTabBar/view/bottomTabBarView.js @@ -1,4 +1,4 @@ -import React, { Component } from 'react'; +import React, { PureComponent } from 'react'; import { TouchableOpacity, SafeAreaView } from 'react-native'; import { connect } from 'react-redux'; import ViewOverflow from 'react-native-view-overflow'; @@ -13,7 +13,7 @@ import { updateActiveBottomTab } from '../../../redux/actions/uiAction'; // Styles import styles from './bottomTabBarStyles'; -class BottomTabBarView extends Component { +class BottomTabBarView extends PureComponent { /* Props * ------------------------------------------------ * @prop { type } name - Description.... diff --git a/src/redux/reducers/uiReducer.js b/src/redux/reducers/uiReducer.js index 2e1108508..19cf40f12 100644 --- a/src/redux/reducers/uiReducer.js +++ b/src/redux/reducers/uiReducer.js @@ -1,7 +1,7 @@ import { UPDATE_ACTIVE_BOTTOM_TAB, IS_COLLAPSE_POST_BUTTON } from '../constants/constants'; const initialState = { - activeBottomTab: 'Home', + activeBottomTab: 'HomeTabbar', isCollapsePostButton: false, }; diff --git a/src/screens/home/container/homeContainer.js b/src/screens/home/container/homeContainer.js index a47a69605..4ec741c0a 100644 --- a/src/screens/home/container/homeContainer.js +++ b/src/screens/home/container/homeContainer.js @@ -4,6 +4,8 @@ import { connect } from 'react-redux'; // Component import HomeScreen from '../screen/homeScreen'; +// Constants +import { default as ROUTES } from '../../../constants/routeNames'; /* * Props Name Description Value *@props --> props name here description here Value Type Here @@ -21,7 +23,10 @@ class HomeContainer extends PureComponent { // Component Life Cycle Functions componentWillReceiveProps(nextProps) { const { activeBottomTab } = this.props; - if (activeBottomTab === nextProps.activeBottomTab && nextProps.activeBottomTab === 'Home') { + if ( + activeBottomTab === nextProps.activeBottomTab + && nextProps.activeBottomTab === ROUTES.TABBAR.HOME + ) { this.setState({ isScrollToTop: true }, () => this.setState({ isScrollToTop: false })); } } From af7cd3808a56f99eadc91068abad31a6d8e2aef5 Mon Sep 17 00:00:00 2001 From: u-e Date: Mon, 24 Dec 2018 13:14:33 +0300 Subject: [PATCH 07/19] fixed #291 --- src/components/posts/view/postsStyles.js | 4 ++++ src/components/posts/view/postsView.js | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/components/posts/view/postsStyles.js b/src/components/posts/view/postsStyles.js index 1d1f9a70f..9e5fad34f 100644 --- a/src/components/posts/view/postsStyles.js +++ b/src/components/posts/view/postsStyles.js @@ -28,4 +28,8 @@ export default EStyleSheet.create({ marginBottom: 40, borderColor: '$borderColor', }, + noImage: { + width: 193, + height: 189, + }, }); diff --git a/src/components/posts/view/postsView.js b/src/components/posts/view/postsView.js index b5247ab1f..f4f67ae37 100644 --- a/src/components/posts/view/postsView.js +++ b/src/components/posts/view/postsView.js @@ -224,6 +224,7 @@ class PostsView extends Component { && !isLoggedIn && isLoginDone && ( ) : isNoPost ? ( Date: Mon, 24 Dec 2018 17:03:38 +0300 Subject: [PATCH 08/19] refactor notficationView && enhancment a bit --- .../notification/view/notificationView.js | 231 ++++++++---------- src/providers/steem/dsteem.js | 4 +- src/utils/postParser.js | 2 +- 3 files changed, 105 insertions(+), 132 deletions(-) diff --git a/src/components/notification/view/notificationView.js b/src/components/notification/view/notificationView.js index 2917e668e..564b0628b 100644 --- a/src/components/notification/view/notificationView.js +++ b/src/components/notification/view/notificationView.js @@ -19,9 +19,9 @@ import styles from './notificationStyles'; class NotificationView extends PureComponent { /* Props - * ------------------------------------------------ - * @prop { type } name - Description.... - */ + * ------------------------------------------------ + * @prop { type } name - Description.... + */ constructor(props) { super(props); this.state = { @@ -47,31 +47,96 @@ class NotificationView extends PureComponent { getActivities(filters[index].key); }; - render() { - const { - notifications, intl, navigateToNotificationRoute, readAllNotification, - } = this.props; - const { filters } = this.state; - const today = []; - const yesterday = []; - const thisWeek = []; - const thisMonth = []; - const olderThenMonth = []; + _renderList = (data) => { + const { navigateToNotificationRoute } = this.props; - notifications.map((item) => { - if (isToday(item.timestamp)) { - today.push(item); - } else if (isYesterday(item.timestamp)) { - yesterday.push(item); - } else if (isThisWeek(item.timestamp)) { - thisWeek.push(item); - } else if (isThisMonth(item.timestamp)) { - thisMonth.push(item); - } else { - olderThenMonth.push(item); - } + return ( + ( + + )} + keyExtractor={item => item.id} + /> + ); + }; + + _getNotificationsArrays = () => { + const { notifications, intl } = this.props; + + if (!notifications && notifications.length < 1) return null; + + const notificationArray = [ + { + title: intl.formatMessage({ + id: 'notification.recent', + }), + notifications: [], + }, + { + title: intl.formatMessage({ + id: 'notification.yesterday', + }), + notifications: [], + }, + { + title: intl.formatMessage({ + id: 'notification.this_week', + }), + notifications: [], + }, + { + title: intl.formatMessage({ + id: 'notification.this_month', + }), + notifications: [], + }, + { + title: intl.formatMessage({ + id: 'notification.older_then', + }), + notifications: [], + }, + ]; + + notifications.forEach((item) => { + const listIndex = this._getTimeListIndex(item.timestamp); + + notificationArray[listIndex].notifications.push(item); }); + return notificationArray; + }; + + _getTimeListIndex = (timestamp) => { + if (isToday(timestamp)) { + return 0; + } + + if (isYesterday(timestamp)) { + return 1; + } + + if (isThisWeek(timestamp)) { + return 2; + } + + if (isThisMonth(timestamp)) { + return 3; + } + + return 4; + }; + + render() { + const { readAllNotification } = this.props; + const { filters } = this.state; + + const _notifications = this._getNotificationsArrays(); + return ( - {today.length > 0 && ( - - - ( - - )} - keyExtractor={item => item.id} - /> - - )} - {yesterday.length > 0 && ( - - - ( - - )} - keyExtractor={item => item.id} - /> - - )} - {thisWeek.length > 0 && ( - - - ( - - )} - keyExtractor={item => item.id} - /> - - )} - {thisMonth.length > 0 && ( - - - ( - - )} - keyExtractor={item => item.id} - /> - - )} - {olderThenMonth.length > 0 && ( - - - ( - - )} - keyExtractor={item => item.id} - /> - - )} + + {_notifications + && _notifications.map( + item => item.notifications.length > 0 && ( + + + {this._renderList(item.notifications)} + + ), + )} + ); diff --git a/src/providers/steem/dsteem.js b/src/providers/steem/dsteem.js index 0bad02f3e..7ccd1dedb 100644 --- a/src/providers/steem/dsteem.js +++ b/src/providers/steem/dsteem.js @@ -246,7 +246,9 @@ export const getPosts = async (by, query, user) => { try { let posts = await client.database.getDiscussions(by, query); - posts = await parsePosts(posts, user); + if (posts) { + posts = await parsePosts(posts, user); + } return posts; } catch (error) { return error; diff --git a/src/utils/postParser.js b/src/utils/postParser.js index f0a772a05..6c5e760dd 100644 --- a/src/utils/postParser.js +++ b/src/utils/postParser.js @@ -22,7 +22,7 @@ export const parsePost = (post, currentUserName, isSummary = false) => { _post.active_votes.sort((a, b) => b.rshares - a.rshares); _post.body = markDown2Html(post.body); - if (isSummary) _post.summary = getPostSummary(post.body, 150); + _post.summary = getPostSummary(post.body, 150); if (currentUserName) { _post.is_voted = isVoted(_post.active_votes, currentUserName); From 6c6596d9a1fed1c4034b28a102642b3841514f80 Mon Sep 17 00:00:00 2001 From: u-e Date: Mon, 24 Dec 2018 17:53:32 +0300 Subject: [PATCH 09/19] enhanced notification ui --- .../view/containerHeaderStyles.js | 2 +- .../notification/view/notificationView.js | 21 +++++---- .../view/notificationLineView.js | 43 ++++++++++++------- src/config/locales/en-US.json | 2 +- src/config/locales/tr-TR.json | 4 +- 5 files changed, 42 insertions(+), 30 deletions(-) diff --git a/src/components/containerHeader/view/containerHeaderStyles.js b/src/components/containerHeader/view/containerHeaderStyles.js index 2e2efbe47..17264eb22 100644 --- a/src/components/containerHeader/view/containerHeaderStyles.js +++ b/src/components/containerHeader/view/containerHeaderStyles.js @@ -10,7 +10,7 @@ export default EStyleSheet.create({ }, hasTopBorder: { borderTopColor: '$borderTopColor', - borderTopWidth: 1, + borderTopWidth: 0.5, }, title: { fontFamily: '$primaryFont', diff --git a/src/components/notification/view/notificationView.js b/src/components/notification/view/notificationView.js index 564b0628b..8ccd31796 100644 --- a/src/components/notification/view/notificationView.js +++ b/src/components/notification/view/notificationView.js @@ -25,6 +25,7 @@ class NotificationView extends PureComponent { constructor(props) { super(props); this.state = { + // TODO: Remove filters from local state. filters: [ { key: 'activities', value: 'ALL ACTIVITIES' }, { key: 'votes', value: 'VOTES' }, @@ -148,17 +149,15 @@ class NotificationView extends PureComponent { onRightIconPress={readAllNotification} /> - - {_notifications - && _notifications.map( - item => item.notifications.length > 0 && ( - - - {this._renderList(item.notifications)} - - ), - )} - + {_notifications + && _notifications.map( + item => item.notifications.length > 0 && ( + + + {this._renderList(item.notifications)} + + ), + )} ); diff --git a/src/components/notificationLine/view/notificationLineView.js b/src/components/notificationLine/view/notificationLineView.js index 231845cda..bd7a27876 100644 --- a/src/components/notificationLine/view/notificationLineView.js +++ b/src/components/notificationLine/view/notificationLineView.js @@ -3,13 +3,12 @@ import { View, Text, Image, TouchableHighlight, } from 'react-native'; import { injectIntl } from 'react-intl'; -import FastImage from 'react-native-fast-image'; // Constants // Components +import { UserAvatar } from '../../userAvatar'; // Styles -// eslint-disable-next-line import styles from './notificationLineStyles'; class NotificationLineView extends PureComponent { @@ -20,31 +19,49 @@ class NotificationLineView extends PureComponent { constructor(props) { super(props); - this.state = {}; + this.state = { + isRead: props.notification.read, + }; } // Component Life Cycles // Component Functions + _handleOnNotificationPress = () => { + const { handleOnPressNotification, notification } = this.props; + const { isRead } = this.state; + + if (!isRead) this.setState({ isRead: true }); + + handleOnPressNotification(notification); + }; render() { const { notification, intl: { formatMessage }, - handleOnPressNotification, } = this.props; + const { isRead } = this.state; + + let _title = formatMessage({ + id: `notification.${notification.type}`, + }); + + if (notification.weight) { + const _percent = `${(notification.weight / 100).toFixed(0)}% `; + + _title = _percent + _title; + } return ( - handleOnPressNotification(notification)}> + this._handleOnNotificationPress()}> - @@ -52,11 +69,7 @@ class NotificationLineView extends PureComponent { {notification.source} {' '} - - {formatMessage({ - id: `notification.${notification.type}`, - })} - + {_title} {notification.description && ( diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index ff02edbf8..6cca1e315 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -10,7 +10,7 @@ "fill_order": "Fill Order" }, "notification": { - "vote": "voted to your post", + "vote": "likes your post", "unvote": "unvoted your post", "reply": "replied to your post", "mention": "mentioned you", diff --git a/src/config/locales/tr-TR.json b/src/config/locales/tr-TR.json index b4e3af36a..8cb231374 100644 --- a/src/config/locales/tr-TR.json +++ b/src/config/locales/tr-TR.json @@ -10,8 +10,8 @@ "fill_order": "Fill Order" }, "notification": { - "vote": "gönderini oyladı", - "unvote": "gonderini yukarı yönde oyladı", + "vote": "beğendi", + "unvote": "gonderini aşaği yönde oyladı", "reply": "gönderine cevap verdi", "mention": "seni etiketledi", "follow": "seni takip etti", From 71b46e119678000239ffd68f4b81518f340c9de5 Mon Sep 17 00:00:00 2001 From: u-e Date: Mon, 24 Dec 2018 18:38:35 +0300 Subject: [PATCH 10/19] intterop --- src/components/bottomTabBar/view/bottomTabBarStyles.js | 1 + src/components/filterBar/view/filterBarStyles.js | 2 +- src/components/postCard/view/postCardStyles.js | 1 - src/themes/darkTheme.js | 1 + src/themes/lightTheme.js | 1 + src/utils/postParser.js | 2 +- 6 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/bottomTabBar/view/bottomTabBarStyles.js b/src/components/bottomTabBar/view/bottomTabBarStyles.js index 562451617..651f4af0d 100644 --- a/src/components/bottomTabBar/view/bottomTabBarStyles.js +++ b/src/components/bottomTabBar/view/bottomTabBarStyles.js @@ -8,6 +8,7 @@ export default EStyleSheet.create({ backgroundColor: '$primaryBackgroundColor', borderTopWidth: 0.1, shadowOpacity: 0.1, + elevation: 3, }, safeArea: { backgroundColor: '$primaryBackgroundColor', diff --git a/src/components/filterBar/view/filterBarStyles.js b/src/components/filterBar/view/filterBarStyles.js index 18f6fef65..dd45cafcd 100644 --- a/src/components/filterBar/view/filterBarStyles.js +++ b/src/components/filterBar/view/filterBarStyles.js @@ -14,7 +14,7 @@ export default EStyleSheet.create({ alignSelf: 'center', }, rightIcon: { - color: '$primaryDarkText', + color: '$darkIconColor', textAlign: 'center', }, }); diff --git a/src/components/postCard/view/postCardStyles.js b/src/components/postCard/view/postCardStyles.js index 9d190da05..760c39bdd 100644 --- a/src/components/postCard/view/postCardStyles.js +++ b/src/components/postCard/view/postCardStyles.js @@ -7,7 +7,6 @@ export default EStyleSheet.create({ marginLeft: 0, marginTop: 5, marginBottom: 10, - borderRadius: 5, backgroundColor: '$primaryBackgroundColor', shadowOpacity: 0.2, shadowColor: '$shadowColor', diff --git a/src/themes/darkTheme.js b/src/themes/darkTheme.js index 63f81f612..b2365dafe 100644 --- a/src/themes/darkTheme.js +++ b/src/themes/darkTheme.js @@ -24,6 +24,7 @@ export default { $bubblesBlue: '#5CCDFF', $borderTopColor: '#757575', $iconColor: '#788187', + $darkIconColor: '#526d91', $dangerColor: '#fff', $warningColor: '#fff', $successColor: '#fff', diff --git a/src/themes/lightTheme.js b/src/themes/lightTheme.js index f2e91fdaf..d42ae3dcf 100644 --- a/src/themes/lightTheme.js +++ b/src/themes/lightTheme.js @@ -22,6 +22,7 @@ export default { $tagColor: '#c1c5c7', $bubblesBlue: '#5CCDFF', $iconColor: '#c1c5c7', + $darkIconColor: '#c1c5c7', $borderTopColor: '#cfcfcf', $dangerColor: '#fff', $warningColor: '#fff', diff --git a/src/utils/postParser.js b/src/utils/postParser.js index f0a772a05..5aa1d4133 100644 --- a/src/utils/postParser.js +++ b/src/utils/postParser.js @@ -22,7 +22,7 @@ export const parsePost = (post, currentUserName, isSummary = false) => { _post.active_votes.sort((a, b) => b.rshares - a.rshares); _post.body = markDown2Html(post.body); - if (isSummary) _post.summary = getPostSummary(post.body, 150); + if (isSummary) _post.summary = getPostSummary(_post.body, 150); if (currentUserName) { _post.is_voted = isVoted(_post.active_votes, currentUserName); From 8e59714902c67443604e71b0990ce6115db9b638 Mon Sep 17 00:00:00 2001 From: u-e Date: Tue, 25 Dec 2018 14:22:41 +0300 Subject: [PATCH 11/19] fixed ui bugs enhanced scrol lto top --- .../basicHeader/view/basicHeaderStyles.js | 2 +- .../basicUIElements/view/chip/chipStyle.js | 1 + .../basicUIElements/view/chip/chipView.js | 1 + .../bottomTabBar/view/bottomTabBarStyles.js | 2 +- .../bottomTabBar/view/bottomTabBarView.js | 24 +++++++++++-- .../tagArea/view/tagAreaStyles.js | 13 ------- .../titleArea/view/titleAreaStyles.js | 2 ++ .../titleArea/view/titleAreaView.js | 7 ++-- .../view/markdownEditorStyles.js | 1 + .../notification/view/notificationView.js | 6 ++-- .../postCard/view/postCardStyles.js | 2 +- src/components/posts/view/postsView.js | 34 +++++++++++++++---- src/components/tabBar/view/tabBarStyles.js | 5 --- src/globalStyles.js | 2 +- src/navigation/baseNavigator.js | 2 +- src/screens/home/container/homeContainer.js | 24 +------------ src/screens/home/screen/homeScreen.js | 5 ++- src/screens/home/screen/homeStyles.js | 2 ++ .../profile/container/profileContainer.js | 1 + src/screens/profile/screen/profileScreen.js | 4 ++- 20 files changed, 77 insertions(+), 63 deletions(-) diff --git a/src/components/basicHeader/view/basicHeaderStyles.js b/src/components/basicHeader/view/basicHeaderStyles.js index cbee00667..700b8bf9c 100644 --- a/src/components/basicHeader/view/basicHeaderStyles.js +++ b/src/components/basicHeader/view/basicHeaderStyles.js @@ -19,7 +19,7 @@ export default EStyleSheet.create({ saveIcon: { fontSize: 20, color: '$iconColor', - marginLeft: 10, + marginLeft: 15, }, savedIcon: { color: '#a1c982', diff --git a/src/components/basicUIElements/view/chip/chipStyle.js b/src/components/basicUIElements/view/chip/chipStyle.js index 6e01b879e..d1fbf35f1 100644 --- a/src/components/basicUIElements/view/chip/chipStyle.js +++ b/src/components/basicUIElements/view/chip/chipStyle.js @@ -9,6 +9,7 @@ export default EStyleSheet.create({ height: 20, padding: 5, paddingHorizontal: 10, + minWidth: 50, marginRight: 8, fontFamily: '$editorFont', }, diff --git a/src/components/basicUIElements/view/chip/chipView.js b/src/components/basicUIElements/view/chip/chipView.js index af61499fb..449f35c2e 100644 --- a/src/components/basicUIElements/view/chip/chipView.js +++ b/src/components/basicUIElements/view/chip/chipView.js @@ -6,6 +6,7 @@ import styles from './chipStyle'; const Chip = props => ( props.handleOnChange(text)} onBlur={() => props.handleOnBlur()} diff --git a/src/components/bottomTabBar/view/bottomTabBarStyles.js b/src/components/bottomTabBar/view/bottomTabBarStyles.js index 651f4af0d..e7f28b028 100644 --- a/src/components/bottomTabBar/view/bottomTabBarStyles.js +++ b/src/components/bottomTabBar/view/bottomTabBarStyles.js @@ -8,7 +8,7 @@ export default EStyleSheet.create({ backgroundColor: '$primaryBackgroundColor', borderTopWidth: 0.1, shadowOpacity: 0.1, - elevation: 3, + elevation: 10, }, safeArea: { backgroundColor: '$primaryBackgroundColor', diff --git a/src/components/bottomTabBar/view/bottomTabBarView.js b/src/components/bottomTabBar/view/bottomTabBarView.js index 31eb734e6..f285517df 100644 --- a/src/components/bottomTabBar/view/bottomTabBarView.js +++ b/src/components/bottomTabBar/view/bottomTabBarView.js @@ -7,6 +7,7 @@ import ViewOverflow from 'react-native-view-overflow'; import { updateActiveBottomTab } from '../../../redux/actions/uiAction'; // Constants +import { default as ROUTES } from '../../../constants/routeNames'; // Components @@ -37,6 +38,26 @@ class BottomTabBarView extends PureComponent { } // Component Functions + _jumpTo = (route) => { + const { + jumpTo, + navigation: { + state: { index, routes }, + }, + } = this.props; + + const _routeName = routes[index].routeName; + + if ( + !!route + && !!route.params + && !!route.params.scrollToTop + ) { + route.params.scrollToTop(); + } + + jumpTo(route.key); + }; render() { const { @@ -46,7 +67,6 @@ class BottomTabBarView extends PureComponent { activeTintColor, inactiveTintColor, renderIcon, - jumpTo, } = this.props; return ( @@ -60,7 +80,7 @@ class BottomTabBarView extends PureComponent { alignItems: 'center', }} > - jumpTo(route.key)}> + this._jumpTo(route)}> {renderIcon({ route, focused: index === idx, diff --git a/src/components/editorElements/tagArea/view/tagAreaStyles.js b/src/components/editorElements/tagArea/view/tagAreaStyles.js index 7c3cd48a0..b05257419 100644 --- a/src/components/editorElements/tagArea/view/tagAreaStyles.js +++ b/src/components/editorElements/tagArea/view/tagAreaStyles.js @@ -1,21 +1,8 @@ import EStyleSheet from 'react-native-extended-stylesheet'; export default EStyleSheet.create({ - textInput: { - color: '$primaryBackgroundColor', - fontSize: 10, - backgroundColor: '#c1c5c7', - borderRadius: 50, - maxHeight: 18, - padding: 5, - paddingHorizontal: 10, - marginRight: 8, - }, tagWrapper: { flexDirection: 'row', marginTop: 14, }, - firstTag: { - backgroundColor: '$primaryBlue', - }, }); diff --git a/src/components/editorElements/titleArea/view/titleAreaStyles.js b/src/components/editorElements/titleArea/view/titleAreaStyles.js index cebc8f79a..e4323dfd0 100644 --- a/src/components/editorElements/titleArea/view/titleAreaStyles.js +++ b/src/components/editorElements/titleArea/view/titleAreaStyles.js @@ -6,5 +6,7 @@ export default EStyleSheet.create({ fontWeight: 'bold', fontSize: 24, fontFamily: '$editorFont', + textAlignVertical: 'top', + paddingVertical: 0, }, }); diff --git a/src/components/editorElements/titleArea/view/titleAreaView.js b/src/components/editorElements/titleArea/view/titleAreaView.js index 651b82d26..dee904e5e 100644 --- a/src/components/editorElements/titleArea/view/titleAreaView.js +++ b/src/components/editorElements/titleArea/view/titleAreaView.js @@ -49,7 +49,7 @@ export default class TitleAreaView extends Component { return ( { + this.setState({ height: event.nativeEvent.contentSize.height }) + }} + autoFocus={autoFocus} onChangeText={text => this._handleOnChange(text)} value={text} /> diff --git a/src/components/markdownEditor/view/markdownEditorStyles.js b/src/components/markdownEditor/view/markdownEditorStyles.js index 0a0f9b144..991e9cc3c 100644 --- a/src/components/markdownEditor/view/markdownEditorStyles.js +++ b/src/components/markdownEditor/view/markdownEditorStyles.js @@ -15,6 +15,7 @@ export default EStyleSheet.create({ paddingHorizontal: 16, color: '$primaryBlack', fontFamily: '$editorFont', + textAlignVertical: 'top', }, inlinePadding: { padding: 8, diff --git a/src/components/notification/view/notificationView.js b/src/components/notification/view/notificationView.js index 2917e668e..8e0619c04 100644 --- a/src/components/notification/view/notificationView.js +++ b/src/components/notification/view/notificationView.js @@ -19,9 +19,9 @@ import styles from './notificationStyles'; class NotificationView extends PureComponent { /* Props - * ------------------------------------------------ - * @prop { type } name - Description.... - */ + * ------------------------------------------------ + * @prop { type } name - Description.... + */ constructor(props) { super(props); this.state = { diff --git a/src/components/postCard/view/postCardStyles.js b/src/components/postCard/view/postCardStyles.js index 760c39bdd..9f4f5cf6b 100644 --- a/src/components/postCard/view/postCardStyles.js +++ b/src/components/postCard/view/postCardStyles.js @@ -10,7 +10,7 @@ export default EStyleSheet.create({ backgroundColor: '$primaryBackgroundColor', shadowOpacity: 0.2, shadowColor: '$shadowColor', - elevation: 3, + elevation: 0.1, }, avatar: { width: 30, diff --git a/src/components/posts/view/postsView.js b/src/components/posts/view/postsView.js index f4f67ae37..b56701a57 100644 --- a/src/components/posts/view/postsView.js +++ b/src/components/posts/view/postsView.js @@ -1,5 +1,7 @@ import React, { Component, Fragment } from 'react'; -import { FlatList, View, ActivityIndicator } from 'react-native'; +import { + FlatList, View, ActivityIndicator, RefreshControl, +} from 'react-native'; import { injectIntl } from 'react-intl'; import { withNavigation } from 'react-navigation'; @@ -32,16 +34,21 @@ class PostsView extends Component { }; } + // Component Functions + componentWillMount() { + const { navigation } = this.props; + + navigation.setParams({ + scrollToTop: this._scrollToTop, + }); + } + componentDidMount() { this._loadPosts(); } componentWillReceiveProps(nextProps) { - const { currentAccountUsername, isScrollToTop } = this.props; - - if (this.flatList && isScrollToTop !== nextProps.isScrollToTop && nextProps.isScrollToTop) { - this.flatList.scrollToOffset({ x: 0, y: 0, animated: true }); - } + const { currentAccountUsername } = this.props; if ( currentAccountUsername !== nextProps.currentAccountUsername @@ -67,6 +74,10 @@ class PostsView extends Component { } } + _scrollToTop = () => { + if (this.flatList) this.flatList.scrollToOffset({ x: 0, y: 0, animated: true }); + }; + _loadPosts = () => { const { getFor, tag, currentAccountUsername } = this.props; const { @@ -203,6 +214,7 @@ class PostsView extends Component { const { filterOptions, intl, isLoggedIn, getFor, isLoginDone, tag, } = this.props; + /* eslint-disable */ return ( @@ -248,6 +260,16 @@ class PostsView extends Component { initialNumToRender={10} ListFooterComponent={this._renderFooter} onScrollBeginDrag={() => this._handleOnScrollStart()} + refreshControl={( + +)} ref={(ref) => { this.flatList = ref; }} diff --git a/src/components/tabBar/view/tabBarStyles.js b/src/components/tabBar/view/tabBarStyles.js index 62b5f9ff7..b64471746 100644 --- a/src/components/tabBar/view/tabBarStyles.js +++ b/src/components/tabBar/view/tabBarStyles.js @@ -10,11 +10,6 @@ export default EStyleSheet.create({ height: 50, flexDirection: 'row', justifyContent: 'space-around', - borderWidth: 1, - borderTopWidth: 0, - borderLeftWidth: 0, - borderRightWidth: 0, - borderColor: '$white', }, tabButton: { flex: 1, diff --git a/src/globalStyles.js b/src/globalStyles.js index 6403b0267..a99da5eb5 100644 --- a/src/globalStyles.js +++ b/src/globalStyles.js @@ -37,7 +37,7 @@ export default EStyleSheet.create({ padding: 5, height: 50, flex: 1, - color: '#ff1954', + color: '$primaryRed', paddingTop: 10, textAlign: 'center', }, diff --git a/src/navigation/baseNavigator.js b/src/navigation/baseNavigator.js index 82b3731d7..67b7d27cb 100644 --- a/src/navigation/baseNavigator.js +++ b/src/navigation/baseNavigator.js @@ -21,7 +21,7 @@ const BaseNavigator = createBottomTabNavigator( diff --git a/src/screens/home/container/homeContainer.js b/src/screens/home/container/homeContainer.js index 4ec741c0a..670fd4f44 100644 --- a/src/screens/home/container/homeContainer.js +++ b/src/screens/home/container/homeContainer.js @@ -4,8 +4,6 @@ import { connect } from 'react-redux'; // Component import HomeScreen from '../screen/homeScreen'; -// Constants -import { default as ROUTES } from '../../../constants/routeNames'; /* * Props Name Description Value *@props --> props name here description here Value Type Here @@ -15,34 +13,17 @@ import { default as ROUTES } from '../../../constants/routeNames'; class HomeContainer extends PureComponent { constructor(props) { super(props); - this.state = { - isScrollToTop: false, - }; + this.state = {}; } - // Component Life Cycle Functions - componentWillReceiveProps(nextProps) { - const { activeBottomTab } = this.props; - if ( - activeBottomTab === nextProps.activeBottomTab - && nextProps.activeBottomTab === ROUTES.TABBAR.HOME - ) { - this.setState({ isScrollToTop: true }, () => this.setState({ isScrollToTop: false })); - } - } - - // Component Functions - render() { const { isLoggedIn, isLoginDone, currentAccount } = this.props; - const { isScrollToTop } = this.state; return ( ); } @@ -51,10 +32,7 @@ class HomeContainer extends PureComponent { const mapStateToProps = state => ({ isLoggedIn: state.application.isLoggedIn, isLoginDone: state.application.isLoginDone, - nav: state.nav, - currentAccount: state.account.currentAccount, - activeBottomTab: state.ui.activeBottomTab, }); export default connect(mapStateToProps)(HomeContainer); diff --git a/src/screens/home/screen/homeScreen.js b/src/screens/home/screen/homeScreen.js index b8dc93e80..b60c65a94 100644 --- a/src/screens/home/screen/homeScreen.js +++ b/src/screens/home/screen/homeScreen.js @@ -20,7 +20,7 @@ class HomeScreen extends PureComponent { render() { const { - currentAccount, intl, isLoggedIn, isLoginDone, isScrollToTop, + currentAccount, intl, isLoggedIn, isLoginDone, } = this.props; const _filterOptions = [ 'NEW POSTS', @@ -65,7 +65,6 @@ class HomeScreen extends PureComponent { filterOptions={_filterOptions} getFor="feed" tag={tag || currentAccount.name} - isScrollToTop={isScrollToTop} /> - + diff --git a/src/screens/home/screen/homeStyles.js b/src/screens/home/screen/homeStyles.js index b2256c5fa..dc2bb057d 100644 --- a/src/screens/home/screen/homeStyles.js +++ b/src/screens/home/screen/homeStyles.js @@ -23,6 +23,8 @@ export default EStyleSheet.create({ shadowColor: '$shadowColor', shadowOffset: { height: 4 }, zIndex: 99, + borderBottomColor: '$shadowColor', + borderBottomWidth: 0.1, }, tabbarItem: { flex: 1, diff --git a/src/screens/profile/container/profileContainer.js b/src/screens/profile/container/profileContainer.js index fb304fd3e..76a15d128 100644 --- a/src/screens/profile/container/profileContainer.js +++ b/src/screens/profile/container/profileContainer.js @@ -67,6 +67,7 @@ class ProfileContainer extends Component { const isParamsChange = nextProps.navigation.state && navigation.state && nextProps.navigation.state.params + && nextProps.navigation.state.params.username && nextProps.navigation.state.params.username !== navigation.state.params.username; if (currentUsername) { diff --git a/src/screens/profile/screen/profileScreen.js b/src/screens/profile/screen/profileScreen.js index 7288822a7..150f10443 100644 --- a/src/screens/profile/screen/profileScreen.js +++ b/src/screens/profile/screen/profileScreen.js @@ -42,9 +42,10 @@ class ProfileScreen extends PureComponent { isProfileLoading, isReady, isReverseHeader, + navigation, + selectedQuickProfile, user, username, - selectedQuickProfile, } = this.props; let _about; let coverImage; @@ -131,6 +132,7 @@ class ProfileScreen extends PureComponent { getFor="blog" tag={username} key={username} + navigation={navigation} /> Date: Tue, 25 Dec 2018 14:32:37 +0300 Subject: [PATCH 12/19] remvoed missing line --- src/screens/profile/screen/profileScreen.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/screens/profile/screen/profileScreen.js b/src/screens/profile/screen/profileScreen.js index 150f10443..aa40ad258 100644 --- a/src/screens/profile/screen/profileScreen.js +++ b/src/screens/profile/screen/profileScreen.js @@ -42,7 +42,6 @@ class ProfileScreen extends PureComponent { isProfileLoading, isReady, isReverseHeader, - navigation, selectedQuickProfile, user, username, @@ -132,7 +131,6 @@ class ProfileScreen extends PureComponent { getFor="blog" tag={username} key={username} - navigation={navigation} /> Date: Tue, 25 Dec 2018 15:11:17 +0300 Subject: [PATCH 13/19] fixed #301 --- src/components/bottomTabBar/view/bottomTabBarView.js | 1 + src/components/postCard/container/postCardContainer.js | 6 ++++++ src/components/posts/view/postsView.js | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/bottomTabBar/view/bottomTabBarView.js b/src/components/bottomTabBar/view/bottomTabBarView.js index f285517df..bc5cdcda2 100644 --- a/src/components/bottomTabBar/view/bottomTabBarView.js +++ b/src/components/bottomTabBar/view/bottomTabBarView.js @@ -52,6 +52,7 @@ class BottomTabBarView extends PureComponent { !!route && !!route.params && !!route.params.scrollToTop + && _routeName === ROUTES.TABBAR.HOME ) { route.params.scrollToTop(); } diff --git a/src/components/postCard/container/postCardContainer.js b/src/components/postCard/container/postCardContainer.js index 0134b283f..4d02abdb4 100644 --- a/src/components/postCard/container/postCardContainer.js +++ b/src/components/postCard/container/postCardContainer.js @@ -23,6 +23,12 @@ class PostCardContainer extends PureComponent { }; } + componentWillReceiveProps(nextProps) { + if (nextProps.isRefresh) { + this._fetchPost(); + } + } + _handleOnUserPress = () => { const { navigation, currentAccount, content } = this.props; if (content && currentAccount.name !== content.author) { diff --git a/src/components/posts/view/postsView.js b/src/components/posts/view/postsView.js index b56701a57..f42dd556b 100644 --- a/src/components/posts/view/postsView.js +++ b/src/components/posts/view/postsView.js @@ -250,7 +250,7 @@ class PostsView extends Component { } + renderItem={({ item }) => } keyExtractor={(post, index) => index.toString()} onEndReached={() => this._loadPosts()} removeClippedSubviews From 65e402fe4bb3045907a99cb0c09c6a262c994666 Mon Sep 17 00:00:00 2001 From: Mustafa Buyukcelebi Date: Tue, 25 Dec 2018 15:21:34 +0300 Subject: [PATCH 14/19] Update src/components/bottomTabBar/view/bottomTabBarView.js Co-Authored-By: ue --- src/components/bottomTabBar/view/bottomTabBarView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/bottomTabBar/view/bottomTabBarView.js b/src/components/bottomTabBar/view/bottomTabBarView.js index f285517df..743e5b40e 100644 --- a/src/components/bottomTabBar/view/bottomTabBarView.js +++ b/src/components/bottomTabBar/view/bottomTabBarView.js @@ -7,7 +7,7 @@ import ViewOverflow from 'react-native-view-overflow'; import { updateActiveBottomTab } from '../../../redux/actions/uiAction'; // Constants -import { default as ROUTES } from '../../../constants/routeNames'; +import ROUTES from '../../../constants/routeNames'; // Components From 60a36eefcad847de366f58d5a21b912d81e9d61d Mon Sep 17 00:00:00 2001 From: u-e Date: Tue, 25 Dec 2018 15:22:01 +0300 Subject: [PATCH 15/19] updated rrefresh ui --- src/components/bottomTabBar/view/bottomTabBarView.js | 2 +- src/components/posts/container/postsContainer.js | 1 + src/components/posts/view/postsView.js | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/bottomTabBar/view/bottomTabBarView.js b/src/components/bottomTabBar/view/bottomTabBarView.js index bc5cdcda2..f4107d54f 100644 --- a/src/components/bottomTabBar/view/bottomTabBarView.js +++ b/src/components/bottomTabBar/view/bottomTabBarView.js @@ -7,7 +7,7 @@ import ViewOverflow from 'react-native-view-overflow'; import { updateActiveBottomTab } from '../../../redux/actions/uiAction'; // Constants -import { default as ROUTES } from '../../../constants/routeNames'; +import ROUTES from '../../../constants/routeNames'; // Components diff --git a/src/components/posts/container/postsContainer.js b/src/components/posts/container/postsContainer.js index 168922590..94b79dd7b 100644 --- a/src/components/posts/container/postsContainer.js +++ b/src/components/posts/container/postsContainer.js @@ -55,6 +55,7 @@ class PostsContainer extends PureComponent { const mapStateToProps = state => ({ currentAccount: state.account.currentAccount, + isDarkTheme: state.application.isDarkTheme, isLoggedIn: state.application.isLoggedIn, isLoginDone: state.application.isLoginDone, isCollapsePostButtonOpen: state.ui.isCollapsePostButton, diff --git a/src/components/posts/view/postsView.js b/src/components/posts/view/postsView.js index f42dd556b..0431bc2a8 100644 --- a/src/components/posts/view/postsView.js +++ b/src/components/posts/view/postsView.js @@ -212,7 +212,7 @@ class PostsView extends Component { isNoPost, } = this.state; const { - filterOptions, intl, isLoggedIn, getFor, isLoginDone, tag, + filterOptions, intl, isLoggedIn, getFor, isLoginDone, tag, isDarkTheme } = this.props; /* eslint-disable */ @@ -265,7 +265,7 @@ class PostsView extends Component { refreshing={this.state.refreshing} onRefresh={this._handleOnRefreshPosts} progressBackgroundColor="#357CE6" - tintColor="#fff" + tintColor={!isDarkTheme ? '#357ce6' : '#96c0ff'} titleColor="#fff" colors={["#fff"]} /> From d018110c6475ba5c2b4a3524960f8560052f2f6f Mon Sep 17 00:00:00 2001 From: u-e Date: Tue, 25 Dec 2018 17:54:45 +0300 Subject: [PATCH 16/19] created expand collapsible card && added dinamic size --- .../view/collapsibleCardView.js | 15 +++++++++++ .../percentBar/view/percentBarView.js | 2 ++ src/components/postCard/view/postCardView.js | 2 +- src/components/posts/view/postsView.js | 6 +++-- .../profileSummary/view/profileSummaryView.js | 16 +++++++++--- src/screens/profile/screen/profileScreen.js | 25 ++++++++++++++++++- 6 files changed, 58 insertions(+), 8 deletions(-) diff --git a/src/components/collapsibleCard/view/collapsibleCardView.js b/src/components/collapsibleCard/view/collapsibleCardView.js index c11df4bf5..1149cdc88 100644 --- a/src/components/collapsibleCard/view/collapsibleCardView.js +++ b/src/components/collapsibleCard/view/collapsibleCardView.js @@ -33,6 +33,18 @@ class CollapsibleCardView extends PureComponent { }; } + componentWillReceiveProps(nextProps) { + const { isExpanded, moreHeight } = this.props; + + if (!nextProps.isExpanded && isExpanded !== nextProps.isExpanded) { + this._toggleOnPress(); + } + + if (moreHeight !== nextProps.moreHeight) { + this.anime.height.setValue(this._getMaxValue() + nextProps.moreHeight); + } + } + // Component Functions _initContentHeight = (event) => { if (this.anime.contentHeight > 0) return; @@ -45,6 +57,7 @@ class CollapsibleCardView extends PureComponent { _getMinValue = () => 0; _toggleOnPress = () => { + const { handleOnExpanded } = this.props; Animated.timing(this.anime.height, { toValue: this.anime.expanded ? this._getMinValue() : this._getMaxValue(), duration: 200, @@ -54,6 +67,8 @@ class CollapsibleCardView extends PureComponent { this.setState({ expanded: this.anime.expanded, }); + + if (handleOnExpanded && this.anime.expanded) handleOnExpanded(); }; render() { diff --git a/src/components/percentBar/view/percentBarView.js b/src/components/percentBar/view/percentBarView.js index b9290ea28..078a6ff7b 100644 --- a/src/components/percentBar/view/percentBarView.js +++ b/src/components/percentBar/view/percentBarView.js @@ -39,6 +39,8 @@ class PercentBarView extends PureComponent { _getText = (textColor, text, isTop, isRender) => { const { isShowText } = this.props; + if (!isShowText) return null; + if (isTop === isRender && text) { return ( diff --git a/src/components/postCard/view/postCardView.js b/src/components/postCard/view/postCardView.js index 44f4cdae3..14824b9e4 100644 --- a/src/components/postCard/view/postCardView.js +++ b/src/components/postCard/view/postCardView.js @@ -58,7 +58,7 @@ class PostCard extends Component { const { content, isHideImage, fetchPost } = this.props; const _image = content && content.image ? { uri: content.image, priority: FastImage.priority.high } - : DEFAULT_IMAGE; + :{ uri: content.image, priority: FastImage.priority.high }; return ( diff --git a/src/components/posts/view/postsView.js b/src/components/posts/view/postsView.js index 0431bc2a8..068febb9d 100644 --- a/src/components/posts/view/postsView.js +++ b/src/components/posts/view/postsView.js @@ -193,8 +193,10 @@ class PostsView extends Component { }; _handleOnScrollStart = () => { - const { handleOnScrollStart } = this.props; + const { handleOnScrollStart, handleOnScroll } = this.props; handleOnScrollStart(); + + if (handleOnScroll) handleOnScroll(); }; _handleOnPressLogin = () => { @@ -212,7 +214,7 @@ class PostsView extends Component { isNoPost, } = this.state; const { - filterOptions, intl, isLoggedIn, getFor, isLoginDone, tag, isDarkTheme + filterOptions, intl, isLoggedIn, getFor, isLoginDone, tag, isDarkTheme, handleOnScroll, } = this.props; /* eslint-disable */ diff --git a/src/components/profileSummary/view/profileSummaryView.js b/src/components/profileSummary/view/profileSummaryView.js index cd34e82ea..d47cca2ab 100644 --- a/src/components/profileSummary/view/profileSummaryView.js +++ b/src/components/profileSummary/view/profileSummaryView.js @@ -32,7 +32,7 @@ class ProfileSummaryView extends PureComponent { constructor(props) { super(props); this.state = { - isShowPercentText: false, + isShowPercentText: props.isShowPercentText, }; } @@ -66,6 +66,7 @@ class ProfileSummaryView extends PureComponent { location, percentRC, percentVP, + handleUIChange, } = this.props; const votingPowerHoursText = hoursVP && `• Full in ${hoursVP} hours`; const votingPowerText = `Voting power: ${percentVP}% ${votingPowerHoursText || ''}`; @@ -84,6 +85,7 @@ class ProfileSummaryView extends PureComponent { const isColumn = rowLength && DEVICE_WIDTH / rowLength <= 15; const followButtonIcon = !isFollowing ? 'user-follow' : 'user-unfollow'; const ignoreButtonIcon = !isMuted ? 'ban' : 'minus'; + const coverImageUrl = `http://img.esteem.app/400x0/${coverImage}`; return ( @@ -101,10 +103,16 @@ class ProfileSummaryView extends PureComponent { - this.setState({ isShowPercentText: !isShowPercentText })}> + + this.setState({ isShowPercentText: !isShowPercentText }, () => { + handleUIChange(isShowPercentText ? 0 : 30); + }) + } + > { + const { isSummaryOpen } = this.state; + + if (isSummaryOpen) this.setState({ isSummaryOpen: false }); + }; + + _handleOnSummaryExpanded = () => { + this.setState({ isSummaryOpen: true }); + }; + + _handleUIChange = (height) => { + this.setState({ collapsibleMoreHeight: height }); + }; + render() { const { about, @@ -46,6 +63,7 @@ class ProfileScreen extends PureComponent { user, username, } = this.props; + const { isSummaryOpen, collapsibleMoreHeight } = this.state; let _about; let coverImage; let location; @@ -86,6 +104,9 @@ class ProfileScreen extends PureComponent { id: 'profile.details', })} expanded + isExpanded={isSummaryOpen} + handleOnExpanded={this._handleOnSummaryExpanded} + moreHeight={collapsibleMoreHeight} // expanded={isLoggedIn} // locked={!isLoggedIn} > @@ -110,6 +131,7 @@ class ProfileScreen extends PureComponent { location={location} percentRC={resourceCredits} percentVP={votingPower} + handleUIChange={this._handleUIChange} /> )} @@ -131,6 +153,7 @@ class ProfileScreen extends PureComponent { getFor="blog" tag={username} key={username} + handleOnScroll={this._handleOnScroll} /> Date: Tue, 25 Dec 2018 17:55:12 +0300 Subject: [PATCH 17/19] missing lines --- src/components/postCard/view/postCardView.js | 2 +- src/components/profileSummary/view/profileSummaryView.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/postCard/view/postCardView.js b/src/components/postCard/view/postCardView.js index 14824b9e4..44f4cdae3 100644 --- a/src/components/postCard/view/postCardView.js +++ b/src/components/postCard/view/postCardView.js @@ -58,7 +58,7 @@ class PostCard extends Component { const { content, isHideImage, fetchPost } = this.props; const _image = content && content.image ? { uri: content.image, priority: FastImage.priority.high } - :{ uri: content.image, priority: FastImage.priority.high }; + : DEFAULT_IMAGE; return ( diff --git a/src/components/profileSummary/view/profileSummaryView.js b/src/components/profileSummary/view/profileSummaryView.js index d47cca2ab..8787579c0 100644 --- a/src/components/profileSummary/view/profileSummaryView.js +++ b/src/components/profileSummary/view/profileSummaryView.js @@ -104,7 +104,7 @@ class ProfileSummaryView extends PureComponent { From 58078e1e116f09cec5fe84a0dd202f375873a605 Mon Sep 17 00:00:00 2001 From: u-e Date: Tue, 25 Dec 2018 18:10:51 +0300 Subject: [PATCH 18/19] updated a bit --- src/components/posts/view/postsView.js | 23 +++++++++++++------ .../profile/container/profileContainer.js | 11 ++++++++- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/components/posts/view/postsView.js b/src/components/posts/view/postsView.js index 068febb9d..e184280df 100644 --- a/src/components/posts/view/postsView.js +++ b/src/components/posts/view/postsView.js @@ -214,9 +214,14 @@ class PostsView extends Component { isNoPost, } = this.state; const { - filterOptions, intl, isLoggedIn, getFor, isLoginDone, tag, isDarkTheme, handleOnScroll, + filterOptions, + intl, + isLoggedIn, + getFor, + isLoginDone, + tag, + isDarkTheme, } = this.props; - /* eslint-disable */ return ( @@ -248,11 +253,13 @@ class PostsView extends Component { )} - {posts && posts.length > 0 && !isPostsLoading ? ( + {posts && posts.length > 0 && !isPostsLoading && ( } + renderItem={({ item }) => ( + + )} keyExtractor={(post, index) => index.toString()} onEndReached={() => this._loadPosts()} removeClippedSubviews @@ -264,19 +271,21 @@ class PostsView extends Component { onScrollBeginDrag={() => this._handleOnScrollStart()} refreshControl={( )} ref={(ref) => { this.flatList = ref; }} /> - ) : isNoPost ? ( + )} + + {isNoPost ? ( { From 2a1a296280a5b1fae67da0023aff4ae2af39416d Mon Sep 17 00:00:00 2001 From: Fil Dunsky Date: Wed, 26 Dec 2018 22:00:42 +0300 Subject: [PATCH 19/19] Navbar Feed icon change proposal --- src/navigation/baseNavigator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/navigation/baseNavigator.js b/src/navigation/baseNavigator.js index 67b7d27cb..812c84a97 100644 --- a/src/navigation/baseNavigator.js +++ b/src/navigation/baseNavigator.js @@ -21,7 +21,7 @@ const BaseNavigator = createBottomTabNavigator(