about summary refs log tree commit diff
path: root/src/state/lightbox.tsx
Commit message (Collapse)AuthorAgeFilesLines
* Add displayName to contexts (#8814)Samuel Newman2025-08-141-1/+3
|
* Fix stuck lightbox (#6816)dan2024-11-281-1/+9
| | | | | | | * Fix lightbox getting stuck by fixing rAF order If you spam opening lightbox too fast, the effect that calls rAF will clean up and set up again midflight. Unfortunately, due to rAF order being unreliable, it may fire in reverse order, causing "open, open, close" instead of "open, close, open", so it would get stuck closed. This fixes the rAF order. * Don't allow opening another lightbox while it's open
* [Lightbox] Open animation (#6159)dan2024-11-091-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Remove SCREEN from lightbox layout (#6124)dan2024-11-061-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Assign an ID to lightbox and use it as a key * Consolidate lightbox props into an object * Remove unused prop * Move SafeAreaView declaration * Keep SafeAreaView always mounted When exploring Android animation, I noticed its content jumps on the first frame. I think this should help prevent that. * Pass safe area down for measurement * Remove dependency on SCREEN in Android event handlers * Remove dependency on SCREEN in iOS event handlers * Remove dependency on SCREEN on iOS * Remove dependency on SCREEN on Android * Remove dependency on JS calc in controls * Use flex for iOS layout
* Refactor lightbox prop drilling (#6073)dan2024-11-041-20/+3
| | | | | | | | | | | * Refactor lightbox footer to render prop * Unify lightbox types * Unindent * Refactor LightboxFooter props * Move LightboxFooter into the implementation file
* Unify dimensions cache between lightbox and feed (#6047)dan2024-11-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove useless memo * Use explicit values when useImageAspectRatio doesn't know It's not very good that you can't distingiush when we haven't loaded vs when we're certain. This shifts the burden of dealing with missing values to the caller. * Check cache early * Handle src change * Rewrite image-sizes.fetch to avoid mixing async styles * Make image-sizes LRU Code is copy paste from useImageDimensions.ts * Rm unused fields * Derive aspect on the fly * Factor useImageDimensions out of useImageAspectRatio * Move useImageDimensions into image-sizes * Make lightbox use the same cache * Wire up known dimensions to the lightbox * Handle division by zero in the hook * Use safe aspect for lightbox calculations
* Measure tapped image coordinates before opening lightbox (#6001)dan2024-10-311-0/+3
| | | | | * Measure image on press * Pass dimensions to the lightbox component
* Show almost-instant preview when opening lightbox (#6000)dan2024-10-291-0/+1
| | | | | | | | | | | * Plumb thumbUri down to the lightbox * Remove onLoad tracking from lightbox * Hook up placeholder URI to the image * Fix NaN causing crash on double tap while offline * Protect against NaNs in the future
* Refactor lightbox model to plain object (#5999)dan2024-10-291-14/+11
| | | | | * Refactor lightbox model to plain object * Rename name to type
* Use non-reactive callbacks for some methods (#1948)dan2023-11-161-8/+6
| | | | | | | * Use non-reactive callbacks for some methods * Remove unnecessary state * Use non-reactive callbacks for modals
* Close active elems (react-query refactor) (#1926)Paul Frazee2023-11-161-3/+5
| | | | | | | | | * Refactor closeAny and closeAllActiveElements * Add close lightbox * Switch to hooks * Fixes
* Factor lightbox out into hook/context (#1919)Paul Frazee2023-11-151-0/+86