Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: clarify installation instructions for Android #1633

Merged
merged 2 commits into from
Nov 11, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,24 @@ On Android the View state is not persisted consistently across Activity restarts

For most people using an app built from the react-native template, that means editing `MainActivity.java`, likely located in `android/app/src/main/java/<your package name>/MainActivity.java`

You should add this code, which specifically discards any Activity state persisted during the Activity restart process, to avoid inconsistencies that lead to crashes.
You should add this code, which specifically discards any Activity state persisted during the Activity restart process, to avoid inconsistencies that lead to crashes. You should place this in the parent MainActivity and not inside the MainActivityDelegate.
evan1715 marked this conversation as resolved.
Show resolved Hide resolved

```java
import android.os.Bundle;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(null);
public class MainActivity extends ReactActivity {

//...code

//react-native-screens override
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(null);
}

public static class MainActivityDelegate extends ReactActivityDelegate {
//...code
}
}
```

Expand Down