Skip to content
Closed
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
31 changes: 22 additions & 9 deletions packages/virtualized-lists/Lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -924,11 +924,13 @@ class VirtualizedList extends StateSafePureComponent<
const {ListEmptyComponent, ListFooterComponent, ListHeaderComponent} =
this.props;
const {data, horizontal} = this.props;
const isRTL = this._orientation().rtl
const inversionStyle = this.props.inverted
? horizontalOrDefault(this.props.horizontal)
? styles.horizontallyInverted
? [styles.horizontallyInverted]
: styles.verticallyInverted
: null;
const orientationStyle = {direction: isRTL ? 'rtl' : 'ltr'}
const cells: Array<any | React.Node> = [];
const stickyIndicesFromProps = new Set(this.props.stickyHeaderIndices);
const stickyHeaderIndices = [];
Expand Down Expand Up @@ -1106,8 +1108,8 @@ class VirtualizedList extends StateSafePureComponent<
: this.props.inverted,
stickyHeaderIndices,
style: inversionStyle
? [inversionStyle, this.props.style]
: this.props.style,
? [inversionStyle, this.props.style, orientationStyle]
: [this.props.style, orientationStyle],
isInvertedVirtualizedList: this.props.inverted,
maintainVisibleContentPosition:
this.props.maintainVisibleContentPosition != null
Expand Down Expand Up @@ -1502,7 +1504,7 @@ class VirtualizedList extends StateSafePureComponent<
}

_selectLength(
metrics: Readonly<{
metrics: $ReadOnly<{
height: number,
width: number,
...
Expand All @@ -1517,13 +1519,24 @@ class VirtualizedList extends StateSafePureComponent<
return this._orientation().horizontal ? x : y;
}

_orientation(): ListOrientation {
return {
horizontal: horizontalOrDefault(this.props.horizontal),
rtl: I18nManager.isRTL,
};
_orientation(): ListOrientation {
const horizontal = horizontalOrDefault(this.props.horizontal);
const flatStyle = StyleSheet.flatten(this.props.style);
const localDirection = flatStyle?.direction;

let isRTL = I18nManager.isRTL;
if (localDirection === 'rtl') {
isRTL = true;
} else if (localDirection === 'ltr') {
isRTL = false;
}

return {
horizontal,
rtl: isRTL,
};
}

_maybeCallOnEdgeReached() {
const {
data,
Expand Down