Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inverted flatlist at ReportActionsView with few items should stick to bottom of page #6798

Merged
merged 1 commit into from
Dec 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/components/InvertedFlatList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@ import React, {
forwardRef,
} from 'react';
import PropTypes from 'prop-types';
import {FlatList} from 'react-native';
import {FlatList, StyleSheet} from 'react-native';
import _ from 'underscore';
import BaseInvertedFlatList from './BaseInvertedFlatList';
import styles from '../../styles/styles';

const propTypes = {
/** Passed via forwardRef so we can access the FlatList ref */
innerRef: PropTypes.shape({
current: PropTypes.instanceOf(FlatList),
}).isRequired,

/** Any additional styles to apply */
// eslint-disable-next-line react/forbid-prop-types
contentContainerStyle: PropTypes.any,
};

// This is adapted from https://codesandbox.io/s/react-native-dsyse
Expand Down Expand Up @@ -61,12 +66,16 @@ class InvertedFlatList extends React.Component {
{...this.props}
ref={el => this.list = el}
shouldMeasureItems
contentContainerStyle={StyleSheet.compose(this.props.contentContainerStyle, styles.justifyContentEnd)}
/>
);
}
}

InvertedFlatList.propTypes = propTypes;
InvertedFlatList.defaultProps = {
contentContainerStyle: {},
};

export default forwardRef((props, ref) => (
// eslint-disable-next-line react/jsx-props-no-spreading
Expand Down
5 changes: 4 additions & 1 deletion src/pages/home/report/ReportActionsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,10 @@ class ReportActionsView extends React.Component {
data={this.sortedReportActions}
renderItem={this.renderItem}
CellRendererComponent={this.renderCell}
contentContainerStyle={[styles.chatContentScrollView, shouldShowReportRecipientLocalTime && styles.pt0]}
contentContainerStyle={[
styles.chatContentScrollView,
shouldShowReportRecipientLocalTime && styles.pt0,
]}
keyExtractor={this.keyExtractor}
initialRowHeight={32}
initialNumToRender={this.calculateInitialNumToRender()}
Expand Down
2 changes: 1 addition & 1 deletion src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ const styles = {

chatContentScrollView: {
flexGrow: 1,
justifyContent: 'flex-end',
justifyContent: 'flex-start',
paddingVertical: 16,
},

Expand Down