RoomView
This commit is contained in:
parent
7bd4182bf7
commit
86d5529cfd
|
@ -91,23 +91,23 @@ class MessageContainer extends React.Component<IMessageContainerProps, IMessageC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps: IMessageContainerProps, nextState: IMessageContainerState) {
|
// shouldComponentUpdate(nextProps: IMessageContainerProps, nextState: IMessageContainerState) {
|
||||||
const { isManualUnignored } = this.state;
|
// const { isManualUnignored } = this.state;
|
||||||
const { threadBadgeColor, isIgnored, highlighted } = this.props;
|
// const { threadBadgeColor, isIgnored, highlighted } = this.props;
|
||||||
if (nextProps.highlighted !== highlighted) {
|
// if (nextProps.highlighted !== highlighted) {
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
if (nextProps.threadBadgeColor !== threadBadgeColor) {
|
// if (nextProps.threadBadgeColor !== threadBadgeColor) {
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
if (nextProps.isIgnored !== isIgnored) {
|
// if (nextProps.isIgnored !== isIgnored) {
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
if (nextState.isManualUnignored !== isManualUnignored) {
|
// if (nextState.isManualUnignored !== isManualUnignored) {
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
if (this.subscription && this.subscription.unsubscribe) {
|
if (this.subscription && this.subscription.unsubscribe) {
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FlatListProps, StyleSheet } from 'react-native';
|
import { FlatListProps, StyleSheet } from 'react-native';
|
||||||
import { FlatList } from 'react-native-gesture-handler';
|
// import { FlatList } from 'react-native-gesture-handler';
|
||||||
|
import { FlashList } from '@shopify/flash-list';
|
||||||
import Animated from 'react-native-reanimated';
|
import Animated from 'react-native-reanimated';
|
||||||
|
|
||||||
import { isIOS } from '../../../lib/methods/helpers';
|
import { isIOS } from '../../../lib/methods/helpers';
|
||||||
import scrollPersistTaps from '../../../lib/methods/helpers/scrollPersistTaps';
|
import scrollPersistTaps from '../../../lib/methods/helpers/scrollPersistTaps';
|
||||||
|
|
||||||
const AnimatedFlatList = Animated.createAnimatedComponent(FlatList);
|
const AnimatedFlatList = Animated.createAnimatedComponent(FlashList);
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
list: {
|
list: {
|
||||||
|
@ -18,11 +19,9 @@ const styles = StyleSheet.create({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export type TListRef = React.RefObject<FlatList & { getNode: () => FlatList }>;
|
// export type TListRef = React.RefObject<FlatList & { getNode: () => FlatList }>;
|
||||||
|
|
||||||
export interface IListProps extends FlatListProps<any> {
|
export type IListProps = FlatListProps<any>;
|
||||||
listRef: TListRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
const List = ({ listRef, ...props }: IListProps) => (
|
const List = ({ listRef, ...props }: IListProps) => (
|
||||||
<AnimatedFlatList
|
<AnimatedFlatList
|
||||||
|
@ -30,13 +29,14 @@ const List = ({ listRef, ...props }: IListProps) => (
|
||||||
ref={listRef}
|
ref={listRef}
|
||||||
keyExtractor={(item: any) => item.id}
|
keyExtractor={(item: any) => item.id}
|
||||||
contentContainerStyle={styles.contentContainer}
|
contentContainerStyle={styles.contentContainer}
|
||||||
style={styles.list}
|
// style={styles.list}
|
||||||
inverted
|
inverted
|
||||||
removeClippedSubviews={isIOS}
|
estimatedItemSize={150}
|
||||||
initialNumToRender={7}
|
// removeClippedSubviews={isIOS}
|
||||||
|
// initialNumToRender={7}
|
||||||
onEndReachedThreshold={0.5}
|
onEndReachedThreshold={0.5}
|
||||||
maxToRenderPerBatch={5}
|
// maxToRenderPerBatch={5}
|
||||||
windowSize={10}
|
// windowSize={10}
|
||||||
{...props}
|
{...props}
|
||||||
{...scrollPersistTaps}
|
{...scrollPersistTaps}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1365,8 +1365,8 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
|
||||||
if (showUnreadSeparator || dateSeparator) {
|
if (showUnreadSeparator || dateSeparator) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{content}
|
|
||||||
<Separator ts={dateSeparator} unread={showUnreadSeparator} />
|
<Separator ts={dateSeparator} unread={showUnreadSeparator} />
|
||||||
|
{content}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue