Skip to content

Commit ca997bb

Browse files
authored
Fix Animated.Value callback type (#492)
1 parent 52a739f commit ca997bb

2 files changed

Lines changed: 15 additions & 23 deletions

File tree

‎reason-react-native/src/apis/Animated.md‎

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ module Animation = {
1919
module type Value = {
2020
type t;
2121
type jsValue;
22-
type rawJsType;
2322
};
2423
2524
type calculated;
@@ -35,7 +34,7 @@ module ValueAnimations = (Val: Value) => {
3534
[@bs.obj]
3635
external config:
3736
(
38-
~velocity: Val.rawJsType,
37+
~velocity: Val.jsValue,
3938
~deceleration: float=?,
4039
~isInteraction: bool=?,
4140
~useNativeDriver: bool=?,
@@ -52,7 +51,7 @@ module ValueAnimations = (Val: Value) => {
5251
5352
module Spring = {
5453
type toValue;
55-
external fromRawValue: Val.rawJsType => toValue = "%identity";
54+
external fromRawValue: Val.jsValue => toValue = "%identity";
5655
external fromAnimatedValue: Val.t => toValue = "%identity";
5756
5857
type config;
@@ -64,7 +63,7 @@ module ValueAnimations = (Val: Value) => {
6463
~restDisplacementThreshold: float=?,
6564
~overshootClamping: bool=?,
6665
~restSpeedThreshold: float=?,
67-
~velocity: Val.rawJsType=?,
66+
~velocity: Val.jsValue=?,
6867
~bounciness: float=?,
6968
~speed: float=?,
7069
~tension: float=?,
@@ -89,7 +88,7 @@ module ValueAnimations = (Val: Value) => {
8988
module Timing = {
9089
type toValue;
9190
92-
external fromRawValue: Val.rawJsType => toValue = "%identity";
91+
external fromRawValue: Val.jsValue => toValue = "%identity";
9392
external fromAnimatedValue: Val.t => toValue = "%identity";
9493
9594
type config;
@@ -157,12 +156,11 @@ module ValueOperations = {
157156
module ValueMethods = (Val: Value) => {
158157
type t = Val.t;
159158
type jsValue = Val.jsValue;
160-
type rawJsType = Val.rawJsType;
161159
162160
type callback = jsValue => unit;
163161
164-
[@bs.send] external setValue: (t, rawJsType) => unit = "";
165-
[@bs.send] external setOffset: (t, rawJsType) => unit = "";
162+
[@bs.send] external setValue: (t, jsValue) => unit = "";
163+
[@bs.send] external setOffset: (t, jsValue) => unit = "";
166164
[@bs.send] external flattenOffset: t => unit = "";
167165
[@bs.send] external extractOffset: t => unit = "";
168166
[@bs.send] external addListener: (t, callback) => string = "";
@@ -181,8 +179,7 @@ module ValueMethods = (Val: Value) => {
181179
module Value = {
182180
include ValueMethods({
183181
type t = value(regular);
184-
type jsValue = {. "value": float};
185-
type rawJsType = float;
182+
type jsValue = float;
186183
});
187184
188185
[@bs.new] [@bs.scope "Animated"] [@bs.module "react-native"]
@@ -203,7 +200,6 @@ module ValueXY = {
203200
"x": float,
204201
"y": float,
205202
};
206-
type rawJsType = jsValue;
207203
});
208204
209205
type translateTransform = {
@@ -296,4 +292,4 @@ module View = {
296292
let make = createAnimatedComponent(View.make);
297293
};
298294
299-
```
295+
```

‎reason-react-native/src/apis/Animated.re‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ module Animation = {
1212
module type Value = {
1313
type t;
1414
type jsValue;
15-
type rawJsType;
1615
};
1716

1817
type calculated;
@@ -28,7 +27,7 @@ module ValueAnimations = (Val: Value) => {
2827
[@bs.obj]
2928
external config:
3029
(
31-
~velocity: Val.rawJsType,
30+
~velocity: Val.jsValue,
3231
~deceleration: float=?,
3332
~isInteraction: bool=?,
3433
~useNativeDriver: bool=?,
@@ -45,7 +44,7 @@ module ValueAnimations = (Val: Value) => {
4544

4645
module Spring = {
4746
type toValue;
48-
external fromRawValue: Val.rawJsType => toValue = "%identity";
47+
external fromRawValue: Val.jsValue => toValue = "%identity";
4948
external fromAnimatedValue: Val.t => toValue = "%identity";
5049

5150
type config;
@@ -57,7 +56,7 @@ module ValueAnimations = (Val: Value) => {
5756
~restDisplacementThreshold: float=?,
5857
~overshootClamping: bool=?,
5958
~restSpeedThreshold: float=?,
60-
~velocity: Val.rawJsType=?,
59+
~velocity: Val.jsValue=?,
6160
~bounciness: float=?,
6261
~speed: float=?,
6362
~tension: float=?,
@@ -82,7 +81,7 @@ module ValueAnimations = (Val: Value) => {
8281
module Timing = {
8382
type toValue;
8483

85-
external fromRawValue: Val.rawJsType => toValue = "%identity";
84+
external fromRawValue: Val.jsValue => toValue = "%identity";
8685
external fromAnimatedValue: Val.t => toValue = "%identity";
8786

8887
type config;
@@ -150,12 +149,11 @@ module ValueOperations = {
150149
module ValueMethods = (Val: Value) => {
151150
type t = Val.t;
152151
type jsValue = Val.jsValue;
153-
type rawJsType = Val.rawJsType;
154152

155153
type callback = jsValue => unit;
156154

157-
[@bs.send] external setValue: (t, rawJsType) => unit = "";
158-
[@bs.send] external setOffset: (t, rawJsType) => unit = "";
155+
[@bs.send] external setValue: (t, jsValue) => unit = "";
156+
[@bs.send] external setOffset: (t, jsValue) => unit = "";
159157
[@bs.send] external flattenOffset: t => unit = "";
160158
[@bs.send] external extractOffset: t => unit = "";
161159
[@bs.send] external addListener: (t, callback) => string = "";
@@ -174,8 +172,7 @@ module ValueMethods = (Val: Value) => {
174172
module Value = {
175173
include ValueMethods({
176174
type t = value(regular);
177-
type jsValue = {. "value": float};
178-
type rawJsType = float;
175+
type jsValue = float;
179176
});
180177

181178
[@bs.new] [@bs.scope "Animated"] [@bs.module "react-native"]
@@ -196,7 +193,6 @@ module ValueXY = {
196193
"x": float,
197194
"y": float,
198195
};
199-
type rawJsType = jsValue;
200196
});
201197

202198
type translateTransform = {

0 commit comments

Comments
 (0)