react native navigation shared element 1

react native navigation shared element

import { createSharedElementStackNavigator } from 'react-navigation-shared-element';

const stackNavigator = createSharedElementStackNavigator(
    List: ListScreen,
    Detail: DetailScreen,
    initialRouteName: 'List',

const AppContainer = createAppContainer(stackNavigator);

Here is what the above code is Doing:
1. We’re importing the createSharedElementStackNavigator from react-navigation-shared-element.
2. We’re creating a stack navigator using the createSharedElementStackNavigator function.
3. We’re passing the ListScreen and DetailScreen as the screens to the stack navigator.
4. We’re passing the initialRouteName as List.
5. We’re creating an AppContainer using the createAppContainer function.
6. We’re passing the stack navigator to the AppContainer.

Now, let’s add the AppContainer to the App.js file.

Similar Posts