Skip to content

Gesture Navigation

CircuitX provides NavDecoration implementation which support navigation through appropriate gestures on certain platforms.

dependencies {
  implementation("com.slack.circuit:circuitx-gesture-navigation:<version>")
}

To enable gesture navigation support, you can use the use the GestureNavigationDecorationFactory:

NavigableCircuitContent(
  navigator = navigator,
  backStack = backStack,
  decoratorFactory =
    remember(navigator) {
      GestureNavigationDecorationFactory(
        // Pop the back stack once the user has gone 'back'
        onBackInvoked = navigator::pop
      )
    },
)

Android

On Android, this supports the Predictive back gesture which is available on Android 14 and later (API level 34+). On older platforms, Circuit’s default NavDecoration decoration is used instead.

Star sample running on an Android 14 device

iOS

On iOS, this simulates iOS’s ‘Interactive Pop Gesture’ in Compose UI, allowing the user to swipe Circuit UIs away. As this is a simulation of the native behavior, it does not match the native functionality perfectly. However, it is a good approximation.

Tivi app running on iPhone

Other platforms

On other platforms we defer to Circuit’s default NavDecoration decoration.