Skip to content

Commit 9eb91c3

Browse files
committed
Dumber Style.merge
Currently merge was a real "object merge". This means you cannot pipe merge with style from a StyleSheet item (int) since merging {} with an int just doesn't work. merge is now dumber and just make an array, rnw will handle the resolution on it's side. Don't abuse about this merge anyway :)
1 parent 2236a0e commit 9eb91c3

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

‎bs-react-native/src/style.bs.js‎

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

‎bs-react-native/src/style.re‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ let encode_deg_animated =
6868

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

71-
external style_to_dict: t => Js.Dict.t(Js.Json.t) = "%identity";
72-
7371
external arrayOfStyle: array(t) => t = "%identity";
7472

7573
let floatStyle = (key, value) => (key, Internals.Encoder.float(value));
@@ -85,14 +83,7 @@ let emptyStyle = Js.Dict.empty()->to_style;
8583

8684
external fromArray: array(t) => t = "%identity";
8785
let fromList = styles => styles->Belt.List.toArray->arrayOfStyle;
88-
let merge = (a, b) => {
89-
let entries =
90-
Array.append(
91-
Js.Dict.entries(style_to_dict(a)),
92-
Js.Dict.entries(style_to_dict(b)),
93-
);
94-
Js.Dict.fromArray(entries) |> to_style;
95-
};
86+
let merge = (a, b) => [|a, b|]->arrayOfStyle;
9687
let mergeOptional = (s, so) =>
9788
so->Belt.Option.map(so => s->merge(so))->Belt.Option.getWithDefault(s);
9889
let optional = s => s->Belt.Option.getWithDefault(emptyStyle);

0 commit comments

Comments
 (0)