How to emulate a back key or swipe gesture

My client insists on having an “Exit” button for the App. I thought if I can cause the a back key pressed or a swipe gesture when the button is pressed it should do the job but how to emulate it.

Please advise.

Unfortunately, this is not yet possible.

I only know one way to exit the app when you click the Back button or any other button, but I’m afraid that your client won’t like it - in the event handler, cause the app to crash. But, unfortunately, this leads to the display of a dialog about crash occurrence.

1 Like

Many thanks for your reply.

Although the idea of providing a button to crash the system is “counter intuitive”, I am curious to know it.

OK, here’s a simple example for creating a crash on Android. I was not able to crash on iOS, because the crash just shows a white screen.

изображение

2 Likes

Just to add to this, Apple has stated before that apps should not close themselves. This may be a red flag when submitting your app for the App Store.

As far as React goes, there is no current built in function to close the app, so this would be a platform limitation and you will probably never see this feature.

However, the open link block allows for deep-linking, for example, open the app settings in the OS Setting’s app using app-settings: . I haven’t looked into this much, but this may have the option to go to the home screen?

1 Like

Thank you. I will look into deep linking and see if there is a way or simply say to my client, based on your explanation, such function cannot be implemented.

1 Like