mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 09:45:04 +00:00
Mark SupportAlertFragment and AlertFragment as Public to fix crash is…
Summary: Hi, This changelist is for fixing a crash issue on Android devices. For detail please see, https://github.com/facebook/react-native/issues/7080 In short, the crash occurred when a RN app with a Alert dialog shown at front switches back after it is destroyed at background due to lack of phone memory. My fix is to let those Alert fragment classes accessible from android.support.v4.app.Fragment instantiate() function, so that it won't crash. And since other UI will be reloaded whatever, mListener is set to null to avoid any callback happen. Closes https://github.com/facebook/react-native/pull/7105 Differential Revision: D3212435 Pulled By: mkonicek fbshipit-source-id: d900a33a4f0fd49258be94c277def55555ec8d73
This commit is contained in:
parent
aac7f5b362
commit
67d9a7bae9
@ -21,7 +21,7 @@ import android.os.Bundle;
|
||||
/**
|
||||
* A fragment used to display the dialog.
|
||||
*/
|
||||
/* package */ class AlertFragment extends DialogFragment implements DialogInterface.OnClickListener {
|
||||
public class AlertFragment extends DialogFragment implements DialogInterface.OnClickListener {
|
||||
|
||||
/* package */ static final String ARG_TITLE = "title";
|
||||
/* package */ static final String ARG_MESSAGE = "message";
|
||||
@ -32,6 +32,10 @@ import android.os.Bundle;
|
||||
|
||||
private final @Nullable DialogModule.AlertFragmentListener mListener;
|
||||
|
||||
public AlertFragment() {
|
||||
mListener = null;
|
||||
}
|
||||
|
||||
public AlertFragment(@Nullable DialogModule.AlertFragmentListener listener, Bundle arguments) {
|
||||
mListener = listener;
|
||||
setArguments(arguments);
|
||||
|
@ -21,10 +21,14 @@ import android.support.v4.app.DialogFragment;
|
||||
* {@link AlertFragment} for apps that use the Support FragmentActivity and FragmentManager
|
||||
* for legacy reasons.
|
||||
*/
|
||||
/* package */ class SupportAlertFragment extends DialogFragment implements DialogInterface.OnClickListener {
|
||||
public class SupportAlertFragment extends DialogFragment implements DialogInterface.OnClickListener {
|
||||
|
||||
private final @Nullable DialogModule.AlertFragmentListener mListener;
|
||||
|
||||
public SupportAlertFragment() {
|
||||
mListener = null;
|
||||
}
|
||||
|
||||
public SupportAlertFragment(@Nullable DialogModule.AlertFragmentListener listener, Bundle arguments) {
|
||||
mListener = listener;
|
||||
setArguments(arguments);
|
||||
|
Loading…
x
Reference in New Issue
Block a user