Export `Animated.Node` for ease of type checking
Summary: At present, there's no uniform way of determining whether you've received an Animated value node which can be attached to an animated prop. You can attempt to use `instanceof Animated.Value`, but this fails for interpolated values. You can use `instanceof Animated.Interpolation`, but this fails for the values that are returned from the math functions (e.g., `Animated.Add`). This commit exposes the base type from which all of these value nodes derive. As such, it is now possible to do the following: ```js import React, { Component, PropTypes } from 'react'; import { Animated } from 'react-native'; class Widget extends Component { static propTypes = { progress: PropTypes.instanceOf(Animated.Node).isRequired, } // ... } ``` Unnecessary for cosmetic change. Closes https://github.com/facebook/react-native/pull/14688 Differential Revision: D5581539 Pulled By: shergin fbshipit-source-id: 98f40e63a463241c7f91c72391c26c3b4153e4cd
This commit is contained in:
parent
be3f1be8df
commit
8d757e5ad7
|
@ -2734,6 +2734,10 @@ module.exports = {
|
|||
* See also [`AnimatedInterpolation`](docs/animated.html#animatedinterpolation).
|
||||
*/
|
||||
Interpolation: AnimatedInterpolation,
|
||||
/**
|
||||
* Exported for ease of type checking. All animated values derive from this class.
|
||||
*/
|
||||
Node: Animated,
|
||||
|
||||
/**
|
||||
* Animates a value from an initial velocity to zero based on a decay
|
||||
|
|
Loading…
Reference in New Issue