Skip to content

Commit

Permalink
Animated Components (Image, ScrollView, Text, View) (facebook#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgny authored and cknitt committed Apr 20, 2019
1 parent 41d03e6 commit 34eab2f
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 9 deletions.
27 changes: 26 additions & 1 deletion reason-react-native/src/apis/Animated.bs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

var Animation = /* module */[];

Expand Down Expand Up @@ -76,6 +77,26 @@ function reset(prim) {
return /* () */0;
}

var make = ReactNative.Animated.createAnimatedComponent(ReactNative.Image);

var $$Image = /* module */[
/* Source */Image$ReactNative.Source,
/* DefaultSource */Image$ReactNative.DefaultSource,
/* make */make
];

var make$1 = ReactNative.Animated.createAnimatedComponent(ReactNative.ScrollView);

var ScrollView = /* module */[/* make */make$1];

var make$2 = ReactNative.Animated.createAnimatedComponent(ReactNative.Text);

var $$Text = /* module */[/* make */make$2];

var make$3 = ReactNative.Animated.createAnimatedComponent(ReactNative.View);

var View = /* module */[/* make */make$3];

exports.Animation = Animation;
exports.ValueAnimations = ValueAnimations;
exports.Interpolation = Interpolation;
Expand All @@ -88,4 +109,8 @@ exports.decay = decay;
exports.start = start;
exports.stop = stop;
exports.reset = reset;
/* react-native Not a pure module */
exports.$$Image = $$Image;
exports.ScrollView = ScrollView;
exports.$$Text = $$Text;
exports.View = View;
/* make Not a pure module */
28 changes: 28 additions & 0 deletions reason-react-native/src/apis/Animated.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,4 +275,32 @@ let stop = Animation.stop;
let reset = Animation.reset;
// Unsafe, unfortunately, but allows us to pass animated values everywhere.
// May be refined later.
external animatedStyle: value('a) => 'b = "%identity";
module Image = {
include Image;
let make = createAnimatedComponent(make);
};
module ScrollView = {
include ScrollView;
let make = createAnimatedComponent(make);
};
module Text = {
include Text;
let make = createAnimatedComponent(make);
};
module View = {
include View;
let make = createAnimatedComponent(View.make);
};
```
28 changes: 28 additions & 0 deletions reason-react-native/src/apis/Animated.re
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,31 @@ let start = Animation.start;
let stop = Animation.stop;

let reset = Animation.reset;

// Unsafe, unfortunately, but allows us to pass animated values everywhere.
// May be refined later.
external animatedStyle: value('a) => 'b = "%identity";

module Image = {
include Image;

let make = createAnimatedComponent(make);
};

module ScrollView = {
include ScrollView;

let make = createAnimatedComponent(make);
};

module Text = {
include Text;

let make = createAnimatedComponent(make);
};

module View = {
include View;

let make = createAnimatedComponent(View.make);
};
4 changes: 0 additions & 4 deletions reason-react-native/src/apis/Style.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ wip: true
```reason
let pct = num => num->Js.Float.toString ++ "%";
// Unsafe, unfortunately, but allows us to pass animated values everywhere.
// May be refined later.
external animated: Animated.value('a) => 'b = "%identity";
module Margin = {
type t;
Expand Down
4 changes: 0 additions & 4 deletions reason-react-native/src/apis/Style.re
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
let pct = num => num->Js.Float.toString ++ "%";

// Unsafe, unfortunately, but allows us to pass animated values everywhere.
// May be refined later.
external animated: Animated.value('a) => 'b = "%identity";

module Margin = {
type t;

Expand Down

0 comments on commit 34eab2f

Please sign in to comment.