From 60b549902c1cbf8fe00770a6bb64b036cf4b5657 Mon Sep 17 00:00:00 2001 From: m Date: Wed, 29 Jul 2026 19:46:51 +0200 Subject: [PATCH] resize animation ok --- mobile/app/index.tsx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/mobile/app/index.tsx b/mobile/app/index.tsx index 445530d..d7542a8 100644 --- a/mobile/app/index.tsx +++ b/mobile/app/index.tsx @@ -5,7 +5,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { NativeStackNavigationProp } from '@react-navigation/native-stack'; import { MaterialIcons } from '@expo/vector-icons'; import { Gesture, GestureDetector } from 'react-native-gesture-handler'; -import { runOnJS } from 'react-native-reanimated'; +import Animated, { runOnJS, useSharedValue, useAnimatedStyle, withSpring } from 'react-native-reanimated'; import { useAddTags, useMoveResources, useFolders, useFiles, useFreeLocalSpace } from '../hooks/useFiles'; import { UnifiedFileItem, isFolder } from '../types'; import { SearchBar, SearchFilters, MediaFilter } from '../components/SearchBar'; @@ -119,6 +119,12 @@ export function HomeScreen() { const { pendingCount, isSyncing } = useSyncQueue(); useAutoSync(); + const pinchScale = useSharedValue(1); + + const gridAnimatedStyle = useAnimatedStyle(() => ({ + transform: [{ scale: pinchScale.value }], + })); + const itemSize = (SCREEN_WIDTH - PADDING_H * 2 - (numColumns - 1) * ITEM_GAP) / numColumns; const loadMore = useCallback(() => { @@ -209,7 +215,14 @@ export function HomeScreen() { const pinchGesture = useMemo(() => Gesture.Pinch() + .onBegin(() => { + pinchScale.value = 1; + }) + .onChange((event) => { + pinchScale.value = event.scale; + }) .onEnd((event) => { + pinchScale.value = withSpring(1); runOnJS(handlePinchEnd)(event.scale); }), [] @@ -469,7 +482,7 @@ export function HomeScreen() { )} - + - + {!selectionMode && (