Example usage for com.facebook.react.bridge JavaOnlyArray pushInt

List of usage examples for com.facebook.react.bridge JavaOnlyArray pushInt

Introduction

In this page you can find the example usage for com.facebook.react.bridge JavaOnlyArray pushInt.

Prototype

@Override
    public void pushInt(int value) 

Source Link

Usage

From source file:com.horcrux.svg.RenderableView.java

License:Open Source License

@ReactProp(name = "fill")
public void setFill(@Nullable Dynamic fill) {
    if (fill == null || fill.isNull()) {
        this.fill = null;
        invalidate();//  w  ww  .j  av  a2s  . c om
        return;
    }
    ReadableType type = fill.getType();
    if (type.equals(ReadableType.Array)) {
        this.fill = fill.asArray();
    } else {
        JavaOnlyArray arr = new JavaOnlyArray();
        arr.pushInt(0);
        Matcher m = regex.matcher(fill.asString());
        int i = 0;
        while (m.find()) {
            Double parsed = Double.parseDouble(m.group());
            arr.pushDouble(i++ < 3 ? parsed / 255 : parsed);
        }
        this.fill = arr;
    }
    invalidate();
}

From source file:com.horcrux.svg.RenderableView.java

License:Open Source License

@ReactProp(name = "stroke")
public void setStroke(@Nullable Dynamic strokeColors) {
    if (strokeColors == null || strokeColors.isNull()) {
        stroke = null;// www. j a v  a  2s  . com
        invalidate();
        return;
    }
    ReadableType type = strokeColors.getType();
    if (type.equals(ReadableType.Array)) {
        stroke = strokeColors.asArray();
    } else {
        JavaOnlyArray arr = new JavaOnlyArray();
        arr.pushInt(0);
        Matcher m = regex.matcher(strokeColors.asString());
        while (m.find()) {
            Double parsed = Double.parseDouble(m.group());
            arr.pushDouble(parsed);
        }
        stroke = arr;
    }
    invalidate();
}