import React from 'react';
import {
ListView,
SafeAreaView,
Text,
TouchableHighlight,
View
} from 'react-native';
import { connect } from 'react-redux';
import { Icon } from '../../base/font-icons';
import AbstractRecentList, { _mapStateToProps } from './AbstractRecentList';
import { getRecentRooms } from '../functions';
import styles, { UNDERLAY_COLOR } from './styles';
/**
* The native container rendering the list of the recently joined rooms.
*
* @extends AbstractRecentList
*/
class RecentList extends AbstractRecentList {
/**
* The datasource wrapper to be used for the display.
*/
dataSource = new ListView.DataSource({
rowHasChanged: (r1, r2) =>
r1.conference !== r2.conference
&& r1.dateTimeStamp !== r2.dateTimeStamp
});
/**
* Initializes a new {@code RecentList} instance.
*
* @inheritdoc
*/
constructor(props) {
super(props);
// Bind event handlers so they are only bound once per instance.
this._getAvatarStyle = this._getAvatarStyle.bind(this);
this._onSelect = this._onSelect.bind(this);
this._renderConfDuration = this._renderConfDuration.bind(this);
this._renderRow = this._renderRow.bind(this);
this._renderServerInfo = this._renderServerInfo.bind(this);
}
/**
* Implements React's {@link Component#render()}. Renders a list of recently
* joined rooms.
*
* @inheritdoc
* @returns {ReactElement}
*/
render() {
const { disabled, _recentList } = this.props;
if (!_recentList) {
return null;
}
const listViewDataSource
= this.dataSource.cloneWithRows(getRecentRooms(_recentList));
return (
);
}
/**
* Assembles the style array of the avatar based on if the conference was
* hosted on the default Jitsi Meet deployment or on a non-default one
* (based on current app setting).
*
* @param {Object} recentListEntry - The recent list entry being rendered.
* @private
* @returns {Array