Skip to content

Commit

Permalink
Remove unnecessary opacity logic (#1646)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored Oct 9, 2023
1 parent b12cfbe commit ce0f796
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/view/com/lightbox/ImageViewing/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ function ImageViewing({
const imageList = useRef<VirtualizedList<ImageSource>>(null)
const [isScaled, setIsScaled] = useState(false)
const [isDragging, setIsDragging] = useState(false)
const [opacity, setOpacity] = useState(1)
const [currentImageIndex, setImageIndex] = useState(imageIndex)
const [headerTranslate] = useState(
() => new Animated.ValueXY(INITIAL_POSITION),
Expand Down Expand Up @@ -100,12 +99,6 @@ function ImageViewing({
}
}

const onRequestCloseEnhanced = () => {
setOpacity(0)
onRequestClose()
setTimeout(() => setOpacity(1), 0)
}

const onScroll = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
const {
nativeEvent: {
Expand Down Expand Up @@ -162,14 +155,14 @@ function ImageViewing({
aria-modal
accessibilityViewIsModal>
<ModalsContainer />
<View style={[styles.container, {opacity, backgroundColor}]}>
<View style={[styles.container, {backgroundColor}]}>
<Animated.View style={[styles.header, {transform: headerTransform}]}>
{typeof HeaderComponent !== 'undefined' ? (
React.createElement(HeaderComponent, {
imageIndex: currentImageIndex,
})
) : (
<ImageDefaultHeader onRequestClose={onRequestCloseEnhanced} />
<ImageDefaultHeader onRequestClose={onRequestClose} />
)}
</Animated.View>
<VirtualizedList
Expand All @@ -191,7 +184,7 @@ function ImageViewing({
<ImageItem
onZoom={onZoom}
imageSrc={imageSrc}
onRequestClose={onRequestCloseEnhanced}
onRequestClose={onRequestClose}
pinchGestureRef={pinchGestureRefs.get(imageSrc)}
isScrollViewBeingDragged={isDragging}
/>
Expand Down

0 comments on commit ce0f796

Please sign in to comment.