puted button for login

This commit is contained in:
ue 2018-12-11 23:58:14 +03:00
parent b5198df16b
commit bbdd6297ce
2 changed files with 31 additions and 4 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));