This commit is contained in:
u-e 2019-01-11 14:00:08 +03:00
commit 8ad0944dcc
39 changed files with 528 additions and 264 deletions

View File

@ -1,10 +1,9 @@
import React from 'react';
import { View, Text, TouchableOpacity } from 'react-native';
import FastImage from 'react-native-fast-image';
import { UserAvatar } from '../../../userAvatar';
import styles from './userListItemStyles';
const UserListItem = ({
avatar,
rightText,
description,
username,
@ -12,34 +11,41 @@ const UserListItem = ({
index,
isRightColor,
isHasRightItem,
handleOnUserPress,
isBlackRightColor,
itemIndex,
userCanPress,
handleOnPress,
handleOnLongPress,
isClickable,
}) => (
<View style={[styles.voteItemWrapper, index % 2 !== 0 && styles.voteItemWrapperGray]}>
{itemIndex && <Text style={styles.itemIndex}>{itemIndex}</Text>}
<TouchableOpacity onPress={() => handleOnUserPress(username)}>
<FastImage style={[styles.avatar]} source={{ uri: avatar }} />
</TouchableOpacity>
<View style={styles.userDescription}>
<Text style={styles.name}>{username}</Text>
{description && <Text style={styles.date}>{description}</Text>}
</View>
{isHasRightItem && (
<View style={styles.rightWrapper}>
<Text
style={[
styles.value,
isRightColor && styles.valueGray,
isBlackRightColor && styles.valueBlack,
]}
>
{rightText}
</Text>
{subRightText && <Text style={styles.text}>{subRightText}</Text>}
<TouchableOpacity
onLongPress={() => handleOnLongPress && handleOnLongPress()}
disabled={!isClickable}
onPress={() => handleOnPress && handleOnPress()}
>
<View style={[styles.voteItemWrapper, index % 2 !== 0 && styles.voteItemWrapperGray]}>
{itemIndex && <Text style={styles.itemIndex}>{itemIndex}</Text>}
<UserAvatar noAction={userCanPress} style={styles.avatar} username={username} />
<View style={styles.userDescription}>
<Text style={styles.name}>{username}</Text>
{description && <Text style={styles.date}>{description}</Text>}
</View>
)}
</View>
{isHasRightItem && (
<View style={styles.rightWrapper}>
<Text
style={[
styles.value,
isRightColor && styles.valueGray,
isBlackRightColor && styles.valueBlack,
]}
>
{rightText}
</Text>
{subRightText && <Text style={styles.text}>{subRightText}</Text>}
</View>
)}
</View>
</TouchableOpacity>
);
export default UserListItem;

View File

@ -67,7 +67,8 @@ class HeaderView extends Component {
/>
<TouchableOpacity
style={styles.avatarWrapper}
onPress={() => !isReverse && handleOpenDrawer()}
onPress={() => handleOpenDrawer()}
disabled={isReverse}
>
<LinearGradient
start={{ x: 0, y: 0 }}
@ -78,7 +79,7 @@ class HeaderView extends Component {
isReverse ? styles.avatarButtonWrapperReverse : styles.avatarDefault,
]}
>
<UserAvatar style={styles.avatar} username={username} />
<UserAvatar noAction style={styles.avatar} username={username} />
</LinearGradient>
</TouchableOpacity>
{displayName || username ? (

View File

@ -1,14 +1,8 @@
import React, { PureComponent } from 'react';
import { withNavigation } from 'react-navigation';
// Services and Actions
import { getLeaderboard } from '../../../providers/esteem/esteem';
// Middleware
// Constants
import { default as ROUTES } from '../../../constants/routeNames';
// Utilities
// Component
@ -35,19 +29,6 @@ class LeaderboardContainer extends PureComponent {
this.setState({ users });
}
// Component Functions
_handleOnUserPress = (username) => {
const { navigation } = this.props;
navigation.navigate({
routeName: ROUTES.SCREENS.PROFILE,
params: {
username,
},
key: username,
});
};
render() {
const { users } = this.state;
@ -55,4 +36,4 @@ class LeaderboardContainer extends PureComponent {
}
}
export default withNavigation(LeaderboardContainer);
export default LeaderboardContainer;

View File

@ -17,23 +17,17 @@ class LeaderboardView extends PureComponent {
*/
// Component Functions
_renderItem = (item, index) => {
const { handleOnUserPress } = this.props;
return (
<UserListItem
handleOnUserPress={handleOnUserPress}
avatar={`https://steemitimages.com/u/${item._id}/avatar/small`}
index={index}
username={item._id}
description={item.created}
isHasRightItem
isBlackRightColor
rightText={item.count}
itemIndex={index + 1}
/>
);
};
_renderItem = (item, index) => (
<UserListItem
index={index}
username={item._id}
description={item.created}
isHasRightItem
isBlackRightColor
rightText={item.count}
itemIndex={index + 1}
/>
);
render() {
const { users, intl } = this.props;

View File

@ -68,6 +68,7 @@ class PostHeaderDescription extends PureComponent {
disableSize
username={name}
defaultSource={DEFAULT_IMAGE}
noAction
/>
)}
<Text style={styles.name}>{name}</Text>

View File

@ -71,6 +71,7 @@ class ProfileSummaryView extends PureComponent {
hoursVP,
intl,
isDarkTheme,
isFavorite,
isFollowing,
isLoggedIn,
isMuted,
@ -116,7 +117,14 @@ class ProfileSummaryView extends PureComponent {
iconType="MaterialCommunityIcons"
/>
)}
{!!date && <TextWithIcon text={date} iconName="calendar" iconType="MaterialCommunityIcons" iconSize={14} />}
{!!date && (
<TextWithIcon
text={date}
iconName="calendar"
iconType="MaterialCommunityIcons"
iconSize={14}
/>
)}
</View>
<Image
style={styles.longImage}
@ -173,44 +181,40 @@ class ProfileSummaryView extends PureComponent {
</TouchableOpacity>
</Fragment>
</View>
{isLoggedIn && (
{isLoggedIn && !isOwnProfile && (
<View style={styles.rightIcons}>
{!isOwnProfile && (
<Fragment>
<IconButton
backgroundColor="transparent"
name="favorite-border"
iconType="MaterialIcons"
size={20}
style={[styles.insetIconStyle]}
color="#c1c5c7"
/>
{isProfileLoading ? (
<ActivityIndicator style={styles.activityIndicator} />
) : (
<IconButton
backgroundColor="transparent"
name={followButtonIcon}
iconType="MaterialCommunityIcons"
onPress={() => handleFollowUnfollowUser(!isFollowing)}
size={20}
color="#c1c5c7"
/>
)}
{isProfileLoading ? (
<ActivityIndicator style={styles.activityIndicator} />
) : (
<DropdownButton
isHasChildIcon
iconName="more-vert"
options={dropdownOpions}
onSelect={this._handleOnDropdownSelect}
noHighlight
iconStyle={styles.dropdownIconStyle}
dropdownStyle={styles.dropdownStyle}
/>
)}
</Fragment>
<IconButton
backgroundColor="transparent"
color={isFavorite ? '#e63535' : '#c1c5c7'}
iconType="MaterialIcons"
name={isFavorite ? 'favorite' : 'favorite-border'}
size={20}
style={[styles.insetIconStyle]}
/>
{isProfileLoading ? (
<ActivityIndicator style={styles.activityIndicator} />
) : (
<IconButton
backgroundColor="transparent"
color="#c1c5c7"
iconType="MaterialCommunityIcons"
name={followButtonIcon}
onPress={() => handleFollowUnfollowUser(!isFollowing)}
size={20}
/>
)}
{isProfileLoading ? (
<ActivityIndicator style={styles.activityIndicator} />
) : (
<DropdownButton
dropdownStyle={styles.dropdownStyle}
iconName="more-vert"
iconStyle={styles.dropdownIconStyle}
isHasChildIcon
noHighlight
onSelect={this._handleOnDropdownSelect}
options={dropdownOpions}
/>
)}
</View>
)}

View File

@ -104,6 +104,7 @@ class SideMenuView extends Component {
username={currentAccount.username}
size="xl"
style={styles.userAvatar}
noAction
/>
<View style={styles.userInfoWrapper}>
{currentAccount.display_name && (
@ -148,7 +149,7 @@ class SideMenuView extends Component {
/>
)}
{item.item.username && (
<UserAvatar username={item.item.username} style={styles.otherUserAvatar} />
<UserAvatar noAction username={item.item.username} style={styles.otherUserAvatar} />
)}
<Text style={styles.listItemText}>
{isAddAccountIconActive

View File

@ -7,7 +7,7 @@ export default EStyleSheet.create({
justifyContent: 'center',
},
tabs: {
height: 50,
height: 40,
flexDirection: 'row',
justifyContent: 'space-around',
},

View File

@ -114,12 +114,12 @@ class TabBar extends PureComponent {
render() {
const {
activeTab, backgroundColor, style, goToPage,
activeTab, backgroundColor, style, goToPage, tabs,
} = this.props;
return (
<View style={[styles.tabs, { backgroundColor }, style]}>
{this.props.tabs.map((name, page) => {
{tabs.map((name, page) => {
const isTabActive = activeTab === page;
return this._renderTab(name, page, isTabActive, goToPage);
})}

View File

@ -1,7 +1,13 @@
import React, { Component } from 'react';
import { TouchableOpacity } from 'react-native';
import { withNavigation } from 'react-navigation';
import FastImage from 'react-native-fast-image';
import styles from './userAvatarStyles';
// Constants
import ROUTES from '../../../constants/routeNames';
const DEFAULT_IMAGE = require('../../../assets/avatar_default.png');
/* Props
@ -24,11 +30,23 @@ class UserAvatarView extends Component {
shouldComponentUpdate(nextProps) {
return nextProps.username !== this.props.username;
}
// Component Functions
_handleOnAvatarPress = (username) => {
const { navigation } = this.props;
navigation.navigate({
routeName: ROUTES.SCREENS.PROFILE,
params: {
username,
},
key: username,
});
};
render() {
const {
username, size, style, disableSize,
username, size, style, disableSize, noAction,
} = this.props;
const imageSize = size === 'xl' ? 'large' : 'small';
let _size;
@ -45,16 +63,18 @@ class UserAvatarView extends Component {
}
return (
<FastImage
style={[
styles.avatar,
style,
!disableSize && { width: _size, height: _size, borderRadius: _size / 2 },
]}
source={_avatar}
/>
<TouchableOpacity disabled={noAction} onPress={() => this._handleOnAvatarPress(username)}>
<FastImage
style={[
styles.avatar,
style,
!disableSize && { width: _size, height: _size, borderRadius: _size / 2 },
]}
source={_avatar}
/>
</TouchableOpacity>
);
}
}
export default UserAvatarView;
export default withNavigation(UserAvatarView);

View File

@ -1,14 +1,4 @@
import React, { PureComponent } from 'react';
import { withNavigation } from 'react-navigation';
// Services and Actions
// Middleware
// Constants
import { default as ROUTES } from '../../../constants/routeNames';
// Utilities
// Component
import VotersDisplayView from '../view/votersDisplayView';
@ -25,24 +15,11 @@ class VotersDisplayContainer extends PureComponent {
this.state = {};
}
// Component Life Cycle Functions
// Component Functions
_handleOnUserPress = (username) => {
const { navigation } = this.props;
navigation.navigate({
routeName: ROUTES.SCREENS.PROFILE,
params: {
username,
},
key: username,
});
};
render() {
return <VotersDisplayView handleOnUserPress={this._handleOnUserPress} {...this.props} />;
const { votes } = this.props;
return <VotersDisplayView votes={votes} />;
}
}
export default withNavigation(VotersDisplayContainer);
export default VotersDisplayContainer;

View File

@ -19,14 +19,12 @@ class VotersDisplayView extends PureComponent {
// Component Functions
_renderItem = (item, index) => {
const { handleOnUserPress, intl } = this.props;
const { intl } = this.props;
const value = `$ ${item.value}`;
const percent = `${item.percent}%`;
return (
<UserListItem
handleOnUserPress={handleOnUserPress}
avatar={item.avatar}
index={index}
username={item.voter}
// description={intl.formatRelative(item.time)}

View File

@ -16,6 +16,7 @@ export default {
SETTINGS: `Settings${SCREEN_SUFFIX}`,
STEEM_CONNECT: `SteemConnect${SCREEN_SUFFIX}`,
VOTERS: `Voters${SCREEN_SUFFIX}`,
BOOKMARKS: `Bookmarks${SCREEN_SUFFIX}`,
},
DRAWER: {
MAIN: `Main${DRAWER_SUFFIX}`,

View File

@ -7,19 +7,12 @@ const authMenuItems = [
icon: 'perm-identity',
id: 'profile',
},
// These are not ready yet!
// {
// name: 'Bookmarks',
// route: 'bookmarks',
// icon: 'star-border',
// id: 'bookmarks',
// },
// {
// name: 'Favorites',
// route: 'favorites',
// icon: 'favorite-border',
// id: 'favorites',
// },
{
name: 'Bookmarks',
route: ROUTES.SCREENS.BOOKMARKS,
icon: 'star-border',
id: 'bookmarks',
},
{
name: 'Drafts',
route: ROUTES.SCREENS.DRAFTS,
@ -27,12 +20,6 @@ const authMenuItems = [
id: 'drafts',
},
// {
// name: 'Schedules',
// route: 'schedules',
// icon: 'schedule',
// id: 'schedules',
// },
// {
// name: 'Gallery',
// route: 'galery',
// icon: 'photo-library',

View File

@ -65,4 +65,8 @@ export default EStyleSheet.create({
marginTop: 20,
fontWeight: '500',
},
tabView: {
alignSelf: 'center',
backgroundColor: '$primaryBackgroundColor',
},
});

View File

@ -8,6 +8,7 @@ import { default as ROUTES } from '../constants/routeNames';
// Screens
import {
Bookmarks,
Drafts,
Editor,
Follows,
@ -85,6 +86,12 @@ const stackNavigatior = createStackNavigator(
header: () => null,
},
},
[ROUTES.SCREENS.BOOKMARKS]: {
screen: RootComponent()(Bookmarks),
navigationOptions: {
header: () => null,
},
},
},
{
headerMode: 'none',

View File

@ -71,6 +71,54 @@ export const updateDraft = data => new Promise((resolve, reject) => {
});
});
export const addBookmark = (username, author, permlink) => api
.post('/bookmark', {
username,
author,
permlink,
chain: 'steem',
})
.then(resp => resp.data);
/**
* @params current username
*/
export const getBookmarks = username => api.get(`/bookmarks/${username}`).then(resp => resp.data);
/**
* @params id
* @params current username
*/
export const removeBookmark = (id, username) => api.delete(`/bookmarks/${username}/${id}`);
/**
* @params current username
*/
export const getFavorites = username => api.get(`/favorites/${username}`).then(resp => resp.data);
/**
* @params current username
* @params target username
*/
export const getIsFavorite = (targetUsername, currentUsername) => api.get(`/isfavorite/${currentUsername}/${targetUsername}`).then(resp => resp.data);
/**
* @params current username
* @params target username
*/
export const addFavorite = (currentUsername, targetUsername) => api
.post('/favorite', {
username: currentUsername,
targetUsername,
})
.then(resp => resp.data);
/**
* @params current username
* @params target username
*/
export const removeFavoriteUser = (currentUsername, targetUsername) => api.delete(`/favoriteUser/${currentUsername}/${targetUsername}`);
export const getLeaderboard = () => api.get('/leaderboard').then(resp => resp.data);
export const getActivities = data => new Promise((resolve, reject) => {

View File

@ -0,0 +1,107 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Alert } from 'react-native';
import { injectIntl } from 'react-intl';
// Services and Actions
import { getFavorites, removeFavoriteUser } from '../../../providers/esteem/esteem';
// Constants
import ROUTES from '../../../constants/routeNames';
// Utilities
// Component
import BookmarksScreen from '../screen/bookmarksScreen';
/*
* Props Name Description Value
*@props --> props name here description here Value Type Here
*
*/
class DraftsContainer extends Component {
constructor(props) {
super(props);
this.state = {
favorites: [],
bookmarks: [],
isLoading: false,
};
}
// Component Life Cycle Functions
componentDidMount() {
this._getFavorites();
}
// Component Functions
_getFavorites = () => {
const { currentAccount, intl } = this.props;
this.setState({ isLoading: true });
getFavorites(currentAccount.name)
.then((data) => {
this.setState({ favorites: this._sortData(data), isLoading: false });
})
.catch(() => {
Alert.alert(intl.formatMessage({ id: 'favorites.load_error' }));
this.setState({ isLoading: false });
});
};
_removeFavorite = (selectedUsername) => {
const { currentAccount, intl } = this.props;
removeFavoriteUser(currentAccount.name, selectedUsername)
.then(() => {
const { favorites } = this.state;
const newFavorites = [...favorites].filter(fav => fav.account !== selectedUsername);
this.setState({ favorites: this._sortData(newFavorites) });
})
.catch(() => {
Alert.alert(intl.formatMessage({ id: 'alert.fail' }));
});
};
_handleOnFavoritePress = (username) => {
const { navigation } = this.props;
navigation.navigate({
routeName: ROUTES.SCREENS.PROFILE,
params: {
username,
},
});
};
_sortData = data => data.sort((a, b) => {
const dateA = new Date(a.created).getTime();
const dateB = new Date(b.created).getTime();
return dateB > dateA ? 1 : -1;
});
render() {
const { isLoading, favorites, bookmarks } = this.state;
const { currentAccount } = this.props;
return (
<BookmarksScreen
isLoading={isLoading}
currentAccount={currentAccount}
favorites={favorites}
bookmarks={bookmarks}
removeFavorite={this._removeFavorite}
handleOnFavoritePress={this._handleOnFavoritePress}
/>
);
}
}
const mapStateToProps = state => ({
currentAccount: state.account.currentAccount,
});
export default connect(mapStateToProps)(injectIntl(DraftsContainer));

View File

@ -0,0 +1,4 @@
import Bookmarks from './container/bookmarksContainer';
export { Bookmarks };
export default Bookmarks;

View File

@ -0,0 +1,148 @@
import React, { Component } from 'react';
import { injectIntl } from 'react-intl';
import { View, FlatList, Text } from 'react-native';
import ScrollableTabView from '@esteemapp/react-native-scrollable-tab-view';
import ActionSheet from 'react-native-actionsheet';
// Components
import { BasicHeader } from '../../../components/basicHeader';
import {
PostCardPlaceHolder,
UserListItem,
WalletDetailsPlaceHolder,
} from '../../../components/basicUIElements';
import { TabBar } from '../../../components/tabBar';
// Styles
import globalStyles from '../../../globalStyles';
import styles from './bookmarksStyles';
class BookmarksScreen extends Component {
/* Props
* ------------------------------------------------
* @prop { type } name - Description....
*/
constructor(props) {
super(props);
this.state = {
selectedUsername: null,
};
}
// Component Life Cycles
// Component Functions
_renderItem = (item, index) => {
const { handleOnFavoritePress } = this.props;
return (
<UserListItem
handleOnLongPress={() => this._handleLongPress(item.account)}
handleOnPress={() => handleOnFavoritePress(item.account)}
index={index}
isClickable
username={item.account}
rightText="bok"
subRightText="bok"
/>
);
};
_getTabItem = (data, type) => {
const { isLoading, intl } = this.props;
const isNoItem = (data && data.length === 0) || !data;
const placeHolder = type === 'bookmarks' ? <PostCardPlaceHolder /> : <WalletDetailsPlaceHolder />;
return (
<View style={styles.container}>
{isNoItem && !isLoading && (
<Text style={globalStyles.hintText}>
{intl.formatMessage({
id: 'bookmarks.empty_list',
})}
</Text>
)}
{isLoading ? (
<View>{placeHolder}</View>
) : (
!isNoItem && (
<FlatList
data={data}
keyExtractor={item => item._id}
removeClippedSubviews={false}
renderItem={({ item, index }) => this._renderItem(item, index)}
/>
)
)}
</View>
);
};
_handleLongPress = (selectedUsername) => {
this.setState({ selectedUsername }, () => {
this.ActionSheet.show();
});
};
render() {
const {
favorites, bookmarks, intl, removeFavorite,
} = this.props;
const { selectedUsername } = this.state;
return (
<View style={globalStyles.container}>
<BasicHeader
title={intl.formatMessage({
id: 'bookmarks.title',
})}
/>
<ScrollableTabView
style={globalStyles.tabView}
renderTabBar={() => (
<TabBar
style={styles.tabbar}
tabUnderlineDefaultWidth={80}
tabUnderlineScaleX={2}
tabBarPosition="overlayTop"
/>
)}
>
<View
tabLabel={intl.formatMessage({
id: 'bookmarks.title',
})}
style={styles.tabbarItem}
>
{this._getTabItem(bookmarks, 'bookmarks')}
</View>
<View
tabLabel={intl.formatMessage({
id: 'favorites.title',
})}
style={styles.tabbarItem}
>
{this._getTabItem(favorites, 'favorites')}
</View>
</ScrollableTabView>
<ActionSheet
ref={o => (this.ActionSheet = o)}
options={[
intl.formatMessage({ id: 'alert.delete' }),
intl.formatMessage({ id: 'alert.cancel' }),
]}
title={intl.formatMessage({ id: 'alert.remove_alert' })}
cancelButtonIndex={1}
destructiveButtonIndex={0}
onPress={(index) => {
if (index === 0) removeFavorite(selectedUsername);
}}
/>
</View>
);
}
}
export default injectIntl(BookmarksScreen);

View File

@ -0,0 +1,24 @@
import EStyleSheet from 'react-native-extended-stylesheet';
export default EStyleSheet.create({
container: {
padding: 8,
flex: 1,
},
tabbar: {
alignSelf: 'center',
backgroundColor: '$primaryBackgroundColor',
shadowOpacity: 0.2,
shadowColor: '$shadowColor',
shadowOffset: { height: 4 },
zIndex: 99,
},
tabbarItem: {
flex: 1,
backgroundColor: '$primaryBackgroundColor',
minWidth: '$deviceWidth',
},
tabs: {
flex: 1,
},
});

View File

@ -1,27 +1,17 @@
import EStyleSheet from 'react-native-extended-stylesheet';
export default EStyleSheet.create({
tabView: {
alignSelf: 'center',
backgroundColor: '$primaryBackgroundColor',
},
tabbar: {
alignSelf: 'center',
height: 40,
backgroundColor: '$primaryBackgroundColor',
shadowOpacity: 0.2,
shadowColor: '$shadowColor',
shadowOffset: { height: 4 },
zIndex: 99,
borderBottomColor: '$shadowColor',
borderBottomWidth: 0.1,
},
tabbarItem: {
flex: 1,
backgroundColor: '$primaryBackgroundColor',
minWidth: '$deviceWidth',
},
tabs: {
flex: 1,
},
});

View File

@ -100,7 +100,7 @@ class DraftsScreen extends Component {
/>
<ScrollableTabView
style={styles.tabView}
style={globalStyles.tabView}
renderTabBar={() => (
<TabBar
style={styles.tabbar}

View File

@ -105,18 +105,6 @@ class FollowsContainer extends Component {
});
};
_handleOnUserPress = (username) => {
const { navigation } = this.props;
navigation.navigate({
routeName: ROUTES.SCREENS.PROFILE,
params: {
username,
},
key: username,
});
};
render() {
const {
isFollowingPress, users, isLoading, count, username, filterResult,
@ -132,7 +120,6 @@ class FollowsContainer extends Component {
count={count}
isLoading={isLoading}
handleSearch={this._handleSearch}
handleOnUserPress={this._handleOnUserPress}
/>
);
}

View File

@ -29,17 +29,10 @@ class FollowsScreen extends PureComponent {
// Component Functions
_renderItem = (item, index) => {
const { handleOnUserPress, isFollowing } = this.props;
const { isFollowing } = this.props;
const username = isFollowing ? item.following : item.follower;
const avatar = `https://steemitimages.com/u/${username}/avatar/small`;
return (
<UserListItem
handleOnUserPress={handleOnUserPress}
avatar={avatar}
index={index}
username={username}
/>
);
return <UserListItem index={index} username={username} />;
};
_renderFooter = () => {
@ -67,11 +60,7 @@ class FollowsScreen extends PureComponent {
return (
<View style={styles.container}>
<BasicHeader
title={headerTitle}
isHasSearch
handleOnSearch={handleSearch}
/>
<BasicHeader title={headerTitle} isHasSearch handleOnSearch={handleSearch} />
{(filterResult && data && filterResult.length > 0) || (data && data.length > 0) ? (
<FlatList
data={filterResult || data}

View File

@ -3,14 +3,14 @@ import { View } from 'react-native';
import ScrollableTabView from '@esteemapp/react-native-scrollable-tab-view';
import { injectIntl } from 'react-intl';
// STEEM
// Components
import { TabBar } from '../../../components/tabBar';
import { Posts } from '../../../components/posts';
import { Header } from '../../../components/header';
// Styles
import styles from './homeStyles';
import globalStyles from '../../../globalStyles';
import { POPULAR_FILTERS, PROFILE_FILTERS } from '../../../constants/options/filters';
@ -32,7 +32,7 @@ class HomeScreen extends PureComponent {
<Header />
<View style={styles.container}>
<ScrollableTabView
style={styles.tabView}
style={globalStyles.tabView}
activeTab={!isLoggedIn ? 1 : 0}
renderTabBar={() => (
<TabBar

View File

@ -11,10 +11,6 @@ export default EStyleSheet.create({
width: '50%',
alignItems: 'center',
},
tabView: {
alignSelf: 'center',
backgroundColor: '$primaryBackgroundColor',
},
tabbar: {
alignSelf: 'center',
height: 40,

View File

@ -1,3 +1,4 @@
import { Bookmarks } from './bookmarks';
import { Drafts } from './drafts';
import { Editor } from './editor';
import { Follows } from './follows';
@ -6,15 +7,16 @@ import { Launch } from './launch';
import { Login } from './login';
import { Messages } from './messages';
import { Notification } from './notification';
import { PinCode } from './pinCode';
import { Post } from './post';
import { Profile } from './profile';
import { Settings } from './settings';
import { Voters } from './voters';
import { PinCode } from './pinCode';
import RootComponent from './root';
import SteemConnect from './steem-connect/steemConnect';
export {
Bookmarks,
Drafts,
Editor,
Follows,

View File

@ -21,6 +21,8 @@ import { default as ROUTES } from '../../../constants/routeNames';
// Styles
import styles from './loginStyles';
import globalStyles from '../../../globalStyles';
import STEEM_CONNECT_LOGO from '../../../assets/steem_connect.png';
class LoginScreen extends PureComponent {
@ -88,7 +90,7 @@ class LoginScreen extends PureComponent {
/>
<ScrollableTabView
locked={isLoading}
style={styles.tabView}
style={globalStyles.tabView}
renderTabBar={() => (
<TabBar
style={styles.tabbar}

View File

@ -5,10 +5,6 @@ export default EStyleSheet.create({
flex: 1,
backgroundColor: '$primaryLightBackground',
},
tabView: {
alignSelf: 'center',
backgroundColor: 'transparent',
},
tabbar: {
alignSelf: 'center',
height: 40,

View File

@ -3,16 +3,16 @@ import { View } from 'react-native';
import ScrollableTabView from '@esteemapp/react-native-scrollable-tab-view';
import { injectIntl } from 'react-intl';
// Styles
import styles from './notificationStyles';
// Components
import { TabBar } from '../../../components/tabBar';
import { Notification } from '../../../components/notification';
import { Header } from '../../../components/header';
import { NoPost } from '../../../components/basicUIElements';
import { LeaderBoard } from '../../../components/leaderboard';
// Styles
import { LeaderBoard } from '../../../components/leaderboard';
import styles from './notificationStyles';
import globalStyles from '../../../globalStyles';
class NotificationScreen extends PureComponent {
constructor(props) {
@ -34,7 +34,7 @@ class NotificationScreen extends PureComponent {
<View style={styles.container}>
<Header />
<ScrollableTabView
style={styles.tabView}
style={globalStyles.tabView}
renderTabBar={() => (
<TabBar style={styles.tabbar} tabUnderlineDefaultWidth={100} tabUnderlineScaleX={2} />
)}
@ -43,7 +43,7 @@ class NotificationScreen extends PureComponent {
tabLabel={intl.formatMessage({
id: 'notification.notification',
})}
style={styles.notificationTab}
style={styles.tabbarItem}
>
{isLoggedIn ? (
<Notification
@ -66,7 +66,7 @@ class NotificationScreen extends PureComponent {
tabLabel={intl.formatMessage({
id: 'notification.leaderboard',
})}
style={styles.leaderboardTab}
style={styles.tabbarItem}
>
<LeaderBoard />
</View>

View File

@ -7,20 +7,9 @@ export default EStyleSheet.create({
},
tabbar: {
alignSelf: 'center',
height: 55,
backgroundColor: '$primaryBackgroundColor',
},
tabView: {
alignSelf: 'center',
backgroundColor: 'transparent',
flex: 1,
},
notificationTab: {
flex: 1,
backgroundColor: '$primaryBackgroundColor',
minWidth: '$deviceWidth',
},
leaderboardTab: {
tabbarItem: {
flex: 1,
backgroundColor: '$primaryBackgroundColor',
minWidth: '$deviceWidth',

View File

@ -58,7 +58,7 @@ class PinCodeScreen extends PureComponent {
return (
<View style={styles.container}>
<View style={styles.logoView}>
<UserAvatar username={username} size="xl" style={styles.avatar} />
<UserAvatar noAction username={username} size="xl" style={styles.avatar} />
</View>
<View style={styles.titleView}>
<Text style={styles.title}>{`@${username}`}</Text>

View File

@ -2,7 +2,7 @@ import React, { Component, Fragment } from 'react';
import { connect } from 'react-redux';
import { withNavigation } from 'react-navigation';
// Utilitites
// Providers
import {
followUser,
unfollowUser,
@ -14,6 +14,9 @@ import {
getIsMuted,
} from '../../../providers/steem/dsteem';
// Esteem providers
import { getIsFavorite } from '../../../providers/esteem/esteem';
// Constants
import { default as ROUTES } from '../../../constants/routeNames';
@ -26,6 +29,7 @@ class ProfileContainer extends Component {
this.state = {
comments: [],
follows: {},
isFavorite: false,
isFollowing: false,
isMuted: false,
isProfileLoading: false,
@ -194,12 +198,15 @@ class ProfileContainer extends Component {
const { isLoggedIn, currentAccount } = this.props;
let _isFollowing;
let _isMuted;
let _isFavorite;
let _follows;
if (isLoggedIn) {
if (isLoggedIn && currentAccount.name !== username) {
_isFollowing = await getIsFollowing(username, currentAccount.name);
_isMuted = _isFollowing ? false : await getIsMuted(username, currentAccount.name);
_isFavorite = getIsFavorite(username, currentAccount.name);
}
await getFollows(username).then((res) => {
@ -210,6 +217,7 @@ class ProfileContainer extends Component {
follows: _follows,
isFollowing: _isFollowing,
isMuted: _isMuted,
isFavorite: _isFavorite,
});
}
};
@ -262,18 +270,19 @@ class ProfileContainer extends Component {
render() {
const {
avatar,
comments,
error,
follows,
isProfileLoading,
isFavorite,
isFollowing,
isMuted,
isProfileLoading,
isReady,
isReverseHeader,
selectedQuickProfile,
user,
username,
avatar,
selectedQuickProfile,
} = this.state;
const { isDarkTheme, isLoggedIn } = this.props;
@ -282,7 +291,6 @@ class ProfileContainer extends Component {
<ProfileScreen
about={user && user.about && user.about.profile}
avatar={avatar}
selectedQuickProfile={selectedQuickProfile}
comments={comments}
error={error}
follows={follows}
@ -290,12 +298,14 @@ class ProfileContainer extends Component {
handleMuteUnmuteUser={this._handleMuteUnmuteUser}
handleOnFollowsPress={this._handleFollowsPress}
isDarkTheme={isDarkTheme}
isFavorite={isFavorite}
isFollowing={isFollowing}
isLoggedIn={isLoggedIn}
isMuted={isMuted}
isProfileLoading={isProfileLoading}
isReady={isReady}
isReverseHeader={isReverseHeader}
selectedQuickProfile={selectedQuickProfile}
selectedUser={user}
username={username}
/>

View File

@ -24,6 +24,7 @@ import { getRcPower, getVotingPower } from '../../../utils/manaBar';
// Styles
import styles from './profileStyles';
import globalStyles from '../../../globalStyles';
class ProfileScreen extends PureComponent {
constructor(props) {
@ -60,6 +61,7 @@ class ProfileScreen extends PureComponent {
handleOnFollowsPress,
intl,
isDarkTheme,
isFavorite,
isFollowing,
isLoggedIn,
isMuted,
@ -132,6 +134,7 @@ class ProfileScreen extends PureComponent {
intl={intl}
isDarkTheme={isDarkTheme}
isFollowing={isFollowing}
isFavorite={isFavorite}
isLoggedIn={isLoggedIn}
isMuted={isMuted}
isOwnProfile={!isReverseHeader}
@ -146,7 +149,7 @@ class ProfileScreen extends PureComponent {
)}
<ScrollableTabView
style={styles.tabView}
style={globalStyles.tabView}
renderTabBar={() => (
<TabBar style={styles.tabbar} tabUnderlineDefaultWidth={80} tabUnderlineScaleX={2} />
)}
@ -194,11 +197,7 @@ class ProfileScreen extends PureComponent {
id: 'profile.wallet',
})}
>
{selectedUser ? (
<Wallet selectedUser={selectedUser} />
) : (
<WalletDetailsPlaceHolder />
)}
{selectedUser ? <Wallet selectedUser={selectedUser} /> : <WalletDetailsPlaceHolder />}
</View>
</ScrollableTabView>
</View>

View File

@ -37,7 +37,7 @@ export default EStyleSheet.create({
},
tabbar: {
alignSelf: 'center',
height: 50,
height: 45,
backgroundColor: '$primaryBackgroundColor',
borderBottomColor: '#f1f1f1',
},
@ -47,10 +47,6 @@ export default EStyleSheet.create({
backgroundColor: '#f9f9f9',
minWidth: '$deviceWidth',
},
tabView: {
alignSelf: 'center',
backgroundColor: 'transparent',
},
postTabBar: {
backgroundColor: '$primaryBackgroundColor',
},

View File

@ -9,7 +9,7 @@ import { getExistUser } from '../../../realm/realm';
// Components
import { Modal } from '../../../components';
import PinCode from '../../pinCode';
import { PinCode } from '../../pinCode';
import PostButtonForAndroid from '../../../components/postButton/view/postButtonsForAndroid';
// Constants
@ -55,6 +55,7 @@ const RootContainer = () => (WrappedComponent) => {
_startPinCodeTimer = () => {
const { dispatch } = this.props;
this._pinCodeTimer = setTimeout(() => {
dispatch(openPinCodeModal());
}, 1 * 60 * 1000);
@ -70,6 +71,7 @@ const RootContainer = () => (WrappedComponent) => {
_createPushListener = () => {
const { navigation } = this.props;
Push.setListener({
onPushNotificationReceived(pushNotification) {
if (AppState.currentState === 'background') {
@ -90,6 +92,7 @@ const RootContainer = () => (WrappedComponent) => {
render() {
const { isPinCodeReqiure, navigation } = this.props;
const { pinCodeStates, wrappedComponentStates } = this.state;
return (
<Fragment>
<Modal

View File

@ -1,13 +1,5 @@
import React, { PureComponent } from 'react';
// Services and Actions
// Middleware
// Constants
// Utilities
// Component
import VotersScreen from '../screen/votersScreen';

View File

@ -86,7 +86,7 @@ class VotersScreen extends PureComponent {
defaultText="REWARDS"
onDropdownSelect={this._handleOnDropdownSelect}
/>
<VotersDisplay intl={intl} key={Math.random()} votes={filterResult || data} />
<VotersDisplay key={Math.random()} votes={filterResult || data} />
</View>
);
}