Open onigiri-w2 opened 1 year ago
I tried a simple screen transition using this library. As a result, on Android emulator, flickering occurred just before the screen transition. Even with the same code, no flickering occurs on iOS emulator.
https://github.com/IjzerenHein/react-navigation-shared-element/assets/94182619/33985d4e-a28c-4794-a348-9aefc5b8ebce
https://github.com/IjzerenHein/react-navigation-shared-element/assets/94182619/b3640bd0-00ca-459f-bec8-e5f0e25a12ca
Environment:
Code:
import React from 'react'; import {Image, StyleSheet, Pressable} from 'react-native'; import { NavigationContainer, NavigationProp, useFocusEffect, } from '@react-navigation/native'; import { createSharedElementStackNavigator, SharedElement, } from 'react-navigation-shared-element'; type StackParamList = { List: undefined; Detail: undefined; }; const Stack = createSharedElementStackNavigator<StackParamList>(); export default function App() { return ( <NavigationContainer> <Stack.Navigator initialRouteName="List"> <Stack.Screen name="List" component={ListScreen} /> <Stack.Screen name="Detail" component={DetailScreen} sharedElements={() => ['image']} options={{ transitionSpec: { open: {animation: 'timing', config: {duration: 1000}}, close: {animation: 'timing', config: {duration: 200}}, }, }} /> </Stack.Navigator> </NavigationContainer> ); } const ListScreen = ({ navigation, }: { navigation: NavigationProp<StackParamList>; }) => { const [opacity, setOpacity] = React.useState(1); const handlePress = () => { setTimeout(() => { setOpacity(0); }, 200); navigation.navigate('Detail'); }; useFocusEffect(() => { setOpacity(1); }); return ( <Pressable onPress={handlePress}> <SharedElement id="image"> <Image source={require('./assets/sampleImg.jpeg')} style={[styles.listImg, {opacity}]} /> </SharedElement> </Pressable> ); }; const DetailScreen = () => { return ( <SharedElement id="image"> <Image source={require('./assets/sampleImg.jpeg')} style={styles.detailImg} /> </SharedElement> ); }; const styles = StyleSheet.create({ listImg: { width: 200, height: 300, resizeMode: 'contain', }, detailImg: { width: 400, height: 600, resizeMode: 'contain', }, });
Same problem here
Facing the same issue. Can anyone help?
I tried a simple screen transition using this library. As a result, on Android emulator, flickering occurred just before the screen transition. Even with the same code, no flickering occurs on iOS emulator.
https://github.com/IjzerenHein/react-navigation-shared-element/assets/94182619/33985d4e-a28c-4794-a348-9aefc5b8ebce
https://github.com/IjzerenHein/react-navigation-shared-element/assets/94182619/b3640bd0-00ca-459f-bec8-e5f0e25a12ca
Environment:
Code: