mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-20 11:51:52 +03:00
voters screen bug fixed
This commit is contained in:
parent
3e100a18b1
commit
7dc3fb8c6a
@ -34,13 +34,15 @@ class PostDisplayContainer extends Component {
|
||||
|
||||
// Component Functions
|
||||
_handleOnVotersPress = (activeVotes) => {
|
||||
const { navigation } = this.props;
|
||||
const { navigation, post } = this.props;
|
||||
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.VOTERS,
|
||||
params: {
|
||||
activeVotes,
|
||||
},
|
||||
// TODO: make unic
|
||||
key: post.permlink + Math.random(),
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import { withNavigation } from 'react-navigation';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
// Services and Actions
|
||||
import { search } from '../../../providers/esteem/esteem';
|
||||
@ -45,6 +46,7 @@ class SearchModalContainer extends PureComponent {
|
||||
const users = res.map(item => ({
|
||||
image: `https://steemitimages.com/u/${item}/avatar/small`,
|
||||
text: item,
|
||||
...item,
|
||||
}));
|
||||
this.setState({ searchResults: { type: 'user', data: users } });
|
||||
});
|
||||
@ -52,6 +54,7 @@ class SearchModalContainer extends PureComponent {
|
||||
getTrendingTags(text.substr(1)).then((res) => {
|
||||
const tags = res.map(item => ({
|
||||
text: `#${item.name}`,
|
||||
...item,
|
||||
}));
|
||||
|
||||
this.setState({ searchResults: { type: 'tag', data: tags } });
|
||||
@ -63,6 +66,7 @@ class SearchModalContainer extends PureComponent {
|
||||
.map(item => ({
|
||||
image: item.img_url || `https://steemitimages.com/u/${item.author}/avatar/small`,
|
||||
text: item.title,
|
||||
...item,
|
||||
}));
|
||||
this.setState({ searchResults: { type: 'content', data: res.results } });
|
||||
});
|
||||
@ -71,7 +75,7 @@ class SearchModalContainer extends PureComponent {
|
||||
};
|
||||
|
||||
_handleOnPressListItem = (type, item) => {
|
||||
const { navigation, handleOnClose } = this.props;
|
||||
const { navigation, handleOnClose, username } = this.props;
|
||||
let routeName = null;
|
||||
let params = null;
|
||||
let key = null;
|
||||
@ -81,7 +85,7 @@ class SearchModalContainer extends PureComponent {
|
||||
|
||||
switch (type) {
|
||||
case 'user':
|
||||
routeName = ROUTES.SCREENS.PROFILE;
|
||||
routeName = item.text === username ? ROUTES.TABBAR.PROFILE : ROUTES.SCREENS.PROFILE;
|
||||
params = {
|
||||
username: item.text,
|
||||
};
|
||||
@ -118,6 +122,7 @@ class SearchModalContainer extends PureComponent {
|
||||
render() {
|
||||
const { searchResults } = this.state;
|
||||
const { handleOnClose, isOpen, placeholder } = this.props;
|
||||
|
||||
return (
|
||||
<SearchModalView
|
||||
searchResults={searchResults}
|
||||
@ -132,4 +137,8 @@ class SearchModalContainer extends PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
export default withNavigation(SearchModalContainer);
|
||||
const mapStateToProps = state => ({
|
||||
username: state.account.currentAccount.name,
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps)(withNavigation(SearchModalContainer));
|
||||
|
@ -67,7 +67,7 @@ export default EStyleSheet.create({
|
||||
borderColor: '$primaryGray',
|
||||
},
|
||||
searchItemText: {
|
||||
color: '$white',
|
||||
color: '$pureWhite',
|
||||
marginLeft: 10,
|
||||
},
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
import {
|
||||
View, Text, FlatList, TouchableHighlight, SafeAreaView,
|
||||
View, Text, FlatList, TouchableOpacity, SafeAreaView,
|
||||
} from 'react-native';
|
||||
|
||||
import FastImage from 'react-native-fast-image';
|
||||
@ -58,7 +58,8 @@ class SearchModalView extends PureComponent {
|
||||
data={searchResults.data}
|
||||
showsVerticalScrollIndicator={false}
|
||||
renderItem={({ item }) => (
|
||||
<TouchableHighlight onPress={() => handleOnPressListItem(searchResults.type, item)}>
|
||||
// TODO: Make it quick ui component
|
||||
<TouchableOpacity onPress={() => handleOnPressListItem(searchResults.type, item)}>
|
||||
<View style={styles.searhItems}>
|
||||
<View style={styles.searchItemImageWrapper}>
|
||||
{item.image && (
|
||||
@ -74,7 +75,7 @@ class SearchModalView extends PureComponent {
|
||||
{item.text && <Text style={styles.searchItemText}>{item.text}</Text>}
|
||||
</View>
|
||||
</View>
|
||||
</TouchableHighlight>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
keyExtractor={(post, index) => index.toString()}
|
||||
removeClippedSubviews
|
||||
|
@ -1,5 +1,8 @@
|
||||
import React, { PureComponent } from 'react';
|
||||
|
||||
// Constants
|
||||
import ROUTES from '../../../constants/routeNames';
|
||||
|
||||
// Component
|
||||
import VotersDisplayView from '../view/votersDisplayView';
|
||||
|
||||
@ -15,6 +18,18 @@ class VotersDisplayContainer extends PureComponent {
|
||||
this.state = {};
|
||||
}
|
||||
|
||||
handleOnUserPress = (username) => {
|
||||
const { navigation } = this.props;
|
||||
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.PROFILE,
|
||||
params: {
|
||||
username,
|
||||
},
|
||||
key: username,
|
||||
});
|
||||
};
|
||||
|
||||
render() {
|
||||
const { votes } = this.props;
|
||||
|
||||
|
@ -19,7 +19,7 @@ class VotersDisplayView extends PureComponent {
|
||||
|
||||
// Component Functions
|
||||
_renderItem = (item, index) => {
|
||||
const { intl } = this.props;
|
||||
const { handleOnUserPress } = this.props;
|
||||
const value = `$ ${item.value}`;
|
||||
const percent = `${item.percent}%`;
|
||||
|
||||
@ -27,11 +27,12 @@ class VotersDisplayView extends PureComponent {
|
||||
<UserListItem
|
||||
index={index}
|
||||
username={item.voter}
|
||||
// description={intl.formatRelative(item.time)}
|
||||
description={getTimeFromNow(item.time)}
|
||||
isHasRightItem
|
||||
isRightColor={item.is_down_vote}
|
||||
rightText={value}
|
||||
handleOnPress={handleOnUserPress(item.voter)}
|
||||
isClickable
|
||||
subRightText={percent}
|
||||
/>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user