Skip to content

Commit f3ee16f

Browse files
committed
Fixes to get namespaces working internally at @viskahq
1 parent 0f5019e commit f3ee16f

File tree

9 files changed

+56
-45
lines changed

9 files changed

+56
-45
lines changed

bsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "react-native",
2+
"name": "bs-react-native",
33
"bsc-flags": ["-bs-super-errors"],
44
"reason": {"react-jsx": 2},
55
"refmt": 3,
@@ -11,7 +11,6 @@
1111
"subdirs": [
1212
{
1313
"dir": "components",
14-
"subdirs": [{"dir": "private", "public": []}],
1514
},
1615
{
1716
"dir": "private",

src/private/animatedRe.re renamed to src/animatedRe.re

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module Animations = {
2929
) =>
3030
config =
3131
"";
32-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"]
32+
[@bs.module "react-native"] [@bs.scope "Animated"]
3333
external _decay : (Val.t, config) => CompositeAnimation.t =
3434
"decay";
3535
let animate =
@@ -75,7 +75,7 @@ module Animations = {
7575
};
7676
external toValueRaw : Val.rawJsType => toValue = "%identity";
7777
external toValueAnimatedRe : Val.t => toValue = "%identity";
78-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"]
78+
[@bs.module "react-native"] [@bs.scope "Animated"]
7979
external _spring : (Val.t, config) => CompositeAnimation.t =
8080
"spring";
8181
let animate =
@@ -140,7 +140,7 @@ module Animations = {
140140
"";
141141
external toValueRaw : Val.rawJsType => toValue = "%identity";
142142
external toValueAnimatedRe : Val.t => toValue = "%identity";
143-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"]
143+
[@bs.module "react-native"] [@bs.scope "Animated"]
144144
external _timing : (Val.t, config) => CompositeAnimation.t =
145145
"timing";
146146
let animate =
@@ -177,10 +177,10 @@ module Animations = {
177177
};
178178

179179
module ValueOperations = (Val: Value) => {
180-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"] external add : (Val.t, Val.t) => Val.t = "";
181-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"] external divide : (Val.t, Val.t) => Val.t =
180+
[@bs.module "react-native"] [@bs.scope "Animated"] external add : (Val.t, Val.t) => Val.t = "";
181+
[@bs.module "react-native"] [@bs.scope "Animated"] external divide : (Val.t, Val.t) => Val.t =
182182
"";
183-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"] external multiply : (Val.t, Val.t) => Val.t =
183+
[@bs.module "react-native"] [@bs.scope "Animated"] external multiply : (Val.t, Val.t) => Val.t =
184184
"";
185185
module Timing = Animations.Timing(Val);
186186
module Spring = Animations.Spring(Val);
@@ -246,7 +246,7 @@ module Interpolation = {
246246
module Value = {
247247
type t;
248248
type callback = float => unit;
249-
[@bs.new] [@bs.scope "AnimatedRe"] [@bs.module "react-native"] external create : float => t =
249+
[@bs.new] [@bs.scope "Animated"] [@bs.module "react-native"] external create : float => t =
250250
"Value";
251251
[@bs.send] external setValue : (t, float) => unit = "setValue";
252252
[@bs.send] external setOffset : (t, float) => unit = "setOffset";
@@ -291,8 +291,8 @@ module Value = {
291291
[@bs.send] external animate : (t, Animation.t, Animation.endCallback) => unit = "animate";
292292
[@bs.send] external stopTracking : t => unit = "stopTracking";
293293
[@bs.send] external track : t => unit = "track";
294-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"] external modulo : (t, float) => t = "";
295-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"] external diffClamp : (t, float, float) => t =
294+
[@bs.module "react-native"] [@bs.scope "Animated"] external modulo : (t, float) => t = "";
295+
[@bs.module "react-native"] [@bs.scope "Animated"] external diffClamp : (t, float, float) => t =
296296
"";
297297
type value = t;
298298
include
@@ -310,7 +310,7 @@ module ValueXY = {
310310
type callback = jsValue => unit;
311311
type translateTransform = {. "translateX": Value.t, "translateY": Value.t};
312312
type layout = {. "left": Value.t, "top": Value.t};
313-
[@bs.new] [@bs.scope "AnimatedRe"] [@bs.module "react-native"] external _create : jsValue => t =
313+
[@bs.new] [@bs.scope "Animated"] [@bs.module "react-native"] external _create : jsValue => t =
314314
"ValueXY";
315315
let create = (~x, ~y) => _create({"x": x, "y": y});
316316
[@bs.send] external _setValue : (t, jsValue) => unit = "setValue";
@@ -338,34 +338,38 @@ module ValueXY = {
338338
);
339339
};
340340

341-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"] external delay : float => CompositeAnimation.t =
341+
[@bs.module "react-native"] [@bs.scope "Animated"] external delay : float => CompositeAnimation.t =
342342
"";
343343

344-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"]
344+
[@bs.module "react-native"] [@bs.scope "Animated"]
345345
external sequence : array(CompositeAnimation.t) => CompositeAnimation.t =
346346
"";
347347

348-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"]
348+
[@bs.module "react-native"] [@bs.scope "Animated"]
349349
external parallel :
350350
(array(CompositeAnimation.t), {. "stopTogether": Js.boolean}) => CompositeAnimation.t =
351351
"";
352352

353-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"]
353+
[@bs.module "react-native"] [@bs.scope "Animated"]
354354
external stagger : (float, array(CompositeAnimation.t)) => CompositeAnimation.t =
355355
"";
356356

357-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"]
357+
[@bs.module "react-native"] [@bs.scope "Animated"]
358358
external _loop : (CompositeAnimation.t, {. "iterations": int}) => CompositeAnimation.t =
359359
"loop";
360360

361361
type animatedEvent;
362362

363-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"]
363+
[@bs.module "react-native"] [@bs.scope "Animated"]
364364
external event : (array('a), 'b) => animatedEvent =
365365
"";
366366

367367
let loop = (~iterations=(-1), ~animation, ()) => _loop(animation, {"iterations": iterations});
368368

369+
[@bs.module "react-native"] [@bs.scope "Animated"]
370+
external createAnimatedComponent : ReasonReact.reactClass => ReasonReact.reactClass =
371+
"";
372+
369373
module Timing = Value.Timing;
370374

371375
module TimingXY = ValueXY.Timing;

src/private/animatedRe.rei renamed to src/animatedRe.rei

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ let stagger: (float, array(CompositeAnimation.t)) => CompositeAnimation.t;
216216

217217
let loop: (~iterations: int=?, ~animation: CompositeAnimation.t, unit) => CompositeAnimation.t;
218218

219+
let createAnimatedComponent : ReasonReact.reactClass => ReasonReact.reactClass;
220+
219221
module Timing = Value.Timing;
220222

221223
module TimingXY = ValueXY.Timing;

src/components/private/animatedComponents.re renamed to src/components/animatedComponents.re

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
module View =
22
View.CreateComponent(
33
{
4-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"] external view : ReasonReact.reactClass =
5-
"ViewRe";
4+
[@bs.module "react-native"] [@bs.scope "Animated"] external view : ReasonReact.reactClass =
5+
"View";
66
let view = view;
77
}
88
);
99

1010
module Image =
1111
Image.CreateComponent(
1212
{
13-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"] external view : ReasonReact.reactClass =
13+
[@bs.module "react-native"] [@bs.scope "Animated"] external view : ReasonReact.reactClass =
1414
"Image";
1515
let view = view;
1616
}
@@ -19,7 +19,7 @@ module Image =
1919
module Text =
2020
Text.CreateComponent(
2121
{
22-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"] external view : ReasonReact.reactClass =
22+
[@bs.module "react-native"] [@bs.scope "Animated"] external view : ReasonReact.reactClass =
2323
"Text";
2424
let view = view;
2525
}
@@ -44,7 +44,7 @@ module ScrollView = {
4444
include
4545
ScrollView.CreateComponent(
4646
{
47-
[@bs.module "react-native"] [@bs.scope "AnimatedRe"] external view : ReasonReact.reactClass =
47+
[@bs.module "react-native"] [@bs.scope "Animated"] external view : ReasonReact.reactClass =
4848
"ScrollView";
4949
let view = view;
5050
}

src/components/flatList.re

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ let make =
125125
~showsVerticalScrollIndicator=?,
126126
~windowSize=?,
127127
~maxToRenderPerBatch=?,
128-
~viewabilityConfig=?
128+
~viewabilityConfig=?,
129+
~onScroll=?,
130+
~style=?
129131
) =>
130132
ReasonReact.wrapJsForReason(
131133
~reactClass=view,
@@ -178,7 +180,9 @@ let make =
178180
from_opt(UtilsRN.optBoolToOptJsBoolean(showsVerticalScrollIndicator)),
179181
"windowSize": from_opt(windowSize),
180182
"maxToRenderPerBatch": from_opt(maxToRenderPerBatch),
181-
"viewabilityConfig": from_opt(viewabilityConfig)
183+
"viewabilityConfig": from_opt(viewabilityConfig),
184+
"onScroll": from_opt(onScroll),
185+
"style": from_opt(style)
182186
}
183187
)
184188
);

src/components/flatList.rei

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ let make:
9292
~windowSize: int=?,
9393
~maxToRenderPerBatch: int=?,
9494
~viewabilityConfig: Js.t({.})=?,
95+
~onScroll: RNEvent.NativeScrollEvent.t => unit=?,
96+
~style: Style.t=?,
9597
array(ReasonReact.reactElement)
9698
) =>
9799
ReasonReact.component(ReasonReact.stateless, ReasonReact.noRetainedProps, unit);

src/style.re

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type style =
1515
| IntStyle(string, int)
1616
| FloatStyle(string, float)
1717
| ObjectStyle(string, Js.Dict.t(Js.Json.t))
18-
| AnimatedReStyle(
18+
| AnimatedStyle(
1919
string,
2020
[ | `value(AnimatedRe.Value.t) | `interpolation(AnimatedRe.Interpolation.t)]
2121
);
@@ -42,9 +42,9 @@ let pctStyle = (key, value) => StringStyle(key, string_of_float(value) ++ "%");
4242

4343
let objectStyle = (key, value) => ObjectStyle(key, value);
4444

45-
let animatedStyle = (key, value) => AnimatedReStyle(key, `value(value));
45+
let animatedStyle = (key, value) => AnimatedStyle(key, `value(value));
4646

47-
let interpolatedStyle = (key, value) => AnimatedReStyle(key, `interpolation(value));
47+
let interpolatedStyle = (key, value) => AnimatedStyle(key, `interpolation(value));
4848

4949
let encodeStyle =
5050
fun
@@ -54,7 +54,7 @@ let encodeStyle =
5454
| FloatStyle(key, value) => (key, Encode.float(value))
5555
| StringStyle(key, value) => (key, Encode.string(value))
5656
| ObjectStyle(key, value) => (key, Encode.object_(value))
57-
| AnimatedReStyle(key, value) => (
57+
| AnimatedStyle(key, value) => (
5858
key,
5959
switch value {
6060
| `value(x) => Encode.animatedValue(x)
@@ -121,7 +121,7 @@ let bottom = floatStyle("bottom");
121121

122122
let bottomPct = pctStyle("bottom");
123123

124-
let bottomAnimatedRe = animatedStyle("bottom");
124+
let bottomAnimated = animatedStyle("bottom");
125125

126126
let bottomInterpolated = interpolatedStyle("bottom");
127127

@@ -168,7 +168,7 @@ let height = floatStyle("height");
168168

169169
let heightPct = pctStyle("height");
170170

171-
let heightAnimatedRe = animatedStyle("height");
171+
let heightAnimated = animatedStyle("height");
172172

173173
let heightInterpolated = interpolatedStyle("height");
174174

@@ -189,7 +189,7 @@ let left = floatStyle("left");
189189

190190
let leftPct = pctStyle("left");
191191

192-
let leftAnimatedRe = animatedStyle("left");
192+
let leftAnimated = animatedStyle("left");
193193

194194
let leftInterpolated = interpolatedStyle("left");
195195

@@ -260,23 +260,23 @@ let right = floatStyle("right");
260260

261261
let rightPct = pctStyle("right");
262262

263-
let rightAnimatedRe = animatedStyle("right");
263+
let rightAnimated = animatedStyle("right");
264264

265265
let rightInterpolated = interpolatedStyle("right");
266266

267267
let top = floatStyle("top");
268268

269269
let topPct = pctStyle("top");
270270

271-
let topAnimatedRe = animatedStyle("top");
271+
let topAnimated = animatedStyle("top");
272272

273273
let topInterpolated = interpolatedStyle("top");
274274

275275
let width = floatStyle("width");
276276

277277
let widthPct = pctStyle("width");
278278

279-
let widthAnimatedRe = animatedStyle("width");
279+
let widthAnimated = animatedStyle("width");
280280

281281
let widthInterpolated = interpolatedStyle("width");
282282

@@ -381,7 +381,7 @@ let transform =
381381
UtilsRN.option_map(Encode.float, skewY)
382382
);
383383

384-
let transformAnimatedRe =
384+
let transformAnimated =
385385
(
386386
~perspective=?,
387387
~rotate=?,
@@ -488,7 +488,7 @@ let opacity = floatStyle("opacity");
488488

489489
let opacityInterpolated = interpolatedStyle("opacity");
490490

491-
let opacityAnimatedRe = animatedStyle("opacity");
491+
let opacityAnimated = animatedStyle("opacity");
492492

493493
let elevation = floatStyle("elevation");
494494

src/style.rei

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ let bottom: float => style;
4545

4646
let bottomPct: float => style;
4747

48-
let bottomAnimatedRe: AnimatedRe.Value.t => style;
48+
let bottomAnimated: AnimatedRe.Value.t => style;
4949

5050
let bottomInterpolated: AnimatedRe.Interpolation.t => style;
5151

@@ -69,7 +69,7 @@ let height: float => style;
6969

7070
let heightPct: float => style;
7171

72-
let heightAnimatedRe: AnimatedRe.Value.t => style;
72+
let heightAnimated: AnimatedRe.Value.t => style;
7373

7474
let heightInterpolated: AnimatedRe.Interpolation.t => style;
7575

@@ -80,7 +80,7 @@ let left: float => style;
8080

8181
let leftPct: float => style;
8282

83-
let leftAnimatedRe: AnimatedRe.Value.t => style;
83+
let leftAnimated: AnimatedRe.Value.t => style;
8484

8585
let leftInterpolated: AnimatedRe.Interpolation.t => style;
8686

@@ -136,23 +136,23 @@ let right: float => style;
136136

137137
let rightPct: float => style;
138138

139-
let rightAnimatedRe: AnimatedRe.Value.t => style;
139+
let rightAnimated: AnimatedRe.Value.t => style;
140140

141141
let rightInterpolated: AnimatedRe.Interpolation.t => style;
142142

143143
let top: float => style;
144144

145145
let topPct: float => style;
146146

147-
let topAnimatedRe: AnimatedRe.Value.t => style;
147+
let topAnimated: AnimatedRe.Value.t => style;
148148

149149
let topInterpolated: AnimatedRe.Interpolation.t => style;
150150

151151
let width: float => style;
152152

153153
let widthPct: float => style;
154154

155-
let widthAnimatedRe: AnimatedRe.Value.t => style;
155+
let widthAnimated: AnimatedRe.Value.t => style;
156156

157157
let widthInterpolated: AnimatedRe.Interpolation.t => style;
158158

@@ -193,7 +193,7 @@ let transform:
193193
) =>
194194
style;
195195

196-
let transformAnimatedRe:
196+
let transformAnimated:
197197
(
198198
~perspective: AnimatedRe.Value.t=?,
199199
~rotate: AnimatedRe.Value.t=?,
@@ -259,7 +259,7 @@ let borderStyle: [ | `solid | `dotted | `dashed] => style;
259259

260260
let opacity: float => style;
261261

262-
let opacityAnimatedRe: AnimatedRe.Value.t => style;
262+
let opacityAnimated: AnimatedRe.Value.t => style;
263263

264264
let opacityInterpolated: AnimatedRe.Interpolation.t => style;
265265

0 commit comments

Comments
 (0)