Skip to content

Commit

Permalink
adding some logic to update the size of image when cycled
Browse files Browse the repository at this point in the history
  • Loading branch information
JediWattson committed Jul 20, 2022
1 parent e2e9633 commit 70d5d29
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/AttachmentCarousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class AttachmentCarousel extends React.Component {
)}
<SwipeableView
isAnimated
onPress={() => canUseTouchScreen() && this.onShowArrow(!this.state.showArrows)}
onPress={() => canUseTouchScreen() && this.onShowArrow(!this.state.showArrows)}
onSwipeHorizontal={this.cycleThroughAttachments}
>
<AttachmentView sourceURL={this.state.sourceURL} file={this.state.file} />
Expand Down
8 changes: 8 additions & 0 deletions src/components/ImageView/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ class ImageView extends PureComponent {
this.state.interactionPromise = InteractionManager.runAfterInteractions(() => this.calculateImageSize());
}

componentDidUpdate() {
// This resizes the images on cycling
if (!this.state.containerHeight || this.state.isLoading) {
return;
}
this.calculateImageSize();
}

componentWillUnmount() {
if (!this.state.interactionPromise) {
return;
Expand Down

0 comments on commit 70d5d29

Please sign in to comment.