SharedElement
Connect one native view across two stack screens for a transition.
App.tsx
<SharedElement id="meadow"> <View style={coverStyle} /></SharedElement> <Stack.Screen name="Notebook" component={Notebook} options={({ route }) => ({ sharedElementId: route.params.coverId, })}/>Wrap a single native child on each screen and give both wrappers the same id. For a gallery, use the selected photo's ID so the back transition returns to its thumbnail. Set the destination Stack.Screen option sharedElementId to that ID.
import { SharedElement } from 'react-nitro-navigation'
import { Image } from 'react-nitro-renderer'
import crocus from './assets/crocus.jpg'
export function Thumbnail() {
return (
<SharedElement id="crocus">
<Image image={crocus} layout={{ width: 80, height: 80 }} />
</SharedElement>
)
}A shared ID must be unique within its screen. For an example that connects both screens and configures the return transition, see Shared element transitions.