Browse Source

Fix rn 0.50 repeated calls to onMeasure. (#2261)

Chaitanya Bhagvan 7 years ago
parent
commit
0ea0a7f5f6

+ 7
- 3
android/app/src/main/java/com/reactnativenavigation/views/ContentView.java View File

@@ -66,9 +66,13 @@ public class ContentView extends ReactRootView {
66 66
 
67 67
     @Override
68 68
     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
69
-        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
70
-        int measuredHeight = viewMeasurer.getMeasuredHeight(heightMeasureSpec);
71
-        setMeasuredDimension(viewMeasurer.getMeasuredWidth(widthMeasureSpec), measuredHeight);
69
+        int widthSpec = MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.AT_MOST);
70
+        int heightSpec = MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.AT_MOST);
71
+
72
+        super.onMeasure(widthSpec, heightSpec);
73
+
74
+        int measuredHeight = viewMeasurer.getMeasuredHeight(heightSpec);
75
+        setMeasuredDimension(viewMeasurer.getMeasuredWidth(widthSpec), measuredHeight);
72 76
     }
73 77
 
74 78
     @Override