Skip to content

Commit

Permalink
Merge pull request #20269 from Skalakid/17060-migrate-ImageView
Browse files Browse the repository at this point in the history
17060 - migrated ImageView to PressableWithoutFeedback
  • Loading branch information
techievivek authored Jun 15, 2023
2 parents 4280edd + cbb88e4 commit 4c1739b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/components/AttachmentView.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ function AttachmentView(props) {
<ImageView
onScaleChanged={props.onScaleChanged}
url={props.source}
fileName={props.file.name}
isAuthTokenRequired={isImage && props.isAuthTokenRequired}
/>
);
Expand Down
13 changes: 10 additions & 3 deletions src/components/ImageView/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {View, Pressable} from 'react-native';
import {View} from 'react-native';
import Image from '../Image';
import styles from '../../styles/styles';
import * as StyleUtils from '../../styles/StyleUtils';
import * as DeviceCapabilities from '../../libs/DeviceCapabilities';
import withWindowDimensions, {windowDimensionsPropTypes} from '../withWindowDimensions';
import FullscreenLoadingIndicator from '../FullscreenLoadingIndicator';
import PressableWithoutFeedback from '../Pressable/PressableWithoutFeedback';

const propTypes = {
/** Whether source url requires authentication */
Expand All @@ -18,6 +19,10 @@ const propTypes = {

/** URL to full-sized image */
url: PropTypes.string.isRequired,

/** image file name */
fileName: PropTypes.string.isRequired,

...windowDimensionsPropTypes,
};

Expand Down Expand Up @@ -266,7 +271,7 @@ class ImageView extends PureComponent {
onLayout={this.onContainerLayoutChanged}
style={[styles.imageViewContainer, styles.overflowAuto, styles.pRelative]}
>
<Pressable
<PressableWithoutFeedback
style={{
...StyleUtils.getZoomSizingStyle(
this.state.isZoomed,
Expand All @@ -283,6 +288,8 @@ class ImageView extends PureComponent {
}}
onPressIn={this.onContainerPressIn}
onPress={this.onContainerPress}
accessibilityRole="image"
accessibilityLabel={this.props.fileName}
>
<Image
source={{uri: this.props.url}}
Expand All @@ -292,7 +299,7 @@ class ImageView extends PureComponent {
onLoadStart={this.imageLoadingStart}
onLoad={this.imageLoad}
/>
</Pressable>
</PressableWithoutFeedback>

{this.state.isLoading && <FullscreenLoadingIndicator style={[styles.opacity1, styles.bgTransparent]} />}
</View>
Expand Down

0 comments on commit 4c1739b

Please sign in to comment.