We would like iOS simulator's "slow animation" mode to work with Transitions. Apparently, it only applies to UIView animations and not to lower level Core Animations. However, there is a way to detect that mode is turned ON and slow down animations manually by adjusting their duration. This solution is copied directly from RN core where it's been done for Animated.
Motivation
API known form RN core is much more flexible when it comes to being flexible.
We wanted to make using spring animation easier.
Changes
We didn't want to modify existing spring object so I have added SpringUtils object which is a set of methods for easier spring's config manipulations.
Motivation
On Android, JSCall exception is thrown type if node's value is a string
Changes
Added condition for checking if the type of node is a string and then handle it properly.
The main problems were with setValue and interpolate so I made them not available internally and exposed it with addition class. In internal operation InternalAnimatedValue is used and it's not causing dependencies' cycles.
Changed logic of exposing nodes. Now there's no need to import whole base.js for wrapped nodes.
* add useCode hook as an alternative to Animated.Code
* Add useCode documentation to README
Added a short description of Animated.useCode to the README, with both a function signature and an example of its use in a component.
Added improved error messages to Animated.Code when wrong props are passed to the component. Also, unified the types both the exec and children can accept. Both `exec` and `children` can now accept a node or a function returning a node.
Example:
```
const node = block([...]);
const nodeFn = () => node;
// All of the following lines are now valid
<Animated.Code exec={node} />
<Animated.Code exec={nodeFn} />
<Animated.Code>{node}</Animated.Code>
<Animated.Code>{nodeFn}</Animated.Code>
```
I've created some tests to assert the error is being thrown when wrong prop types are provided. I've create a separate suite for testing Animated* components. I'm not really skilled in writing tests so this might be wrong.
Also, I've added the `jsx-uses-react` eslint rule to prevent false negatives when React is imported without using it directly, as JSX is using React implicitly. More info here: https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
## Motivation
Issue has been described here https://github.com/kmagiera/react-native-reanimated/issues/182
Using imperative snapTo in `Interactable.View` sometimes didn't lead to any effect.
## Changes
It was caused by a fact that clock was not running and therefore changes haven't been evaluated properly. If GH responsible for dragging hadn't beed activated, clock was not running and then snapping without dragging was expected to run with clock stopped.
Added extra condition for it.
The example `runTiming()` method in the readme ignores new destination values passed in while the clock is running. It should instead update the `config. toValue` field each time a new `dest` value is passed in.
I think it's more natural if animation do not perform so often. Once per second looks better imho and it's a better example of this library usage.
Also, removed animations if "fetch" is finished
Proptypes are no longer supported by RN and has been removed from core of RN in favor of Flow.
It fixes this commit and merging it was a mistake.
e75377aa98
If a project uses a different sdk for compiling they will run into issues with this project since the versions are hard coded. This applies a change similar to some other libraries to take the versions specified for the project or fallback to the currently hardcoded versions.
## Motivation
I attach example illustrating this issue. The problem appears when we use `evaluateOnce` method (e.g. via `setValue`) for updating node which could be detached in the same time.
## Changes
I observe I haven't deeply understood flow of reanimataed while writing this logic. Actually always node representing evaluation should not have children which has be informed about changes (it's pointless). In fact, always node has to be a child of these nodes, because we want to have these nodes attached (make them not sensitive for other detachments), because they states input for given node.
This commit fix error "Could not resolve all artifacts for configuration ':react-native-reanimated:classpath'". I just up grade version and add google repo
Fix Mapping declaration since [native event can be a function](https://github.com/kmagiera/react-native-reanimated/pull/83)
Otherwise, you will get an error like this:
"Type '{ nativeEvent: ({ translationY: y, state }: { translationY: number; state: State; }) => AnimatedNode<number>; }' is not assignable to type 'Mapping'.
Probably not super important because these functions are symmetric with `Math.cos` and `Math.sin` but I thought maybe some people might find it useful.
## Motivation
On evaluating clock for the first time it was equal to zero
## Changes
Observing `_displayLink` I noticed that for the first time when it's being set, the value of `_displayLink.timestamp` (and `_displayLink.targetTimestamp` as well) was equal zero from some unknown reason.
However, I have found it pointless to look for bug here and actually cannot see why it's somehow better than `CACurrentMediaTime`.
What's more, I made `_wantRunUpdates` usable again.
Made some refactor.