diff --git a/src/components/postView/container/postDisplayContainer.js b/src/components/postView/container/postDisplayContainer.js index 2618076c8..fefb825a9 100644 --- a/src/components/postView/container/postDisplayContainer.js +++ b/src/components/postView/container/postDisplayContainer.js @@ -51,6 +51,18 @@ class PostDisplayContainer extends Component { }); }; + _handleOnReblogsPress = reblogs => { + const { navigation, post } = this.props; + + navigation.navigate({ + routeName: ROUTES.SCREENS.REBLOGS, + params: { + reblogs, + }, + key: post.permlink + Math.random(), + }); + }; + _handleOnReplyPress = () => { const { post, navigation } = this.props; @@ -123,6 +135,7 @@ class PostDisplayContainer extends Component { handleOnRemovePress={this._handleDeleteComment} handleOnReplyPress={this._handleOnReplyPress} handleOnVotersPress={this._handleOnVotersPress} + handleOnReblogsPress={this._handleOnReblogsPress} isLoggedIn={isLoggedIn} isNewPost={isNewPost} isPostUnavailable={isPostUnavailable} diff --git a/src/components/postView/view/postDisplayView.js b/src/components/postView/view/postDisplayView.js index 8263106e2..dab0040fd 100644 --- a/src/components/postView/view/postDisplayView.js +++ b/src/components/postView/view/postDisplayView.js @@ -71,6 +71,7 @@ class PostDisplayView extends PureComponent { handleOnEditPress, handleOnReplyPress, handleOnVotersPress, + handleOnReblogsPress, isLoggedIn, post, } = this.props; @@ -101,6 +102,7 @@ class PostDisplayView extends PureComponent { iconStyle={styles.barIcons} iconType="MaterialIcons" isClickable + onPress={() => handleOnReblogsPress && handleOnReblogsPress(get(post, 'reblogs'))} text={get(post, 'reblogCount', 0)} textMarginLeft={20} /> diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index 8d82b4bf4..d5e2d62a1 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -326,5 +326,8 @@ "rewards": "REWARDS", "percent": "PERCENT", "time": "TIME" + }, + "reblog": { + "title": "Reblog Info" } } diff --git a/src/constants/routeNames.js b/src/constants/routeNames.js index e97ae65c7..1fedf0c9e 100644 --- a/src/constants/routeNames.js +++ b/src/constants/routeNames.js @@ -23,6 +23,7 @@ export default { BOOST_POST: `BoostPost${SCREEN_SUFFIX}`, PROMOTE: `Promote${SCREEN_SUFFIX}`, FREE_ESTM: `FreeEstm${SCREEN_SUFFIX}`, + REBLOGS: `Reblogs${SCREEN_SUFFIX}`, }, DRAWER: { MAIN: `Main${DRAWER_SUFFIX}`, diff --git a/src/containers/accountListContainer.js b/src/containers/accountListContainer.js index 44a616795..36280cc2d 100644 --- a/src/containers/accountListContainer.js +++ b/src/containers/accountListContainer.js @@ -2,6 +2,8 @@ import { PureComponent } from 'react'; import { isBefore } from '../utils/time'; +import ROUTES from '../constants/routeNames'; + class AccountListContainer extends PureComponent { /* Props * ------------------------------------------------ @@ -54,6 +56,18 @@ class AccountListContainer extends PureComponent { this.setState({ filterResult: _data }); }; + _handleOnUserPress = username => { + const { navigation } = this.props; + + navigation.navigate({ + routeName: ROUTES.SCREENS.PROFILE, + params: { + username, + }, + key: username, + }); + }; + render() { const { data, filterResult } = this.state; const { children } = this.props; @@ -65,6 +79,7 @@ class AccountListContainer extends PureComponent { filterResult, handleOnVotersDropdownSelect: this._handleOnVotersDropdownSelect, handleSearch: this._handleSearch, + handleOnUserPress: this._handleOnUserPress, }) ); } diff --git a/src/navigation/routes.js b/src/navigation/routes.js index d181f50f8..026349ec2 100644 --- a/src/navigation/routes.js +++ b/src/navigation/routes.js @@ -24,6 +24,7 @@ import { Boost, Promote, BoostPost, + Reblogs, } from '../screens'; // Components @@ -126,6 +127,12 @@ const stackNavigatior = createStackNavigator( header: () => null, }, }, + [ROUTES.SCREENS.REBLOGS]: { + screen: Reblogs, + navigationOptions: { + header: () => null, + }, + }, }, { headerMode: 'none', diff --git a/src/screens/index.js b/src/screens/index.js index 744fa02e3..c1821be36 100755 --- a/src/screens/index.js +++ b/src/screens/index.js @@ -18,6 +18,7 @@ import BoostPost from './boostPost/screen/boostPostScreen'; import Promote from './promote/screen/promoteScreen'; import SteemConnect from './steem-connect/steemConnect'; import Transfer from './transfer'; +import Reblogs from './reblogs'; export { Bookmarks, @@ -40,4 +41,5 @@ export { SteemConnect, Transfer, Voters, + Reblogs, }; diff --git a/src/screens/reblogs/index.js b/src/screens/reblogs/index.js new file mode 100644 index 000000000..c4615020d --- /dev/null +++ b/src/screens/reblogs/index.js @@ -0,0 +1 @@ +export { default } from './screen/reblogScreen'; diff --git a/src/screens/reblogs/screen/reblogScreen.js b/src/screens/reblogs/screen/reblogScreen.js index b56629256..b3b0b3f53 100644 --- a/src/screens/reblogs/screen/reblogScreen.js +++ b/src/screens/reblogs/screen/reblogScreen.js @@ -1,50 +1,59 @@ -import React, { PureComponent } from 'react'; -import { View } from 'react-native'; -import { injectIntl } from 'react-intl'; +import React from 'react'; +import { View, FlatList } from 'react-native'; +import { useIntl } from 'react-intl'; // Constants // Components import { BasicHeader } from '../../../components/basicHeader'; -import { FilterBar } from '../../../components/filterBar'; -import { VotersDisplay } from '../../../components/votersDisplay'; +import { UserListItem } from '../../../components/basicUIElements'; import AccountListContainer from '../../../containers/accountListContainer'; // Utils import globalStyles from '../../../globalStyles'; +import { getTimeFromNow } from '../../../utils/time'; -class ReblogScreen extends PureComponent { - render() { - const { intl, navigation } = this.props; - const headerTitle = intl.formatMessage({ - id: 'voters.voters_info', - }); +const renderUserListItem = (item, index, handleOnUserPress) => { + return ( + handleOnUserPress(item.account)} + isClickable + /> + ); +}; - const activeVotes = - navigation.state && navigation.state.params && navigation.state.params.activeVotes; +const ReblogScreen = ({ navigation }) => { + const intl = useIntl(); + const headerTitle = intl.formatMessage({ + id: 'reblog.title', + }); - return ( - - {({ data, filterResult, handleOnVotersDropdownSelect, handleSearch }) => ( - - handleSearch(text, 'voter')} - /> - - - - )} - - ); - } -} + const activeVotes = + navigation.state && navigation.state.params && navigation.state.params.reblogs; -export default injectIntl(ReblogScreen); + return ( + + {({ data, filterResult, handleSearch, handleOnUserPress }) => ( + + handleSearch(text, 'account')} + /> + item.account} + removeClippedSubviews={false} + renderItem={({ item, index }) => renderUserListItem(item, index, handleOnUserPress)} + /> + + )} + + ); +}; + +export default ReblogScreen; diff --git a/src/utils/postParser.js b/src/utils/postParser.js index 03f9b5e49..ce42bb189 100644 --- a/src/utils/postParser.js +++ b/src/utils/postParser.js @@ -67,8 +67,8 @@ export const parsePost = async (post, currentUserName, isPromoted) => { }); } - const postReblogs = await getPostReblogs(post); - post.reblogCount = postReblogs.length; + post.reblogs = await getPostReblogs(post); + post.reblogCount = post.reblogs.length; return post; };