enhanced style a bit

This commit is contained in:
ue 2018-10-31 16:16:06 +03:00
parent 31edb864d6
commit 4b862d6927
2 changed files with 63 additions and 13 deletions

View File

@ -1,5 +1,5 @@
import React, { Component } from 'react'; import React, { Component, Fragment } from 'react';
import { View } from 'react-native'; import { View, FlatList, Text } from 'react-native';
// Constants // Constants
@ -28,6 +28,8 @@ class CommentsView extends Component {
// Component Functions // Component Functions
_handleOnDropdownSelect = () => {}; _handleOnDropdownSelect = () => {};
_keyExtractor = (item, index) => item.permlink;
render() { render() {
const { const {
comments, comments,
@ -41,15 +43,63 @@ class CommentsView extends Component {
// commentNumber === 8 && alert('sekkiz:'); // commentNumber === 8 && alert('sekkiz:');
return ( return (
<View> <View>
{comments {!!comments && (
<FlatList
data={comments}
keyExtractor={this._keyExtractor}
renderItem={({ item, index }) => (
<View key={index}>
<PostHeaderDescription
key={item.permlink}
date={item.created}
name={item.author}
reputation={item.author_reputation}
avatar={item.avatar}
size={avatarSize || 24}
/>
<View
style={{
marginLeft: marginLeft || 35,
flexDirection: 'column',
marginTop: -10,
}}
>
<PostBody isComment handleOnUserPress={handleOnUserPress} body={item.body} />
<View style={{ flexDirection: 'row' }}>
<Upvote isShowpayoutValue content={item} user={currentUser} isLoggedIn />
<IconButton
iconStyle={{ color: '#c1c5c7' }}
style={{ marginLeft: 20 }}
name="reply"
onPress={() => handleOnReplyPress && handleOnReplyPress()}
iconType="FontAwesome"
/>
</View>
</View>
<View style={{ marginLeft: marginLeft || 32 }}>
{commentNumber !== 8 && (
<Comments
commentNumber={commentNumber ? commentNumber * 2 : 1}
marginLeft={20}
avatarSize={avatarSize || 16}
author={item.author}
permlink={item.permlink}
/>
)}
</View>
</View>
)}
/>
)}
{/* {comments
&& comments.map((comment, i) => ( && comments.map((comment, i) => (
<View key={i}> <View key={i}>
<PostHeaderDescription <PostHeaderDescription
key={comment.permlink} key={item.permlink}
date={comment.created} date={item.created}
name={comment.author} name={item.author}
reputation={comment.author_reputation} reputation={item.author_reputation}
avatar={comment.avatar} avatar={item.avatar}
size={avatarSize || 24} size={avatarSize || 24}
/> />
<View <View
@ -59,7 +109,7 @@ class CommentsView extends Component {
marginTop: -15, marginTop: -15,
}} }}
> >
<PostBody isComment handleOnUserPress={handleOnUserPress} body={comment.body} /> <PostBody isComment handleOnUserPress={handleOnUserPress} body={item.body} />
<View style={{ flexDirection: 'row' }}> <View style={{ flexDirection: 'row' }}>
<Upvote isShowpayoutValue content={comment} user={currentUser} isLoggedIn /> <Upvote isShowpayoutValue content={comment} user={currentUser} isLoggedIn />
<IconButton <IconButton
@ -77,13 +127,13 @@ class CommentsView extends Component {
commentNumber={commentNumber ? commentNumber * 2 : 1} commentNumber={commentNumber ? commentNumber * 2 : 1}
marginLeft={20} marginLeft={20}
avatarSize={avatarSize || 16} avatarSize={avatarSize || 16}
author={comment.author} author={item.author}
permlink={comment.permlink} permlink={item.permlink}
/> />
)} )}
</View> </View>
</View> </View>
))} ))} */}
</View> </View>
); );
} }

View File

@ -131,11 +131,11 @@ class PostDisplayView extends Component {
{' '} {' '}
{post.created} {post.created}
</Text> </Text>
{isPostEnd && this._getTabBar()}
</View> </View>
</View> </View>
)} )}
</View> </View>
{isPostEnd && this._getTabBar()}
{post && ( {post && (
<CommentsDisplay <CommentsDisplay
currentUser={currentUser} currentUser={currentUser}