mirror of
https://github.com/zhigang1992/react-native-reanimated.git
synced 2026-06-19 18:23:33 +08:00
change to invariant
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user