Skip to content

Commit 90bf370

Browse files
sgnyMoOx
authored andcommitted
Zero-cost binding for Animated.loop (#394)
* Zero-cost binding for Animated.loop * loopConfig * loopWithConfig
1 parent 2732ce3 commit 90bf370

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

‎bs-react-native-next/src/apis/Animated.bs.js‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ var ValueXY = /* module */[
4949
/* Timing */Timing$1
5050
];
5151

52-
function loop($staropt$star, animation, param) {
53-
var iterations = $staropt$star !== undefined ? $staropt$star : -1;
54-
return ReactNative.Animated.loop(animation, {
55-
iterations: iterations
56-
});
57-
}
58-
5952
function timing(prim, prim$1) {
6053
return ReactNative.Animated.timing(prim, prim$1);
6154
}
@@ -89,7 +82,6 @@ exports.Interpolation = Interpolation;
8982
exports.ValueOperations = ValueOperations;
9083
exports.Value = Value;
9184
exports.ValueXY = ValueXY;
92-
exports.loop = loop;
9385
exports.timing = timing;
9486
exports.spring = spring;
9587
exports.decay = decay;

‎bs-react-native-next/src/apis/Animated.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,15 @@ external parallel:
243243
[@bs.module "react-native"] [@bs.scope "Animated"]
244244
external stagger: (float, array(Animation.t)) => Animation.t = "";
245245
246+
type loopConfig;
247+
248+
[@bs.obj] external loopConfig: (~iterations: int) => loopConfig = "";
249+
246250
[@bs.module "react-native"] [@bs.scope "Animated"]
247-
external _loop: (Animation.t, {. "iterations": int}) => Animation.t = "loop";
251+
external loop: Animation.t => Animation.t = "";
248252
249-
let loop = (~iterations=(-1), ~animation, ()) =>
250-
_loop(animation, {"iterations": iterations});
253+
[@bs.module "react-native"] [@bs.scope "Animated"]
254+
external loopWithConfig: (Animation.t, loopConfig) => Animation.t = "";
251255
252256
type animatedEvent;
253257

‎bs-react-native-next/src/apis/Animated.re‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,15 @@ external parallel:
236236
[@bs.module "react-native"] [@bs.scope "Animated"]
237237
external stagger: (float, array(Animation.t)) => Animation.t = "";
238238

239+
type loopConfig;
240+
241+
[@bs.obj] external loopConfig: (~iterations: int) => loopConfig = "";
242+
239243
[@bs.module "react-native"] [@bs.scope "Animated"]
240-
external _loop: (Animation.t, {. "iterations": int}) => Animation.t = "loop";
244+
external loop: Animation.t => Animation.t = "";
241245

242-
let loop = (~iterations=(-1), ~animation, ()) =>
243-
_loop(animation, {"iterations": iterations});
246+
[@bs.module "react-native"] [@bs.scope "Animated"]
247+
external loopWithConfig: (Animation.t, loopConfig) => Animation.t = "";
244248

245249
type animatedEvent;
246250

0 commit comments

Comments
 (0)