Skip to content

Commit 4165c02

Browse files
authored
Update README.md
1 parent a5d53b5 commit 4165c02

1 file changed

Lines changed: 27 additions & 10 deletions

File tree

README.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,30 @@
33
A simple module to gracefully finish the React Native android app programatically.
44
It is better to finish the app with its transition/animation rather than force kill the app process.
55

6+
[Check out the Example app](https://github.com/RakaDoank/react-native-android-finish/tree/main/example) with the [double back pressed to exit](https://github.com/RakaDoank/react-native-android-finish/blob/main/example/App.tsx#L67)
7+
8+
- [Installation](#installation)
9+
- [APIs](#apis)
10+
- [finish()](#--finish)
11+
- [finishAffinity()](#--finishAffinity)
12+
- [finishAfterTransition()](#--finishAfterTransition)
13+
- [finishAndRemoveTask()](#--finishAndRemoveTask)
14+
- [unstable_restart()](#--unstable_restart)
15+
- [About BackHandler API](#about-backhandler-api)
16+
617
## Installation
7-
npm install react-native-android-finish
8-
🚀 This library is supported in New Architecture (Turbo Module)
18+
npm
19+
```
20+
npm install react-native-ping-android
21+
```
22+
23+
or with yarn
24+
```
25+
yarn add react-native-ping-android
26+
```
27+
🚀 This library is supported in New Architecture (Turbo Modules)
928

10-
## Usage
29+
## APIs
1130
### - finish()
1231
Close current RN activity
1332
```ts
@@ -27,8 +46,7 @@ export default function App(): React.JSX.Element {
2746
Reference: https://developer.android.com/reference/android/app/Activity#finish()
2847

2948
### - finishAffinity()
30-
Similar to the `finish()`, but it closes all the activities present.
31-
Mostly, RN apps only need the `finish()`
49+
Similar to the `finish()`, but it closes all the activities present
3250
```ts
3351
import {
3452
Button,
@@ -45,9 +63,8 @@ export default function App(): React.JSX.Element {
4563
```
4664
Reference: https://developer.android.com/reference/android/app/Activity#finishAffinity()
4765

48-
### - finishAfterTransition()
49-
Reverses the Activity Scene entry Transition, triggers the calling Activity to reverse its exit Transition, and calls the `finish()` when the exit Transition completes
50-
Mostly, RN apps only need the `finish()`
66+
### - finishAfterTransition()
67+
Reverses the Activity Scene entry Transition, triggers the calling Activity to reverse its exit Transition, and calls the `finish()` when the exit Transition completes
5168
```ts
5269
import {
5370
Button,
@@ -104,8 +121,8 @@ export default function App(): React.JSX.Element {
104121
You can see the [AndroidFinish.kt](https://github.com/RakaDoank/react-native-android-finish/blob/main/android/src/main/java/com/audira/lib/reactnative/androidfinish/AndroidFinish.kt)
105122

106123
### About BackHandler API
107-
This is not the same as [BackHandler.exitApp()](https://reactnative.dev/docs/backhandler) which simply minimizes the application.
124+
This library is not the same as [BackHandler.exitApp()](https://reactnative.dev/docs/backhandler) which simply minimizes the application.
108125

109126
## For iOS
110127
There is no behaviour on iOS to finish the app like this module in Android. It's their own guideline and should've be done by the user manually by remove the app in their recent apps.
111-
Probably, you can use this alternative https://www.npmjs.com/package/react-native-exit-app.
128+
Probably, you can use this alternative https://www.npmjs.com/package/react-native-exit-app.

0 commit comments

Comments
 (0)