all room by param dont need get from realm again
This commit is contained in:
parent
597c7e165e
commit
fe9a1ebeaa
|
@ -38,7 +38,7 @@ const styles = StyleSheet.create({
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
color: '#a00'
|
color: '#a00'
|
||||||
},
|
},
|
||||||
header: {
|
loadingMore: {
|
||||||
transform: [{ scaleY: -1 }],
|
transform: [{ scaleY: -1 }],
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
padding: 5,
|
padding: 5,
|
||||||
|
@ -86,7 +86,7 @@ export default class RoomView extends React.Component {
|
||||||
.sorted('ts', true);
|
.sorted('ts', true);
|
||||||
this.state = {
|
this.state = {
|
||||||
slow: false,
|
slow: false,
|
||||||
dataSource: [],
|
dataSource: ds.cloneWithRows(this.data),
|
||||||
loaded: true,
|
loaded: true,
|
||||||
joined: typeof props.rid === 'undefined'
|
joined: typeof props.rid === 'undefined'
|
||||||
};
|
};
|
||||||
|
@ -124,14 +124,12 @@ export default class RoomView extends React.Component {
|
||||||
this.state.end !== true
|
this.state.end !== true
|
||||||
) {
|
) {
|
||||||
this.setState({
|
this.setState({
|
||||||
// ...this.state,
|
|
||||||
loadingMore: true
|
loadingMore: true
|
||||||
});
|
});
|
||||||
|
|
||||||
const lastRowData = this.data[rowCount - 1];
|
const lastRowData = this.data[rowCount - 1];
|
||||||
RocketChat.loadMessagesForRoom(this.rid, lastRowData.ts, ({ end }) => {
|
RocketChat.loadMessagesForRoom(this.rid, lastRowData.ts, ({ end }) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
// ...this.state,
|
|
||||||
loadingMore: false,
|
loadingMore: false,
|
||||||
end
|
end
|
||||||
});
|
});
|
||||||
|
@ -186,11 +184,11 @@ export default class RoomView extends React.Component {
|
||||||
|
|
||||||
renderHeader = () => {
|
renderHeader = () => {
|
||||||
if (this.state.loadingMore) {
|
if (this.state.loadingMore) {
|
||||||
return <Text style={styles.header}>Loading more messages...</Text>;
|
return <Text style={styles.loadingMore}>Loading more messages...</Text>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.end) {
|
if (this.state.end) {
|
||||||
return <Text style={styles.header}>Start of conversation</Text>;
|
return <Text style={styles.loadingMore}>Start of conversation</Text>;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -202,7 +200,7 @@ export default class RoomView extends React.Component {
|
||||||
<ListView
|
<ListView
|
||||||
enableEmptySections
|
enableEmptySections
|
||||||
style={styles.list}
|
style={styles.list}
|
||||||
onEndReachedThreshold={10}
|
onEndReachedThreshold={350}
|
||||||
renderFooter={this.renderHeader}
|
renderFooter={this.renderHeader}
|
||||||
onEndReached={this.onEndReached}
|
onEndReached={this.onEndReached}
|
||||||
dataSource={this.state.dataSource}
|
dataSource={this.state.dataSource}
|
||||||
|
|
|
@ -239,7 +239,7 @@ export default class RoomsListView extends React.Component {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
navigateToRoom({ sid: id });
|
navigateToRoom({ sid: id, ...item });
|
||||||
clearSearch();
|
clearSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue