React-native-reanimated entering/exiting dosen’t works on android

Description

I’m trying to use animation for entering & exiting animation and In ios its work’s fine but on android its dosent works,

This is the code:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>import { COLORS } from '@/src/constants/theme';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import {
ScrollView,
StyleSheet,
Text,
TouchableOpacity,
View,
} from 'react-native';
import Animated, {
SlideInRight,
SlideOutLeft,
} from 'react-native-reanimated';
const LIST_ITEM_COLOR = '#1798DE';
interface Item {
id: number;
}
export default function App() {
const initialMode = useRef<boolean>(true);
useEffect(() => {
initialMode.current = false;
}, []);
const [items, setItems] = useState<Item[]>(
new Array(5).fill(0).map((_, index) => ({ id: index }))
);
const onAdd = useCallback(() => {
setItems(currentItems => {
const nextItemId = (currentItems[currentItems.length - 1]?.id ?? 0) + 1;
return [...currentItems, { id: nextItemId }];
});
}, []);
const onDelete = useCallback((itemId: number) => {
setItems(currentItems => {
return currentItems.filter(item => item.id !== itemId);
});
}, []);
return (
<View style={styles.container}>
<TouchableOpacity style={styles.floatingButton} onPress={onAdd}>
<Text style={{ color: 'white', fontSize: 40 }}>+</Text>
</TouchableOpacity>
<ScrollView
style={{ flex: 1 }}
contentContainerStyle={{ paddingVertical: 50 }}
>
{items.map((item, index) => {
return (
<Animated.View
key={item.id}
entering={SlideInRight}
exiting={SlideOutLeft}
onTouchEnd={() => onDelete(item.id)}
style={styles.listItem}
/>
);
})}
</ScrollView>
</View>
);
}
</code>
<code>import { COLORS } from '@/src/constants/theme'; import React, { useCallback, useEffect, useRef, useState } from 'react'; import { ScrollView, StyleSheet, Text, TouchableOpacity, View, } from 'react-native'; import Animated, { SlideInRight, SlideOutLeft, } from 'react-native-reanimated'; const LIST_ITEM_COLOR = '#1798DE'; interface Item { id: number; } export default function App() { const initialMode = useRef<boolean>(true); useEffect(() => { initialMode.current = false; }, []); const [items, setItems] = useState<Item[]>( new Array(5).fill(0).map((_, index) => ({ id: index })) ); const onAdd = useCallback(() => { setItems(currentItems => { const nextItemId = (currentItems[currentItems.length - 1]?.id ?? 0) + 1; return [...currentItems, { id: nextItemId }]; }); }, []); const onDelete = useCallback((itemId: number) => { setItems(currentItems => { return currentItems.filter(item => item.id !== itemId); }); }, []); return ( <View style={styles.container}> <TouchableOpacity style={styles.floatingButton} onPress={onAdd}> <Text style={{ color: 'white', fontSize: 40 }}>+</Text> </TouchableOpacity> <ScrollView style={{ flex: 1 }} contentContainerStyle={{ paddingVertical: 50 }} > {items.map((item, index) => { return ( <Animated.View key={item.id} entering={SlideInRight} exiting={SlideOutLeft} onTouchEnd={() => onDelete(item.id)} style={styles.listItem} /> ); })} </ScrollView> </View> ); } </code>
import { COLORS } from '@/src/constants/theme';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import {
  ScrollView,
  StyleSheet,
  Text,
  TouchableOpacity,
  View,
} from 'react-native';
import Animated, {
  SlideInRight,
  SlideOutLeft,
} from 'react-native-reanimated';

const LIST_ITEM_COLOR = '#1798DE';

interface Item {
  id: number;
}

export default function App() {
  const initialMode = useRef<boolean>(true);

  useEffect(() => {
    initialMode.current = false;
  }, []);

  const [items, setItems] = useState<Item[]>(
    new Array(5).fill(0).map((_, index) => ({ id: index }))
  );

  const onAdd = useCallback(() => {
    setItems(currentItems => {
      const nextItemId = (currentItems[currentItems.length - 1]?.id ?? 0) + 1;
      return [...currentItems, { id: nextItemId }];
    });
  }, []);

  const onDelete = useCallback((itemId: number) => {
    setItems(currentItems => {
      return currentItems.filter(item => item.id !== itemId);
    });
  }, []);

  return (
    <View style={styles.container}>
      <TouchableOpacity style={styles.floatingButton} onPress={onAdd}>
        <Text style={{ color: 'white', fontSize: 40 }}>+</Text>
      </TouchableOpacity>
      <ScrollView
        style={{ flex: 1 }}
        contentContainerStyle={{ paddingVertical: 50 }}
      >
        {items.map((item, index) => {
          return (
            <Animated.View
              key={item.id}
              entering={SlideInRight}
              exiting={SlideOutLeft}
              onTouchEnd={() => onDelete(item.id)}
              style={styles.listItem}
            />
          );
        })}
      </ScrollView>
    </View>
  );
}

The funny part is that the animation is works I try the your first animation code and width.value = withSpring(width.value + 50) Really animate the View, so the animation works but I need the entering prop to works… any ideas?

notice
on iOS works fine just android not work

Reanimated version

3.10.0 ( I try 3.6.1 too and same problem)

React Native version

0.73.6

Platforms

iOS (entering/exiting works)
Android (entering/exiting dosen’t works)

Architecture

Fabric (New Architecture)

Build type

eas build dev

Device model

several android devices & android emulator

Acknowledgements

Yes

Steps to reproduce

1.Click on “onAdd” function to add more items (expecting entering with animation)
2. Get no animation at all (only with entering and exiting)

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật