Skip to content

Are there any plans to replace unsupported APIs (KEYCODE_BACK and #onBackPressed) to support Android's new Predictive back gesture?  #34529

@dzuluaga

Description

@dzuluaga

Description

Apps using React Native targeting enableOnBackInvokedCallback might break if they use the code that references the unsupported APIs like KEYCODE_BACK and #onBackPressed). Therefore, we recommend migrating to OnBackPressedCallback to support the new back gesture experience and avoid any breakages.

Are there any plans to replace these APIs?

Context

Android 13 introduced the Predictive Back gesture, which enables users to visualize where they're going to land before completing a back swipe.

Version

0.68

Output of npx react-native info

N/A

Steps to reproduce

  1. EnableOnBackInvokedCallback=true in the AndroidManifest.xml of any given app
  2. Target AndroidSdk 33
  3. Use the back gesture in an app that uses unsupported APIS:
    • OnBackPressed ReactActivity, ReactDelegate, ReactFragment, ReactActivityDelegate, ReactAppTestActivity, ReactInstanceManager
    • KEYCODE_BACK ReactModalHostView

Snack, code example, screenshot, or link to a repository

The new APIs, docs, and samples are available from the above link. Please reply if you need more info.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Platform: AndroidAndroid applications.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions