Skip to content

Commit 0585050

Browse files
committed
fix Style.Deg(float) instead of Style.Deg(string)
1 parent 9a8048e commit 0585050

5 files changed

Lines changed: 47 additions & 23 deletions

File tree

‎lib/js/src/Internals.js‎

Lines changed: 21 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lib/js/src/style.js‎

Lines changed: 14 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/Internals.re‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1+
/* encoders to json for react-native */
12
module Encoder = {
2-
/** [string s] makes a JSON string of the [string] [s] */
3-
external string: string => Js.Json.t = "%identity"; /* [string s] makes a JSON string of the [string] [s] */
3+
external string: string => Js.Json.t = "%identity";
44

5-
/** [float n] makes a JSON number of the [float] [n] */
6-
external float: float => Js.Json.t = "%identity"; /* [float n] makes a JSON number of the [float] [n] */
5+
external float: float => Js.Json.t = "%identity";
76

8-
/** [int n] makes a JSON number of the [int] [n] */
9-
external int: int => Js.Json.t = "%identity"; /* [int n] makes a JSON number of the [int] [n] */
7+
external int: int => Js.Json.t = "%identity";
108

11-
/** [boolean b] makes a JSON boolean of the [bool] [b] */
12-
external boolean: bool => Js.Json.t = "%identity"; /* [boolean b] makes a JSON boolean of the [bool] [b] */
9+
external boolean: bool => Js.Json.t = "%identity";
1310

14-
/** [object_ dict] makes a JSON objet of the [Js.Dict.t] [dict] */
15-
external object_: Js_dict.t(Js.Json.t) => Js.Json.t = "%identity"; /* [object_ dict] makes a JSON objet of the [Js.Dict.t] [dict] */
11+
external object_: Js_dict.t(Js.Json.t) => Js.Json.t = "%identity";
1612

1713
external array: array(Js.Json.t) => Js.Json.t = "%identity";
1814

1915
external animatedValue: AnimatedRe.value('a) => Js.Json.t = "%identity";
2016

21-
let pct = pct => string(Printf.sprintf("%.2f%%", pct));
17+
let pct = f => string(Printf.sprintf("%.2f%%", f));
18+
19+
let deg = f => string(Printf.sprintf("%.2f%%", f) ++ "deg");
2220
};

‎src/style.re‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ let encode_string_interpolated =
5858
| Animated(value) => Internals.Encoder.animatedValue(value);
5959

6060
type deg_animated('a) =
61-
| Deg(string)
61+
| Deg(float)
6262
| Animated(AnimatedRe.value('a));
6363

6464
let encode_deg_animated =
6565
fun
66-
| Deg(value) => Internals.Encoder.string(value)
66+
| Deg(value) => Internals.Encoder.deg(value)
6767
| Animated(value) => Internals.Encoder.animatedValue(value);
6868

6969
external to_style: Js.Dict.t(Js.Json.t) => t = "%identity";

‎src/style.rei‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type string_interpolated =
2121
| String(string)
2222
| Animated(AnimatedRe.Interpolation.t);
2323
type deg_animated('a) =
24-
| Deg(string)
24+
| Deg(float)
2525
| Animated(AnimatedRe.value('a));
2626

2727
let style: list(styleElement) => t;

0 commit comments

Comments
 (0)