Skip to content

Commit 34eab2f

Browse files
sgnycknitt
authored andcommitted
Animated Components (Image, ScrollView, Text, View) (#418)
1 parent 41d03e6 commit 34eab2f

File tree

5 files changed

+82
-9
lines changed

5 files changed

+82
-9
lines changed

reason-react-native/src/apis/Animated.bs.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
var Caml_option = require("bs-platform/lib/js/caml_option.js");
44
var ReactNative = require("react-native");
5+
var Image$ReactNative = require("../components/Image.bs.js");
56

67
var Animation = /* module */[];
78

@@ -76,6 +77,26 @@ function reset(prim) {
7677
return /* () */0;
7778
}
7879

80+
var make = ReactNative.Animated.createAnimatedComponent(ReactNative.Image);
81+
82+
var $$Image = /* module */[
83+
/* Source */Image$ReactNative.Source,
84+
/* DefaultSource */Image$ReactNative.DefaultSource,
85+
/* make */make
86+
];
87+
88+
var make$1 = ReactNative.Animated.createAnimatedComponent(ReactNative.ScrollView);
89+
90+
var ScrollView = /* module */[/* make */make$1];
91+
92+
var make$2 = ReactNative.Animated.createAnimatedComponent(ReactNative.Text);
93+
94+
var $$Text = /* module */[/* make */make$2];
95+
96+
var make$3 = ReactNative.Animated.createAnimatedComponent(ReactNative.View);
97+
98+
var View = /* module */[/* make */make$3];
99+
79100
exports.Animation = Animation;
80101
exports.ValueAnimations = ValueAnimations;
81102
exports.Interpolation = Interpolation;
@@ -88,4 +109,8 @@ exports.decay = decay;
88109
exports.start = start;
89110
exports.stop = stop;
90111
exports.reset = reset;
91-
/* react-native Not a pure module */
112+
exports.$$Image = $$Image;
113+
exports.ScrollView = ScrollView;
114+
exports.$$Text = $$Text;
115+
exports.View = View;
116+
/* make Not a pure module */

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,4 +275,32 @@ let stop = Animation.stop;
275275
276276
let reset = Animation.reset;
277277
278+
// Unsafe, unfortunately, but allows us to pass animated values everywhere.
279+
// May be refined later.
280+
external animatedStyle: value('a) => 'b = "%identity";
281+
282+
module Image = {
283+
include Image;
284+
285+
let make = createAnimatedComponent(make);
286+
};
287+
288+
module ScrollView = {
289+
include ScrollView;
290+
291+
let make = createAnimatedComponent(make);
292+
};
293+
294+
module Text = {
295+
include Text;
296+
297+
let make = createAnimatedComponent(make);
298+
};
299+
300+
module View = {
301+
include View;
302+
303+
let make = createAnimatedComponent(View.make);
304+
};
305+
278306
```

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,31 @@ let start = Animation.start;
267267
let stop = Animation.stop;
268268

269269
let reset = Animation.reset;
270+
271+
// Unsafe, unfortunately, but allows us to pass animated values everywhere.
272+
// May be refined later.
273+
external animatedStyle: value('a) => 'b = "%identity";
274+
275+
module Image = {
276+
include Image;
277+
278+
let make = createAnimatedComponent(make);
279+
};
280+
281+
module ScrollView = {
282+
include ScrollView;
283+
284+
let make = createAnimatedComponent(make);
285+
};
286+
287+
module Text = {
288+
include Text;
289+
290+
let make = createAnimatedComponent(make);
291+
};
292+
293+
module View = {
294+
include View;
295+
296+
let make = createAnimatedComponent(View.make);
297+
};

reason-react-native/src/apis/Style.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ wip: true
77
```reason
88
let pct = num => num->Js.Float.toString ++ "%";
99
10-
// Unsafe, unfortunately, but allows us to pass animated values everywhere.
11-
// May be refined later.
12-
external animated: Animated.value('a) => 'b = "%identity";
13-
1410
module Margin = {
1511
type t;
1612

reason-react-native/src/apis/Style.re

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
let pct = num => num->Js.Float.toString ++ "%";
22

3-
// Unsafe, unfortunately, but allows us to pass animated values everywhere.
4-
// May be refined later.
5-
external animated: Animated.value('a) => 'b = "%identity";
6-
73
module Margin = {
84
type t;
95

0 commit comments

Comments
 (0)