changed home screen swipable and gettin post functions also updated main button

This commit is contained in:
ue 2018-11-05 18:02:23 +03:00
parent 1c2695a174
commit 1e405ccc75
9 changed files with 50 additions and 40 deletions

BIN
src/assets/avatar_default.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -13,7 +13,7 @@ import { IconButton } from '../../iconButton';
// Styles
import styles from './headerStyles';
const DEFAULT_IMAGE = require('../../../assets/esteem.png');
const DEFAULT_IMAGE = require('../../../assets/avatar_default.png');
class HeaderView extends Component {
/* Props

View File

@ -1,4 +1,5 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { withNavigation } from 'react-navigation';
// Components
@ -25,4 +26,8 @@ class PostButtonContainer extends Component {
}
}
export default withNavigation(PostButtonContainer);
const mapStateToProps = state => ({
isLoggedIn: state.application.isLoggedIn,
});
export default connect(mapStateToProps)(withNavigation(PostButtonContainer));

View File

@ -7,6 +7,9 @@ import Icon from 'react-native-vector-icons/FontAwesome';
// Components
import SubPostButton from './subPostButtonView';
// Constant
import { default as ROUTES } from '../../../constants/routeNames';
// Styles
import styles from './postButtonStyles';
@ -81,7 +84,7 @@ class PostButtonView extends Component {
outputRange: ['0deg', '45deg'],
});
const { handleSubButtonPress } = this.props;
const { handleSubButtonPress, isLoggedIn } = this.props;
return (
<View style={styles.postButtonWrapper}>
@ -92,6 +95,8 @@ class PostButtonView extends Component {
top: firstY,
}}
icon="camera"
onPress={() => handleSubButtonPress(isLoggedIn ? ROUTES.SCREENS.EDITOR : ROUTES.SCREENS.LOGIN)
}
/>
<SubPostButton
size={SIZE}
@ -100,7 +105,8 @@ class PostButtonView extends Component {
top: secondY,
}}
icon="pencil"
onPress={() => handleSubButtonPress('EditorScreen')}
onPress={() => handleSubButtonPress(isLoggedIn ? ROUTES.SCREENS.EDITOR : ROUTES.SCREENS.LOGIN)
}
/>
<SubPostButton
size={SIZE}
@ -109,8 +115,9 @@ class PostButtonView extends Component {
top: thirdY,
}}
icon="video-camera"
onPress={() => handleSubButtonPress(isLoggedIn ? ROUTES.SCREENS.EDITOR : ROUTES.SCREENS.LOGIN)
}
/>
<TouchableOpacity onPress={this.toggleView} activeOpacity={1}>
<Animated.View
style={[

View File

@ -1,7 +1,5 @@
import React, { Component } from 'react';
import {
Image, TouchableOpacity, Text,
} from 'react-native';
import { Image, TouchableOpacity, Text } from 'react-native';
import {
Card, CardItem, Left, Right, Thumbnail, Icon, Body,
} from 'native-base';
@ -86,7 +84,7 @@ class PostCard extends Component {
</TouchableOpacity>
<CardItem>
<Left>
<Upvote content={content} user={user} isLoggedIn={!!user} />
<Upvote content={content} user={user} isLoggedIn={isLoggedIn} />
<TouchableOpacity
onPress={() => this._handleOnVotersPress()}
style={styles.payoutButton}
@ -106,9 +104,7 @@ $
</Right>
</CardItem>
{content.top_likers ? (
<TouchableOpacity
onPress={() => this._handleOnVotersPress()}
>
<TouchableOpacity onPress={() => this._handleOnVotersPress()}>
<CardItem style={styles.topLikers}>
<Thumbnail
source={{
@ -131,18 +127,17 @@ $
<Text style={styles.footer}>
@
{content.top_likers[0]}
, @
, @
{content.top_likers[1]}
, @
, @
{content.top_likers[2]}
<Text style={styles.footer}> & </Text>
{content.vote_count - content.top_likers.length}
{' '}
others like this
others like this
</Text>
</CardItem>
</TouchableOpacity>
) : (
<CardItem>
<Text style={styles.footer}>

View File

@ -84,7 +84,7 @@ class PostsView extends Component {
start_author: startAuthor,
start_permlink: startPermlink,
},
user.name,
(user && user.name) || 'esteemapp',
).then((result) => {
const _posts = result;
_posts.shift();
@ -127,10 +127,7 @@ class PostsView extends Component {
isReady, refreshing, posts, user,
} = this.state;
const {
componentId,
filterOptions,
isLoginMust,
isLoggedIn,
componentId, filterOptions, isLoginMust, isLoggedIn,
} = this.props;
if (user && posts && posts.length > 0) {
@ -140,7 +137,6 @@ class PostsView extends Component {
<FilterBar
dropdownIconName="md-arrow-dropdown"
options={filterOptions}
defaultText="NEW POST"
rightIconName="md-apps"
/>
)}

View File

@ -1,4 +1,5 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
// Services and Actions
import { postContent } from '../../../providers/steem/dsteem';
@ -69,8 +70,14 @@ class ExampleContainer extends Component {
};
render() {
return <EditorScreen handleOnSubmit={this._handleSubmit} />;
const { isLoggedIn } = this.props;
return <EditorScreen isLoggedIn={isLoggedIn} handleOnSubmit={this._handleSubmit} />;
}
}
export default ExampleContainer;
const mapStateToProps = state => ({
isLoggedIn: state.application.isLoggedIn,
});
export default connect(mapStateToProps)(ExampleContainer);

View File

@ -91,6 +91,7 @@ export class EditorScreen extends Component {
render() {
const { isPreviewActive, wordsCount, isFormValid } = this.state;
const { isLoggedIn } = this.props;
return (
<View style={globalStyles.defaultContainer}>

View File

@ -38,7 +38,17 @@ export default class HomeScreen extends PureComponent {
render() {
const { componentId, isLoggedIn, currentAccount } = this.props;
const _filterOptions = ['NEW POSTS', 'VOTES', 'REPLIES', 'MENTIONS', 'FOLLOWS', 'REBLOGS'];
const _filterOptions = [
'FEED',
'TRENDING',
'HOT',
'NEW',
'ACTIVE',
'PROMETED',
'VOTES',
'COMMENTS',
'PAYOUT',
];
return (
<Fragment>
@ -57,23 +67,12 @@ export default class HomeScreen extends PureComponent {
/>
)}
>
{isLoggedIn && (
<View tabLabel="Feed" style={styles.tabbarItem}>
<Posts
filterOptions={_filterOptions}
isLoginMust
getFor="feed"
tag={currentAccount.name}
user={currentAccount}
isLoggedIn={isLoggedIn}
componentId={componentId}
/>
</View>
)}
<View tabLabel="Hot" style={styles.tabbarItem}>
<View tabLabel="Feed" style={styles.tabbarItem}>
<Posts
filterOptions={_filterOptions}
getFor="hot"
isLoginMust
getFor="feed"
tag={isLoggedIn ? currentAccount.name : 'esteemapp'}
user={currentAccount}
isLoggedIn={isLoggedIn}
componentId={componentId}