Skip to content

Commit a13e1c4

Browse files
bestanderFacebook Github Bot 3
authored andcommitted
Reverted commit D3811226
Reviewed By: astreet Differential Revision: D3811226 fbshipit-source-id: 8ade5ef6c34e117fb10a000034b9900f8a56087d
1 parent 6fb1495 commit a13e1c4

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,19 @@ public ReactRootView(Context context, AttributeSet attrs, int defStyle) {
8080

8181
@Override
8282
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
83-
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
83+
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
84+
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
85+
86+
if (widthMode == MeasureSpec.UNSPECIFIED || heightMode == MeasureSpec.UNSPECIFIED) {
87+
throw new IllegalStateException(
88+
"The root catalyst view must have a width and height given to it by it's parent view. " +
89+
"You can do this by specifying MATCH_PARENT or explicit width and height in the " +
90+
"layout. widthMode=" + widthMode + ", heightMode=" + heightMode);
91+
}
92+
93+
setMeasuredDimension(
94+
MeasureSpec.getSize(widthMeasureSpec),
95+
MeasureSpec.getSize(heightMeasureSpec));
8496

8597
mWasMeasured = true;
8698
// Check if we were waiting for onMeasure to attach the root view

0 commit comments

Comments
 (0)