Skip to content

Commit

Permalink
fix: restart activity to avoid crashes (#116)
Browse files Browse the repository at this point in the history
## 馃摐 Description

Don't persist activity state and always restart it.

## 馃挕 Motivation and Context

I don't know why I didn't make it before, but it needs to be added in
order to reduce amount of occasional crashes. You can read a great
explanation
[here](https://github.com/software-mansion/react-native-screens#android)
on why it's needed.

## 馃摙 Changelog

### Android
- added `super.onCreate(null)` in `MainActivity` for example apps;

## 馃 How Has This Been Tested?

Tested manually on emulators.

## 馃摑 Checklist

- [x] CI successfully passed
  • Loading branch information
kirillzyusko committed Feb 11, 2023
1 parent 0cbada6 commit 2c480bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.keyboardcontrollerfabricexample;

import android.os.Bundle;

import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;
Expand Down Expand Up @@ -45,4 +47,9 @@ protected boolean isConcurrentRootEnabled() {
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
}
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ protected boolean isConcurrentRootEnabled() {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.onCreate(null);
}
}

0 comments on commit 2c480bc

Please sign in to comment.