react-native-reanimated
Advanced tools
Comparing version 1.2.0 to 1.3.0-alpha
@@ -12,3 +12,3 @@ /** | ||
const React = require('react'); | ||
const { View, Text, Image, ScrollView } = require('react-native'); | ||
const { View, Text, Image, Animated } = require('react-native'); | ||
@@ -36,3 +36,3 @@ const NOOP = () => undefined; | ||
Image, | ||
ScrollView, | ||
ScrollView: Animated.ScrollView, | ||
Code, | ||
@@ -39,0 +39,0 @@ |
{ | ||
"name": "react-native-reanimated", | ||
"version": "1.2.0", | ||
"version": "1.3.0-alpha", | ||
"description": "More powerful alternative to Animated library for React Native.", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -105,2 +105,3 @@ // Project: https://github.com/kmagiera/react-native-reanimated | ||
position: AnimatedValue<number>; | ||
prevPosition?: AnimatedValue<number>; | ||
time: AnimatedValue<number>; | ||
@@ -157,3 +158,3 @@ } | ||
// allow `number` where `string` normally is to support colors | ||
S[K] extends string ? S[K] | number : S[K] | ||
S[K] extends (string | undefined) ? S[K] | number : S[K] | ||
>) | ||
@@ -222,2 +223,5 @@ }; | ||
export const or: MultiOperator<0 | 1>; | ||
export function proc( | ||
cb: (...params: Array<Animated.Value<number>>) => Adaptable<number> | ||
): (...args: Array<Adaptable<number>>) => AnimatedNode<number>; | ||
export function defined(value: Adaptable<any>): AnimatedNode<0 | 1>; | ||
@@ -232,7 +236,7 @@ export function not(value: Adaptable<any>): AnimatedNode<0 | 1>; | ||
): AnimatedNode<string>; | ||
export function cond( | ||
export function cond<T extends Value = number>( | ||
conditionNode: Adaptable<number>, | ||
ifNode: Adaptable<number>, | ||
elseNode?: Adaptable<number>, | ||
): AnimatedNode<number>; | ||
ifNode: Adaptable<T>, | ||
elseNode?: Adaptable<T>, | ||
): AnimatedNode<T>; | ||
export function block<T>( | ||
@@ -239,0 +243,0 @@ items: ReadonlyArray<Adaptable<T>>, |
@@ -662,2 +662,21 @@ # react-native-reanimated | ||
--- | ||
### `proc` | ||
Returns a callable function node that can be used to define expressions that can be called from other nodes. | ||
Example: | ||
```js | ||
// Global constant | ||
const myProc = proc((a, b) => multiply(a,b)); | ||
// In your component | ||
const style = { width: proc(10, 10 )}; | ||
``` | ||
A proc node should be declared as a global constant in your code and not recreated from inside components. | ||
It is not possible to reference nodes that are not passed as parameters. | ||
--- | ||
### `interpolate` | ||
@@ -664,0 +683,0 @@ ```js |
@@ -86,3 +86,5 @@ import { | ||
// conditions for stopping the spring animations | ||
const prevPosition = new AnimatedValue(0); | ||
const prevPosition = state.prevPosition | ||
? state.prevPosition | ||
: new AnimatedValue(0); | ||
@@ -89,0 +91,0 @@ const isOvershooting = cond( |
@@ -16,2 +16,5 @@ export { createAnimatedCond as cond } from './core/AnimatedCond'; | ||
export { createAnimatedBlock as block, adapt } from './core/AnimatedBlock'; | ||
export { | ||
createAnimatedFunction as proc, | ||
} from './core/AnimatedFunction'; | ||
export * from './operators'; |
@@ -29,2 +29,7 @@ import React from 'react'; | ||
constructor(props) { | ||
super(props); | ||
this._attachProps(this.props); | ||
} | ||
componentWillUnmount() { | ||
@@ -40,6 +45,2 @@ this._detachPropUpdater(); | ||
componentWillMount() { | ||
this._attachProps(this.props); | ||
} | ||
componentDidMount() { | ||
@@ -46,0 +47,0 @@ if (this._invokeAnimatedPropsCallbackOnMount) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
362189
170
3790
917
1