Merge pull request #223 from esteemapp/apple/request

Apple/request
This commit is contained in:
Feruz M 2018-12-11 23:00:06 +02:00 committed by GitHub
commit 9130c9cf1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 7 deletions

View File

@ -2,16 +2,33 @@ import React from 'react';
import { View, Text, Image } from 'react-native';
import NO_POST from '../../../../assets/no_post.png';
import styles from './noPostStyles';
import { MainButton } from '../../../mainButton';
const NoPost = ({
text, name, defaultText, source, imageStyle, style,
text,
name,
defaultText,
source,
imageStyle,
style,
isButtonText,
handleOnButtonPress,
}) => (
<View style={[styles.wrapper, style]}>
<Image style={[styles.image, imageStyle]} source={source || NO_POST} />
{name ? (
{name && !isButtonText ? (
<Text style={styles.text}>{`@${name} ${text}`}</Text>
) : (
<Text style={styles.text}>{defaultText}</Text>
!isButtonText && <Text style={styles.text}>{defaultText}</Text>
)}
{isButtonText && (
<MainButton
style={{ width: 150 }}
onPress={handleOnButtonPress}
iconName="md-person"
iconColor="white"
text={defaultText}
/>
)}
</View>
);

View File

@ -1,6 +1,7 @@
import React, { Component, Fragment } from 'react';
import { FlatList, View, ActivityIndicator } from 'react-native';
import { injectIntl } from 'react-intl';
import { withNavigation } from 'react-navigation';
// STEEM
import { getPostsSummary } from '../../../providers/steem/dsteem';
@ -13,6 +14,7 @@ import { PostCardPlaceHolder, NoPost } from '../../basicUIElements';
import filters from '../../../constants/options/filters.json';
// Styles
import styles from './postsStyles';
import { default as ROUTES } from '../../../constants/routeNames';
class PostsView extends Component {
constructor(props) {
@ -130,6 +132,11 @@ class PostsView extends Component {
handleOnScrollStart();
};
_handleOnPressLogin = () => {
const { navigation } = this.props;
navigation.navigate(ROUTES.SCREENS.LOGIN);
};
render() {
const {
refreshing, posts, isPostsLoading, isHideImage, selectedFilterIndex,
@ -158,12 +165,15 @@ class PostsView extends Component {
&& !isLoggedIn
&& isLoginDone && (
<NoPost
isButtonText
defaultText={intl.formatMessage({
id: 'profile.login_to_see',
})}
handleOnButtonPress={this._handleOnPressLogin}
/>
)}
</Fragment>
{posts && posts.length > 0 && !isPostsLoading ? (
<FlatList
data={posts}
@ -204,4 +214,4 @@ class PostsView extends Component {
}
}
export default injectIntl(PostsView);
export default withNavigation(injectIntl(PostsView));

View File

@ -34,11 +34,9 @@ class HomeScreen extends PureComponent {
'PAYOUT',
];
let tag;
let initialPage;
if (isLoginDone && !isLoggedIn) {
// tag = 'esteemapp';
initialPage = 1;
}
return (
@ -48,7 +46,7 @@ class HomeScreen extends PureComponent {
<View style={styles.container}>
<ScrollableTabView
style={styles.tabView}
initialPage={isLoginDone && !isLoggedIn ? 1 : 0}
initialPage={!isLoggedIn ? 1 : 0}
renderTabBar={() => (
<TabBar
style={styles.tabbar}