Improve numberProp and numberArrayProp PropTypes usage.

Implement "normal" relative unit in java.
This commit is contained in:
Mikael Sand
2017-08-15 13:31:42 +03:00
parent f3cd34f2e1
commit 68eeb5e6da
2 changed files with 13 additions and 12 deletions
@@ -95,7 +95,7 @@ class PropHelper {
length = length.trim();
int stringLength = length.length();
int percentIndex = stringLength - 1;
if (stringLength == 0) {
if (stringLength == 0 || length.equals("normal")) {
return offset;
} else if (length.codePointAt(percentIndex) == '%') {
return Double.valueOf(length.substring(0, percentIndex)) / 100 * relative + offset;