import React from 'react';
import {
FlatList,
View,
StyleSheet,
TouchableOpacity,
} from 'react-native';
import {
RkStyleSheet,
RkText,
} from 'react-native-ui-kitten';
import { Avatar } from '../../components';
import { data } from '../../data';
import NavigationType from '../../config/navigation/propTypes';
const moment = require('moment');
export class Comments extends React.Component {
static propTypes = {
navigation: NavigationType.isRequired,
};
static navigationOptions = {
title: 'Comments'.toUpperCase(),
};
constructor(props) {
super(props);
const postId = this.props.navigation.getParam('postId', undefined);
this.state = {
data: data.getComments(postId),
};
}
extractItemKey = (item) => `${item.id}`;
onItemPressed = (item) => {
const navigationParams = { id: item.user.id };
this.props.navigation.navigate('ProfileV1', navigationParams);
};
renderSeparator = () => (
);
renderItem = ({ item }) => (
this.onItemPressed(item)}>
{`${item.user.firstName} ${item.user.lastName}`}
{moment().add(item.time, 'seconds').format('LT')}
{item.text}
);
render = () => (
);
}
const styles = RkStyleSheet.create(theme => ({
root: {
backgroundColor: theme.colors.screen.base,
},
container: {
paddingLeft: 19,
paddingRight: 16,
paddingVertical: 12,
flexDirection: 'row',
alignItems: 'flex-start',
},
content: {
marginLeft: 16,
flex: 1,
},
contentHeader: {
flexDirection: 'row',
justifyContent: 'space-between',
marginBottom: 6,
},
separator: {
height: StyleSheet.hairlineWidth,
backgroundColor: theme.colors.border.base,
},
}));