Back navigation issue (using letest version in android)
in Upto Android 13 devices?
When I navigate from one screen to another, the app closes after pressing the back button of the device
He is taking me to the home screen instead of the back screen
same, downgrade android sdk to 1.0.18 helped
Would it be possible to get a sample project or reproduction so it can be fixed?
same, downgrade android sdk to
1.0.18helped
how to do this ? i have same issue
Hi! @baptistejamin any chance there's a fix for this issue? Downgrading to 0.13.3 doesn't seem like a good workaround and I couldn't figure out how to force the underlying android sdk to be 1.0.18 with the 0.14.1 version as @robert-lk suggested. Thanks!
You can use pnpm patch or patch-package and path node_modules/react-native-crisp-chat-sdk/android/build.gradle
e.g.
diff --git a/android/build.gradle b/android/build.gradle
index d3bf82eb91152c038ea14cd1d932932e2fe3363d..6a16b5776aaf4fb33dea8e64f66bde89ed3a751e 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -126,5 +126,5 @@ dependencies {
// noinspection GradleDynamicVersion
api 'com.facebook.react:react-native:+'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
- implementation 'im.crisp:crisp-sdk:2.0.0beta1'
+ implementation 'im.crisp:crisp-sdk:1.0.18'
}
Anyone here can provide a demo project that is getting affected with this?
Same issue :/
@baptistejamin just init a Expo project with the lib at 0.14.1. Build Android app with React Navigation with 2 Stack. when press back button on Android it close the app.
@baptistejamin
This is because android:enableOnBackInvokedCallback is set to true at the application level in this package's Android manifest file. This manifest is merged with our Application's manifest and this rule breaks system back navigation on React Native apps with Android versions 13 and above.
To fix this issue:
Add
android:enableOnBackInvokedCallback="true" tools:replace="android:enableOnBackInvokedCallback" in the application attribute of your AndroidManifest.xml
This was a very annoying issue to debug. I hope this is fixed in the next release or at least documented.
Hi, I'm the Android dev behind the Crisp SDK.
Support reported to me that there is an issue with the back navigation on React-Native projects.
As I am not used to it, I struggled a bit but I finally was able to deploy the Sample project on a device using Android 15.
Unfortunately, I did not reproduced the behavior with version 0.15.2 of the React-Native plugin.
Is there a specific case where the app closes instead of the chatbox when user tries to leave it with a back gesture or the back button?
@Doc1faux I tried replicating my project bit by bit to see what was the cause of the error, when I installed "react-native-crisp-chat-sdk": "^0.14.4",, I faced this error, again on new project, I updated the package to new version still same issue.
I will share the repo to reproduce this bug in a moment.
@Doc1faux I tried replicating my project bit by bit to see what was the cause of the error, when I installed
"react-native-crisp-chat-sdk": "^0.14.4",, I faced this error, again on new project, I updated the package to new version still same issue.I will share the repo to reproduce this bug in a moment.
Link to reproduce.
Clone locally and test.
Back button close the app:
- run
npm install - run
npm run android
Back button work fine:
- Remove
"react-native-crisp-chat-sdk": "^0.15.2",frompackage.json - run
rm -rf node_modules - run
npm install - run
npm run android
https://github.com/raghav-phonebox/navigation-test
same, downgrade android sdk to
1.0.18helped
This throws error in new version.
Would it be possible to get a sample project or reproduction so it can be fixed?
@baptistejamin
Here is the link to reproduce this error.
@Doc1faux I tried replicating my project bit by bit to see what was the cause of the error, when I installed
"react-native-crisp-chat-sdk": "^0.14.4",, I faced this error, again on new project, I updated the package to new version still same issue. I will share the repo to reproduce this bug in a moment.Link to reproduce.
Clone locally and test.
Back button close the app:
- run
npm install- run
npm run androidBack button work fine:
- Remove
"react-native-crisp-chat-sdk": "^0.15.2",frompackage.json- run
rm -rf node_modules- run
npm install- run
npm run androidhttps://github.com/raghav-phonebox/navigation-test
As stated by @Cypherball in its comment, it seems to come from android:enableOnBackInvokedCallback set to true in our AndroidManifest.xml file.
Activity.onBackPressed being deprecated, we have switched to the OnBackPressedCallback and back when I implemented it, Google had added in their doc to add predictive back gesture which includes setting the android:enableOnBackInvokedCallback to true in the application tag of the AndroidManifest.xml file.
However, in the android:enableOnBackInvokedCallback documentation, it is stated that even set to false (default value), OnBackPressedCallback keeps being called and after testing, our back navigation does not seem to be affected at all.
So I will remove the android:enableOnBackInvokedCallback from the AndroidManifest.xml file and it should work again with react-native which not supports it.
@Doc1faux @baptistejamin Thank you for fixing this issue. I have tested it and it works.
Fixed in version 0.15.3