Skip to content

Commit

Permalink
Destroy navigation activity layouts on catalyst instance destroy (#3318)
Browse files Browse the repository at this point in the history
Destroy navigation activity layouts on catalyst instance destroy

addresses #2331 & microsoft/react-native-code-push#1144
  • Loading branch information
ericketts authored and guyca committed Oct 14, 2018
1 parent e61b3cb commit 5e2b02c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.reactnativenavigation.controllers.NavigationActivity;
import com.reactnativenavigation.controllers.NavigationCommandsHandler;
import com.reactnativenavigation.params.ContextualMenuParams;
import com.reactnativenavigation.params.FabParams;
Expand Down Expand Up @@ -53,6 +54,12 @@ public String getName() {
return NAME;
}

@Override
public void onCatalystInstanceDestroy() {
super.onCatalystInstanceDestroy();
NavigationActivity.onCatalystInstanceDestroy();
}

@ReactMethod
public void startApp(final ReadableMap params, final @Nullable Promise promise) {
NavigationCommandsHandler.startApp(BundleConverter.toBundle(params), promise);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,20 @@ public static void setStartAppPromise(Promise promise) {
NavigationActivity.startAppPromise = promise;
}

public static void onCatalystInstanceDestroy() {
if (currentActivity == null) {
return;
}
currentActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (currentActivity != null) {
currentActivity.destroyLayouts();
}
}
});
}

public Layout getLayout() {
return layout;
}
Expand Down

0 comments on commit 5e2b02c

Please sign in to comment.