Recycle the post list (#1938)

This commit is contained in:
Elias Nahum 2018-07-20 16:58:38 -04:00 committed by Harrison Healey
parent 59d077a71d
commit c7e1a70236
2 changed files with 27 additions and 31 deletions

View file

@ -415,9 +415,6 @@ export default class Post extends PureComponent {
const onUsernamePress = Config.ExperimentalUsernamePressIsMention ? this.autofillUserMention : this.viewUserProfile;
const mergeMessage = consecutivePost && !hasComments;
// postWidth = deviceWidth - profilePic width - profilePictureContainer margins - right column margin
const postWidth = this.props.deviceWidth - 66;
let postHeader;
let userProfile;
let consecutiveStyle;
@ -480,33 +477,31 @@ export default class Post extends PureComponent {
{!commentedOnPost && this.renderReplyBar()}
<View style={[style.rightColumn, (commentedOnPost && isLastReply && style.rightColumnPadding)]}>
{postHeader}
<View style={{maxWidth: postWidth}}>
<PostBody
ref={'postBody'}
canDelete={this.props.canDelete}
canEdit={this.state.canEdit}
highlight={highlight}
channelIsReadOnly={channelIsReadOnly}
isSearchResult={isSearchResult}
navigator={this.props.navigator}
onAddReaction={this.handleAddReaction}
onCopyPermalink={this.handleCopyPermalink}
onCopyText={this.handleCopyText}
onFailedPostPress={this.handleFailedPostPress}
onPermalinkPress={onPermalinkPress}
onPostDelete={this.handlePostDelete}
onPostEdit={this.handlePostEdit}
onPress={this.handlePress}
postId={post.id}
renderReplyBar={commentedOnPost ? this.renderReplyBar : emptyFunction}
toggleSelected={this.toggleSelected}
managedConfig={managedConfig}
isFlagged={isFlagged}
isReplyPost={isReplyPost}
showAddReaction={showAddReaction}
showLongPost={showLongPost}
/>
</View>
<PostBody
ref={'postBody'}
canDelete={this.props.canDelete}
canEdit={this.state.canEdit}
highlight={highlight}
channelIsReadOnly={channelIsReadOnly}
isSearchResult={isSearchResult}
navigator={this.props.navigator}
onAddReaction={this.handleAddReaction}
onCopyPermalink={this.handleCopyPermalink}
onCopyText={this.handleCopyText}
onFailedPostPress={this.handleFailedPostPress}
onPermalinkPress={onPermalinkPress}
onPostDelete={this.handlePostDelete}
onPostEdit={this.handlePostEdit}
onPress={this.handlePress}
postId={post.id}
renderReplyBar={commentedOnPost ? this.renderReplyBar : emptyFunction}
toggleSelected={this.toggleSelected}
managedConfig={managedConfig}
isFlagged={isFlagged}
isReplyPost={isReplyPost}
showAddReaction={showAddReaction}
showLongPost={showLongPost}
/>
</View>
</View>
</View>
@ -518,6 +513,7 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
return {
container: {
flexDirection: 'row',
overflow: 'hidden',
},
pendingPost: {
opacity: 0.5,

View file

@ -358,7 +358,7 @@ export default class PostList extends PureComponent {
ListFooterComponent={this.props.renderFooter}
onEndReached={onEndReached}
onEndReachedThreshold={Platform.OS === 'ios' ? 0 : 1}
removeClippedSubviews={Platform.OS === 'android'}
removeClippedSubviews={true}
{...refreshControl}
renderItem={this.renderItem}
contentContainerStyle={styles.postListContent}