change to invariant

This commit is contained in:
Jakub Adamczyk
2019-04-18 15:42:55 +02:00
parent fbce9a80d6
commit 9f998f4ab3
2 changed files with 10 additions and 10 deletions

View File

@@ -1,14 +1,14 @@
import AnimatedNode from './AnimatedNode';
import invariant from 'fbjs/lib/invariant';
export default class AnimatedAlways extends AnimatedNode {
_what;
constructor(what) {
if (!(what instanceof AnimatedNode)) {
throw new Error(
`Animated.always parameter should be of type AnimatedNode but got ${typeof what}`
);
}
invariant(
what instanceof AnimatedNode,
`Animated.set target should be of type AnimatedNode but got ${typeof what}`
);
super({ type: 'always', what: what.__nodeID }, [what]);
this._what = what;
}

View File

@@ -1,16 +1,16 @@
import AnimatedNode from './AnimatedNode';
import { val } from '../utils';
import invariant from 'fbjs/lib/invariant';
export default class AnimatedSet extends AnimatedNode {
_what;
_value;
constructor(what, value) {
if (!(what instanceof AnimatedNode)) {
throw new Error(
`Animated.set target should be of type AnimatedNode but got ${typeof what}`
);
}
invariant(
what instanceof AnimatedNode,
`Animated.set target should be of type AnimatedNode but got ${typeof what}`
);
super({ type: 'set', what: what.__nodeID, value: value.__nodeID }, [value]);
this._what = what;
this._value = value;