Refactored getting root view in android (#4463)

This commit is contained in:
Panayot Cankov
2017-06-28 15:54:55 +03:00
committed by GitHub
parent 48836cbd4c
commit 655509c64d

View File

@@ -185,7 +185,7 @@ function initLifecycleCallbacks() {
androidApp.notify(<AndroidActivityBundleEventData>{ eventName: ActivityCreated, object: androidApp, activity, bundle: savedInstanceState });
if (hasListeners(displayedEvent)) {
let rootView = activity.findViewById((<any>android).R.id.content);
const rootView = activity.getWindow().getDecorView().getRootView();
let onGlobalLayoutListener = new android.view.ViewTreeObserver.OnGlobalLayoutListener({
onGlobalLayout() {
notify({ eventName: displayedEvent, object: androidApp, activity });