-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix measure callback for TextInput on Nodes
Summary: Add a MeasureUtil class Reviewed By: emilsjolander Differential Revision: D3467598 fbshipit-source-id: 3ef0da1e4ef16c1f9756653d0aa2e8aa5a598eb1
- Loading branch information
Ahmed El-Helw
authored and
Facebook Github Bot 8
committed
Jun 22, 2016
1 parent
072ef0a
commit c95d3ef
Showing
3 changed files
with
30 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
ReactAndroid/src/main/java/com/facebook/react/views/view/MeasureUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2004-present Facebook. All Rights Reserved. | ||
|
||
package com.facebook.react.views.view; | ||
|
||
import android.view.View; | ||
|
||
import com.facebook.csslayout.CSSMeasureMode; | ||
|
||
public class MeasureUtil { | ||
|
||
public static int getMeasureSpec(float size, CSSMeasureMode mode) { | ||
if (mode == CSSMeasureMode.EXACTLY) { | ||
return View.MeasureSpec.makeMeasureSpec((int) size, View.MeasureSpec.EXACTLY); | ||
} else if (mode == CSSMeasureMode.AT_MOST) { | ||
return View.MeasureSpec.makeMeasureSpec((int) size, View.MeasureSpec.AT_MOST); | ||
} else { | ||
return View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); | ||
} | ||
} | ||
} |