diff --git a/NavigationReactNative/src/android/src/main/java/com/navigation/reactnative/SceneView.java b/NavigationReactNative/src/android/src/main/java/com/navigation/reactnative/SceneView.java index 87d3c1969..5a59dfe66 100644 --- a/NavigationReactNative/src/android/src/main/java/com/navigation/reactnative/SceneView.java +++ b/NavigationReactNative/src/android/src/main/java/com/navigation/reactnative/SceneView.java @@ -1,6 +1,7 @@ package com.navigation.reactnative; import android.content.Context; +import android.view.View; import android.view.ViewGroup; import com.facebook.react.bridge.ReactContext; @@ -19,6 +20,28 @@ public SceneView(Context context) { super(context); } + @Override + protected void onAttachedToWindow() { + super.onAttachedToWindow(); + View child = getChildAt(0); + if (child != null && child.getClass().getSimpleName().contains("DrawerLayout")) { + child.requestLayout(); + post(measureAndLayoutDrawer); + } + } + + private final Runnable measureAndLayoutDrawer = new Runnable() { + @Override + public void run() { + View drawer = getChildAt(0); + if (drawer == null) return; + drawer.measure( + MeasureSpec.makeMeasureSpec(drawer.getWidth(), MeasureSpec.EXACTLY), + MeasureSpec.makeMeasureSpec(drawer.getHeight(), MeasureSpec.EXACTLY)); + drawer.layout(drawer.getLeft(), drawer.getTop(), drawer.getRight(), drawer.getBottom()); + } + }; + protected void popped() { ReactContext reactContext = (ReactContext) getContext(); reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(getId(),"onPopped", null);