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 - On increasing the screen size the user can see the previous image in the list #17760 #18615

Merged
merged 9 commits into from
May 12, 2023
5 changes: 3 additions & 2 deletions src/components/AttachmentCarousel/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import {View, FlatList} from 'react-native';
import {View, FlatList, useWindowDimensions} from 'react-native';
import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
Expand Down Expand Up @@ -252,7 +252,8 @@ class AttachmentCarousel extends React.Component {
* @returns {JSX.Element}
*/
renderCell(props) {
const style = [props.style, styles.h100, {width: this.state.containerWidth}];
// We are isolating the method this function uses to update the width of the container to make it respond faster
const style = [props.style, styles.h100, {width: useWindowDimensions().width}];
AmjedNazzal marked this conversation as resolved.
Show resolved Hide resolved

// eslint-disable-next-line react/jsx-props-no-spreading
return <View {...props} style={style} />;
Expand Down