From 1a5b8b2c94ce1e66bff7e7295b799ae5b0613988 Mon Sep 17 00:00:00 2001
From: Samuel Newman <mozzius@protonmail.com>
Date: Thu, 18 Apr 2024 20:37:22 +0100
Subject: 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)
---
 src/view/com/composer/Composer.tsx | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

(limited to 'src/view/com/composer/Composer.tsx')

diff --git a/src/view/com/composer/Composer.tsx b/src/view/com/composer/Composer.tsx
index f8af6ce1b..f90bdbee2 100644
--- a/src/view/com/composer/Composer.tsx
+++ b/src/view/com/composer/Composer.tsx
@@ -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])
-- 
cgit 1.4.1

