itemReselections

fun NavigationBarView.itemReselections(): Flow<MenuItem>

Create a Flow of item reselected events on the NavigationBarView instance where the value emitted is the currently selected menu item.

Note: Created flow keeps a strong reference to the NavigationBarView instance until the coroutine that launched the flow collector is cancelled.

Example of usage:

bottomNavigationView.itemReselections()
.onEach { menuItem ->
// handle menuItem
}
.launchIn(uiScope)

navigationRailView.itemReselections()
.onEach { menuItem ->
// handle menuItem
}
.launchIn(uiScope)

fun BottomNavigationView.itemReselections(): Flow<MenuItem>

Deprecated

Use NavigationBarView.itemReselections(): Flow<MenuItem> instead.

Create a Flow of item reselected events on the BottomNavigationView instance where the value emitted is the currently selected menu item.

Note: Created flow keeps a strong reference to the BottomNavigationView instance until the coroutine that launched the flow collector is cancelled.

Example of usage:

bottomNavigationView.itemReselections()
.onEach { menuItem ->
// handle menuItem
}
.launchIn(uiScope)