import React from 'react'; import { FlatList, View, Image, } from 'react-native'; import { RkStyleSheet, RkText } from 'react-native-ui-kitten'; import { Avatar } from '../../components'; import { data } from '../../data'; const moment = require('moment'); export class Notifications extends React.Component { static navigationOptions = { title: 'Notifications', }; state = { data: data.getNotifications(), }; extractItemKey = (item) => `${item.id}`; renderAttachment = (item) => { const hasAttachment = item.attach !== undefined; return hasAttachment ? : ; }; renderItem = ({ item }) => ( {`${item.user.firstName} ${item.user.lastName}`} {item.description} {moment().add(item.time, 'seconds').fromNow()} {this.renderAttachment(item)} ); render = () => ( ); } const styles = RkStyleSheet.create(theme => ({ root: { backgroundColor: theme.colors.screen.base, }, container: { padding: 16, flexDirection: 'row', borderBottomWidth: 1, borderColor: theme.colors.border.base, alignItems: 'flex-start', }, avatar: {}, text: { marginBottom: 5, }, content: { flex: 1, marginLeft: 16, marginRight: 0, }, mainContent: { marginRight: 60, }, img: { height: 50, width: 50, margin: 0, }, attachment: { position: 'absolute', right: 0, height: 50, width: 50, }, }));