Fix android modal not disappear when reload (#27542)

Summary:
Fixes https://github.com/facebook/react-native/issues/17986

See above issue

After apply this change:
![ezgif-4-45d9add85b74](https://user-images.githubusercontent.com/615282/70987576-2520ad00-20fb-11ea-9b90-c9a7839824a5.gif)

## Changelog

[Android] [Fixed] - Fix android modal not disappear when reload
Pull Request resolved: https://github.com/facebook/react-native/pull/27542

Test Plan: Open a modal and do a refresh to see whether it disappears

Differential Revision: D19178803

Pulled By: mdvacca

fbshipit-source-id: 61894927fc481650804b2196df06a80c16b64e6c
This commit is contained in:
sunnylqm
2019-12-19 10:04:36 -08:00
committed by Facebook Github Bot
parent 5fc3b442ec
commit 5ddf00ee1a
@@ -96,6 +96,12 @@ public class ReactModalHostView extends ViewGroup implements LifecycleEventListe
// Do nothing as we are laid out by UIManager
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
dismiss();
}
@Override
public void addView(View child, int index) {
UiThreadUtil.assertOnUiThread();