forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Expensify#34202 from tienifr/fix/25113
- Loading branch information
Showing
8 changed files
with
129 additions
and
150 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
import Lightbox from '@components/Lightbox'; | ||
import {zoomRangeDefaultProps} from '@components/MultiGestureCanvas/propTypes'; | ||
import type {ImageViewProps} from './types'; | ||
|
||
function ImageView({ | ||
isAuthTokenRequired = false, | ||
url, | ||
onScaleChanged, | ||
onPress, | ||
style, | ||
zoomRange = zoomRangeDefaultProps.zoomRange, | ||
onError, | ||
isUsedInCarousel = false, | ||
isSingleCarouselItem = false, | ||
carouselItemIndex = 0, | ||
carouselActiveItemIndex = 0, | ||
}: ImageViewProps) { | ||
const hasSiblingCarouselItems = isUsedInCarousel && !isSingleCarouselItem; | ||
|
||
return ( | ||
<Lightbox | ||
source={url} | ||
zoomRange={zoomRange} | ||
isAuthTokenRequired={isAuthTokenRequired} | ||
onScaleChanged={onScaleChanged} | ||
onPress={onPress} | ||
onError={onError} | ||
index={carouselItemIndex} | ||
activeIndex={carouselActiveItemIndex} | ||
hasSiblingCarouselItems={hasSiblingCarouselItems} | ||
style={style} | ||
/> | ||
); | ||
} | ||
|
||
ImageView.displayName = 'ImageView'; | ||
|
||
export default ImageView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import type {StyleProp, ViewStyle} from 'react-native'; | ||
import type ZoomRange from '@components/MultiGestureCanvas/types'; | ||
|
||
type ImageViewProps = { | ||
/** Whether source url requires authentication */ | ||
isAuthTokenRequired?: boolean; | ||
|
||
/** Handles scale changed event in image zoom component. Used on native only */ | ||
onScaleChanged: (scale: number) => void; | ||
|
||
/** URL to full-sized image */ | ||
url: string; | ||
|
||
/** image file name */ | ||
fileName: string; | ||
|
||
/** Handles errors while displaying the image */ | ||
onError?: () => void; | ||
|
||
/** Whether this AttachmentView is shown as part of a AttachmentCarousel */ | ||
isUsedInCarousel?: boolean; | ||
|
||
/** When "isUsedInCarousel" is set to true, determines whether there is only one item in the carousel */ | ||
isSingleCarouselItem?: boolean; | ||
|
||
/** The index of the carousel item */ | ||
carouselItemIndex?: number; | ||
|
||
/** The index of the currently active carousel item */ | ||
carouselActiveItemIndex?: number; | ||
|
||
/** Function for handle on press */ | ||
onPress?: () => void; | ||
|
||
/** Additional styles to add to the component */ | ||
style?: StyleProp<ViewStyle>; | ||
|
||
/** Range of zoom that can be applied to the content by pinching or double tapping. */ | ||
zoomRange?: ZoomRange; | ||
}; | ||
|
||
type ImageLoadNativeEventData = { | ||
width: number; | ||
height: number; | ||
}; | ||
|
||
export type {ImageViewProps, ImageLoadNativeEventData}; |
Oops, something went wrong.