diff options
author | dan <dan.abramov@gmail.com> | 2024-11-09 22:34:46 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-09 22:34:46 +0000 |
commit | 2d73c5a24cf8ad06dbebcf44c8f4f053eedda5a4 (patch) | |
tree | 06e69c967f97d4d3fe6b4ba3f77efd66d85af2ae /src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.tsx | |
parent | e73d5c6c207a5da842cdb02a703ef3f130112fa2 (diff) | |
download | voidsky-2d73c5a24cf8ad06dbebcf44c8f4f053eedda5a4.tar.zst |
[Lightbox] Open animation (#6159)
* Measure all rects for embeds * Measure avi rects too * Animate lightbox in and out * Account for safe area in the animation * Tune spring times * Remove null checks for measurements * Remove superfluous view * Block swipe while opening * Interpolate width/height on native side for Android * Make it fast by animating only affine transforms * Fix tall image final state The initial animation frame is still off on both platforms. * Try to squeeze perf * Avoid blank images during animation on iOS * Fix bad rebase * Fix a huge memory issue due to expo/expo#24894 * Fix last frame flash * Fix thum dim calculation for tall images
Diffstat (limited to 'src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.tsx')
-rw-r--r-- | src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.tsx | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.tsx b/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.tsx index 1cd6b0020..543fad772 100644 --- a/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.tsx +++ b/src/view/com/lightbox/ImageViewing/components/ImageItem/ImageItem.tsx @@ -1,11 +1,15 @@ // default implementation fallback for web import React from 'react' -import {ImageStyle, StyleProp, View} from 'react-native' +import {View} from 'react-native' import {PanGesture} from 'react-native-gesture-handler' -import {AnimatedRef} from 'react-native-reanimated' +import {SharedValue} from 'react-native-reanimated' -import {Dimensions as ImageDimensions, ImageSource} from '../../@types' +import { + Dimensions as ImageDimensions, + ImageSource, + Transform, +} from '../../@types' type Props = { imageSrc: ImageSource @@ -14,11 +18,24 @@ type Props = { onZoom: (scaled: boolean) => void isScrollViewBeingDragged: boolean showControls: boolean - safeAreaRef: AnimatedRef<View> + measureSafeArea: () => { + x: number + y: number + width: number + height: number + } imageAspect: number | undefined imageDimensions: ImageDimensions | undefined - imageStyle: StyleProp<ImageStyle> dismissSwipePan: PanGesture + transforms: Readonly< + SharedValue<{ + scaleAndMoveTransform: Transform + cropFrameTransform: Transform + cropContentTransform: Transform + isResting: boolean + isHidden: boolean + }> + > } const ImageItem = (_props: Props) => { |