Add layout transitions to the composer photo gallery on iOS (#3609)

* add layoutanimation + transition to images

* make iOS-only

* use useLayoutEffect

* make iOS only (again)
This commit is contained in:
Samuel Newman 2024-04-18 20:37:22 +01:00 committed by GitHub
parent bef7d8a325
commit 1a5b8b2c94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 27 additions and 10 deletions

View file

@ -1,9 +1,17 @@
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'
import React, {
useCallback,
useEffect,
useLayoutEffect,
useMemo,
useRef,
useState,
} from 'react'
import {
ActivityIndicator,
BackHandler,
Keyboard,
KeyboardAvoidingView,
LayoutAnimation,
Platform,
Pressable,
ScrollView,
@ -122,6 +130,13 @@ export const ComposePost = observer(function ComposePost({
() => new GalleryModel(initImageUris),
[initImageUris],
)
useLayoutEffect(() => {
if (isIOS) {
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)
}
}, [gallery.size])
const onClose = useCallback(() => {
closeComposer()
}, [closeComposer])