about summary refs log tree commit diff
path: root/src/view/com/composer/Composer.tsx
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2024-04-18 20:37:22 +0100
committerGitHub <noreply@github.com>2024-04-18 12:37:22 -0700
commit1a5b8b2c94ce1e66bff7e7295b799ae5b0613988 (patch)
treef0b5501a3d3edbd440717f292f6a5a62e045d707 /src/view/com/composer/Composer.tsx
parentbef7d8a325f2bf63fd096093fe1b0eac05c711a3 (diff)
downloadvoidsky-1a5b8b2c94ce1e66bff7e7295b799ae5b0613988.tar.zst
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)
Diffstat (limited to 'src/view/com/composer/Composer.tsx')
-rw-r--r--src/view/com/composer/Composer.tsx17
1 files changed, 16 insertions, 1 deletions
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])