diff --git a/docs/integration-with-android-fragment.md b/docs/integration-with-android-fragment.md index 541fe6a2ec7..ea086300342 100644 --- a/docs/integration-with-android-fragment.md +++ b/docs/integration-with-android-fragment.md @@ -33,6 +33,8 @@ This is required by React Native to handle the back button press event. Go into your host activity and make sure it implements the `DefaultHardwareBackBtnHandler` interface: +> **Deprecated.** `Activity.onBackPressed()` has been [deprecated]() since API level 33. Android 16 devices with apps targeting API level 36 this will [no longer be called](https://developer.android.com/about/versions/16/behavior-changes-16#predictive-back) and [OnBackPressedDispatcher](https://developer.android.com/reference/androidx/activity/OnBackPressedDispatcher) should be used instead. + @@ -56,7 +58,7 @@ import androidx.appcompat.app.AppCompatActivity } + override fun invokeDefaultOnBackPressed() { -+ super.onBackPressed() ++ onBackPressedDispatcher.onBackPressed() + } } ``` @@ -86,7 +88,7 @@ import androidx.appcompat.app.AppCompatActivity; + @Override + public void invokeDefaultOnBackPressed() { -+ super.onBackPressed(); ++ getOnBackPressedDispatcher().onBackPressed(); + } } ```