question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Need to stop the shared animation for other screen.

See original GitHub issue

Hi. Thanks for your great lib. I have used shared element for two screens, Lets say screen1 and screen2. Now I want to navigate from Second one to the third screen. but don’t want the shared transition to occur. here is a screen recording:

shared-element

**Screen1 component code **

const LogoList = ({ navigation }) => {

    const { data } = useContext(DataContext);
    // console.log(value)

    return (
        <FlatList
            data={data}
            contentContainerStyle={styles.listCN}
            numColumns={2}
            renderItem={(data) => {
                return (
                    <View style={styles.itemCN}>
                        <SharedElement id={data.item.name}>
                            <TouchableOpacity style={styles.itemInner} onPress={() => navigation.navigate('Model', { name: data.item.name, image: data.item.image })}>
                                {/* <Text style={styles.item}>{data.item.name}</Text> */}
                                <Image style={styles.item} source={{ uri: data.item.image }} />
                            </TouchableOpacity>
                        </SharedElement>
                    </View>
                )
            }}
        />
    )
}

Screen2 code:

const ModelScreen = ({ navigation }) => {
    return (
        <View style={styles.container}>
            <SharedElement id={name}>
                <View style={styles.imageCN}>
                    <Image style={styles.image} source={{ uri: image }} />
                </View>
            </SharedElement>
            <Button title='year' onPress={() => navigation.navigate('Year')} />
        </View>
    )
}

ModelScreen.sharedElements = (navigation, other, showing) => {
    console.log(showing)
    const name = navigation.getParam('name');
    return [{
        id: name,
        // animation: 'fade',
    }];
};

Screen3 code


const YearScreen = () => {
    return (
        <View>
            <Text>Year Screen</Text>
        </View>
    )
}

How can I disable the shared element on 3rd screen? As it does not have anything to do with the previous page’s transition.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sa8abcommented, Feb 27, 2020

It is not that slow to be noticed on video, and yes. tested and problem is not because of the shared-element. seems to be with react-native-stack. On physical device using expo. And thanks for your instant answer.

0reactions
IjzerenHeincommented, Mar 15, 2020

Closing this as the mentioned slow-down is not related to shared-element

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable react navigation's stack navigator transition?
If you're using @react-navigation/native-stack you can disable transition by using animation option of Stack.Navigator component.
Read more >
How to use Shared Element Transition with React Navigation v5
A Shared Element Transition determines how two different views share one or more elements to maintain the focus and experience.
Read more >
Shared Element Transitions with React Navigation - YouTube
In this lesson we'll learn how to make UI elements transition with screen changes using React Navigation and Fluid ...
Read more >
Shared Elements Transition in React Native - YouTube
Let's recreate the Facebook Marketplace shared transition in React Native! ... You Can Animated ... React Native Shared Elements: ...
Read more >
Implementing Shared Element Transition in React native
So, we have the starting and final position required for the animation, the next step is to actually animate the transition screen.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found