Add percentage support to react native

Summary:
@public

Adds support for percentage value in react native.

syntax: property: 100 | property | '100%'

supported properties:
padding
margin
width
height
minWidth
minHeight
maxWidth
maxHeight
flexBasis

```
class Playground extends React.Component {
  render() {
    return (
      <View style={{backgroundColor: 'white', padding: 10, paddingTop: 30, height: '100%'}}>
        <Text>
          If you want to quickly test out something,
          open the Playground.js file and start coding.
        </Text>
        <View style={{backgroundColor: 'red', height: 50, width: 50}}/>
        <View style={{backgroundColor: 'blue', height: '50%', width: '50%'}}/>
      </View>
    );
  }
}
```

Reviewed By: astreet

Differential Revision: D4376549

fbshipit-source-id: c41d68a7555396f95d063a7527ee081773ac56dc
This commit is contained in:
Emil Sjolander
2017-01-11 03:58:03 -08:00
committed by Facebook Github Bot
parent e39f13a8ea
commit 47266b9ae8
3 changed files with 3 additions and 3 deletions

View File

@@ -19,7 +19,7 @@ public class YogaValue {
public final float value;
public final YogaUnit unit;
YogaValue(float value, YogaUnit unit) {
public YogaValue(float value, YogaUnit unit) {
this.value = value;
this.unit = unit;
}

View File

@@ -181,8 +181,6 @@ YGCalloc gYGCalloc = &calloc;
YGRealloc gYGRealloc = &realloc;
YGFree gYGFree = &free;
static YGValue YGValueUndefined = YG_UNDEFINED_VALUES;
static YGValue YGValueZero = {.value = 0, .unit = YGUnitPixel};
#ifdef ANDROID

View File

@@ -43,6 +43,8 @@ typedef struct YGValue {
YGUnit unit;
} YGValue;
static const YGValue YGValueUndefined = { YGUndefined, YGUnitUndefined };
typedef struct YGNode *YGNodeRef;
typedef YGSize (*YGMeasureFunc)(YGNodeRef node,
float width,