Set of methods for navigating between screens. Each set of files (jsx and js) in the view folder generates a screen. It is possible to navigate through these screens using the methods described here.

Hierarchy

  • Navigation

Methods

  • Adds a back handler to intercept user back navigation.

    The backHandler pool is a stack with bubbling propagation support.

    All handlers are cleared during navigation using the navigate method.

    Compatibility Control

    • API LEVEL 1 - Functionality added

    Parameters

    Returns void

  • Registers a listener to handle events when the Eitri app regains user focus in specific scenarios.

    This event is triggered in the following cases:

    1. The user returns to the app after navigating away to another app or the device's home screen.
    2. An eitri-app A opens another eitri-app B using nativeNavigation.open. When eitri-app B is closed, eitri-app A is notified.
    3. When switching tabs in apps using EitriBottomTabView, the newly focused tab is notified.

    This event is not triggered in these scenarios:

    • When the eitri-app is open.
    • After closing an eitri-app that was opened with nativeNavigation.open.

    Example:

    Eitri.navigation.addOnResumeListener(() => {
    console.log("Eitri app was resumed");
    });

    Compatibility Control

    • API Level 6: Functionality introduced.
    • API Level 14: Full compatibility with EitriBottomTabView.

    Parameters

    • callback: (() => void)
        • (): void
        • Returns void

    Returns Promise<void>

  • Performs a navigation back to one or several previous screens

    Example:

    Eitri.navigation.back()
    

    Compatibility Control

    • API LEVEL 1 - Functionality added

    Parameters

    • steps: number

      Number of screens to go back (optional)

    Returns void

  • Performs navigation back to the first screen in the navigation stack

    Example:

    Eitri.navigation.backToTop()
    

    Compatibility Control

    • API LEVEL 1 - Functionality added

    Returns void

  • Remove all back handlers.

    Compatibility Control

    • API LEVEL 1 - Functionality added

    Returns void

  • Stop onResume listeners from running in background.

    Compatibility Control

    • API LEVEL 6 - Functionality added

    Returns Promise<void>

  • Closes the current eitri-app

    Example:

    Eitri.navigation.close()
    

    Compatibility Control

    • API LEVEL 1 - Functionality added

    Parameters

    Returns Promise<void>

  • Navigates to another screen contained in the views folder

    Examples:

    Simple navigation to a View in the folder:

    Eitri.navigation.navigate({path: '/AnotherView'})
    

    Navigation passing a state object from one view to another:

    Eitri.navigation.navigate({path: '/AnotherView', state: { name: 'Pedro Álvares Cabral' }})
    

    Use replace = true to indicate that the view will be replaced by the next one:

    Eitri.navigation.navigate({path: '/AnotherView', replace: true})
    

    Compatibility Control

    • API LEVEL 1 - Functionality added

    Parameters

    Returns Promise<void>

  • Opens an eitri-app

    Example:

    Eitri.navigation.open({
    slug: 'checkout',
    initParams: {item: 'Refrigerator', id: 999987},
    restorationContext: {screen: 'categories/appliances'}
    })

    Compatibility Control

    • API LEVEL 1 - Functionality added

    Parameters

    Returns Promise<void>

  • Registers a listener to handle events when the Eitri app regains user focus in specific scenarios.

    It clears any other onResume listeners already registered in the app.

    This event is triggered in the following cases:

    1. The user returns to the app after navigating away to another app or the device's home screen.
    2. An eitri-app A opens another eitri-app B using nativeNavigation.open. When eitri-app B is closed, eitri-app A is notified.
    3. When switching tabs in apps using EitriBottomTabView, the newly focused tab is notified.

    This event is not triggered in these scenarios:

    • When the eitri-app is open.
    • After closing an eitri-app that was opened with nativeNavigation.open.

    Example:

    Eitri.navigation.setOnResumeListener(() => {
    console.log("Eitri app was resumed");
    });

    Compatibility Control

    • API Level 6: Functionality introduced.
    • API Level 14: Full compatibility with EitriBottomTabView.

    Parameters

    • callback: (() => void)
        • (): void
        • Returns void

    Returns Promise<void>

Generated using TypeDoc