From 3f79d4321653c522a35f48264467f406eacb9c27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrycja=20Kali=C5=84ska?= Date: Fri, 21 Jun 2024 13:11:49 +0200 Subject: [PATCH 1/5] Replace layout transitions example --- .../LayoutTransitionExample.tsx | 282 ++++++++++++++++++ .../LayoutAnimations/WaterfallGridExample.tsx | 213 ------------- apps/common-app/src/examples/index.ts | 4 +- 3 files changed, 284 insertions(+), 215 deletions(-) create mode 100644 apps/common-app/src/examples/LayoutAnimations/LayoutTransitionExample.tsx delete mode 100644 apps/common-app/src/examples/LayoutAnimations/WaterfallGridExample.tsx diff --git a/apps/common-app/src/examples/LayoutAnimations/LayoutTransitionExample.tsx b/apps/common-app/src/examples/LayoutAnimations/LayoutTransitionExample.tsx new file mode 100644 index 00000000000..86cc0251927 --- /dev/null +++ b/apps/common-app/src/examples/LayoutAnimations/LayoutTransitionExample.tsx @@ -0,0 +1,282 @@ +import React, { useState, useRef, useEffect } from 'react'; +import { + View, + Text, + Button, + SafeAreaView, + StyleSheet, + TouchableOpacity, +} from 'react-native'; +import Animated, { + LinearTransition, + SequencedTransition, + FadingTransition, + FadeOut, + JumpingTransition, + CurvedTransition, + EntryExitTransition, + FlipInEasyX, + FlipOutYRight, +} from 'react-native-reanimated'; +import { createStackNavigator } from '@react-navigation/stack'; +import { NavigationContainer } from '@react-navigation/native'; +import { type StackScreenProps } from '@react-navigation/stack'; + +interface Item { + id: number; + content: string; + color: string; +} + +const INITIAL_LIST = [ + { id: 1, content: '🍌', color: '#b58df1' }, + { id: 2, content: '🍎', color: '#ffe780' }, + { id: 3, content: '🥛', color: '#fa7f7c' }, + { id: 4, content: '🍙', color: '#82cab2' }, + { id: 5, content: '🍇', color: '#fa7f7c' }, + { id: 6, content: '🍕', color: '#b58df1' }, + { id: 7, content: '🍔', color: '#ffe780' }, + { id: 8, content: '🍟', color: '#b58df1' }, + { id: 9, content: '🍩', color: '#82cab2' }, +]; + +type RootStackParamList = { + Home: undefined; + linear: { title: string; transition: any }; + fading: { title: string; transition: any }; + sequenced: { title: string; transition: any }; + jumping: { title: string; transition: any }; + curved: { title: string; transition: any }; + entryexit: { title: string; transition: any }; +}; + +type HomeScreenProps = StackScreenProps; + +function HomeScreen({ navigation }: HomeScreenProps) { + return ( + +