Message list scroll based on window size
This commit is contained in:
parent
318cf7b970
commit
541d9783ee
|
@ -383,7 +383,11 @@ const RocketChat = {
|
||||||
rooms = rooms.update;
|
rooms = rooms.update;
|
||||||
}
|
}
|
||||||
const data = subscriptions.map((subscription) => {
|
const data = subscriptions.map((subscription) => {
|
||||||
subscription._updatedAt = (rooms.find(room => room._id === subscription.rid) || subscription)._updatedAt;
|
const room = rooms.find(({ _id }) => _id === subscription.rid);
|
||||||
|
delete subscription._updatedAt;
|
||||||
|
if (room) {
|
||||||
|
subscription._updatedAt = room._updatedAt;
|
||||||
|
}
|
||||||
subscription._server = { id: server.server };
|
subscription._server = { id: server.server };
|
||||||
return subscription;
|
return subscription;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Text, View, StyleSheet, Button, SafeAreaView } from 'react-native';
|
import { Text, View, StyleSheet, Button, SafeAreaView, Dimensions } from 'react-native';
|
||||||
import { ListView } from 'realm/react-native';
|
import { ListView } from 'realm/react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { bindActionCreators } from 'redux';
|
import { bindActionCreators } from 'redux';
|
||||||
|
@ -192,6 +192,7 @@ export default class RoomView extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { height } = Dimensions.get('window');
|
||||||
return (
|
return (
|
||||||
<KeyboardView contentContainerStyle={styles.container} keyboardVerticalOffset={64}>
|
<KeyboardView contentContainerStyle={styles.container} keyboardVerticalOffset={64}>
|
||||||
{this.renderBanner()}
|
{this.renderBanner()}
|
||||||
|
@ -199,7 +200,7 @@ export default class RoomView extends React.Component {
|
||||||
<ListView
|
<ListView
|
||||||
enableEmptySections
|
enableEmptySections
|
||||||
style={styles.list}
|
style={styles.list}
|
||||||
onEndReachedThreshold={350}
|
onEndReachedThreshold={height / 2}
|
||||||
renderFooter={this.renderHeader}
|
renderFooter={this.renderHeader}
|
||||||
onEndReached={this.onEndReached}
|
onEndReached={this.onEndReached}
|
||||||
dataSource={this.state.dataSource}
|
dataSource={this.state.dataSource}
|
||||||
|
|
Loading…
Reference in New Issue