Skip to content

Commit 703a98b

Browse files
authored
Update README.md
1 parent 750b8eb commit 703a98b

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,34 @@ public class MainApplication extends Application implements ReactApplication {
205205

206206
```
207207

208+
**Modifying Android Native Exception handler** (NATIVE CODE HAS TO BE WRITTEN) *recommended that you do this in android studio*
209+
210+
- In the `android/app/src/main/java/[...]/MainActivity.java`
211+
212+
```java
213+
import com.masteratul.exceptionhandler.ReactNativeExceptionHandlerModule;
214+
import com.masteratul.exceptionhandler.NativeExceptionHandlerIfc
215+
...
216+
...
217+
...
218+
public class MainApplication extends Application implements ReactApplication {
219+
...
220+
...
221+
@Override
222+
public void onCreate() {
223+
....
224+
....
225+
....
226+
ReactNativeExceptionHandlerModule.setNativeExceptionHandler(new NativeExceptionHandlerIfc() {
227+
@Override
228+
public void handleNativeException(Thread thread, Throwable throwable, Thread.UncaughtExceptionHandler originalHandler) {
229+
// Put your error handling code here
230+
}
231+
}//This will override the default behaviour of displaying the recover activity.
232+
}
233+
234+
```
235+
208236
**Modifying iOS Native Exception handler UI** (NATIVE CODE HAS TO BE WRITTEN) *recommended that you do this in XCode*
209237

210238
Unlike Android, in the case of iOS, there is no way to restart the app if it has crashed. Also, during a **Native_Exceptions** the UI becomes quite unstable since the exception occured on the main UI thread. Hence, none of the click or press handlers would work either.
@@ -410,6 +438,10 @@ This is specifically occuring when you use [wix library](http://wix.github.io/re
410438
setNativeExceptionHandler(nativeErrorCallback, false);
411439
```
412440

441+
### Previously defined exception handlers are not executed anymore
442+
443+
A lot of frameworks (especially analytics sdk's) implement global exception handlers. In order to keep these frameworks working while using react-native-exception-hanlder, you can pass a boolean value as third argument to `setNativeExceptionHandler(..., ..., true`) what will trigger the execution of the last global handler registered.
444+
413445
414446
## CONTRIBUTORS
415447
- [Atul R](https://github.com/master-atul)
@@ -426,6 +458,7 @@ setNativeExceptionHandler(nativeErrorCallback, false);
426458
- [TomMahle](https://github.com/TomMahle)
427459
- [Sébastien Krafft](https://github.com/skrafft)
428460
- [Mark Friedman](https://github.com/mark-friedman)
461+
- [Damien Solimando](https://github.com/dsolimando)
429462
430463
## TESTING NATIVE EXCEPTIONS/ERRORS
431464

0 commit comments

Comments
 (0)