Need to stop the shared animation for other screen.
See original GitHub issueHi. 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:
**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:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
Closing this as the mentioned slow-down is not related to shared-element