153 Commits

Author SHA1 Message Date
William Candillon
3c1b18927b Fix typo in Interactable (#263)
`dragEnabled` is used as a property name, not `enabled`
2019-05-06 02:14:28 +02:00
William Candillon
032a1fd22d 📚Minor documentation fix (#259) 2019-05-01 12:56:02 +02:00
Krzysztof Magiera
4ef8b81df3 Support 'slow animation' setting for Transitioning API (#250)
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.
2019-05-01 12:55:35 +02:00
Krzysztof Kraszewski
0a6405dc21 fix: convert CATransform3d using [NSValue valueWithCATransform3D] instead of boxed constraint (#254)
chore: fix syntax
2019-04-25 21:20:48 +03:00
Michael Demarais
864693f468 Replace “SprintUtils” typo with “SpringUtils” (#256) 2019-04-25 21:17:08 +03:00
Michael Demarais
413fc2968d Fix broken link to springUtils example in README (#255) 2019-04-25 21:16:25 +03:00
Michał Osadnik
fd11ce21f2 Add SpringUtils.js (#40)
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.
2019-04-25 15:15:31 +02:00
Michał Osadnik
1ed19e5255 Allow call's input to be a string on Android (#198)
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.
2019-04-25 15:02:37 +02:00
Michał Osadnik
c841c34d10 Remove dependencies' cycles (#187)
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.
2019-04-25 10:49:54 +02:00
Michel dos Santos Kuguio
bb066ed50f update to support gradle >=4.10 (#213) 2019-04-25 10:27:47 +02:00
William Candillon
0baafb2905 Add missing function documentation (#253)
* Update README.md

* Update README.md
2019-04-25 10:16:22 +02:00
Jeremy Deutsch
7d3ecedfb6 Add numbers and non-node values to concat type (#249) 2019-04-19 08:54:18 +02:00
Krzysztof Magiera
6034fdae45 Bump version -> 1.0.1 1.0.1 2019-04-17 16:24:47 +02:00
Krzysztof Magiera
8d2b7b1cf6 Use legacy context API to support older versions of react (#247) 2019-04-17 16:24:15 +02:00
Jeremy Deutsch
0882c97e82 Add Animated.useCode hook as an alternative to Animated.Code (#237)
* 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.
2019-04-15 13:12:09 +02:00
Amir Shabani
cc9787b110 typo two (#240) 2019-04-15 13:11:22 +02:00
iamolegga
d42b64212f [TS] fix adaptable type (#243)
* [TS] fix adaptable type

* Apply suggestions from code review

Co-Authored-By: iamolegga <iamolegga@users.noreply.github.com>
2019-04-15 13:04:53 +02:00
Jose G
2c0eb49703 [TypeScript] Add Transition.* and Transitioning.View types (#246) 2019-04-15 13:04:29 +02:00
Mateo Hrastnik
c39e67281e Better error messages when using Animated.Code (#239)
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
2019-04-10 13:02:41 +02:00
Krzysztof Magiera
b58c8e4d0a Releasing stable 1.0.0 1.0.0 2019-04-04 09:28:55 +02:00
Krzysztof Magiera
7580879f44 Initial implementation of Transitions 2019-04-04 09:27:15 +02:00
Michał Osadnik
d406bdda83 Bump build.gradle and compileSdkVersion (#226) 2019-04-02 14:01:42 +02:00
Michał Osadnik
e6782cfd01 Bump to RN 0.59 (#224) 2019-04-02 13:30:03 +02:00
iamolegga
e40860fa43 Update react-native-reanimated.d.ts (#220) 2019-03-28 11:26:43 +01:00
Jose G
119953c41b TS: "start" callback should be optional (#209)
This PR allows using `.start()` without passing a callback to it (like `Animated` from `react-native` does 😅).
2019-03-14 16:11:48 +01:00
Rokas Augustinas
8fe471d9fd Add more trigonometry operator (#203)
More trigonometry operators.
2019-03-11 11:58:08 +01:00
Luc Vauvillier
3f9f5cca3b Expose createAnimatedComponent definition (#201)
Missing typescript definition
2019-03-05 13:40:40 +01:00
Michał Osadnik
25ee5056cb Add additional check for running clock for imperative snapTo (#197)
## 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.
2019-03-04 10:50:41 +01:00
Naftali Beder
85dbc1eb31 Fix bug in example runTiming() method (#196)
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.
2019-03-04 10:49:41 +01:00
Michał Osadnik
3840256d9d Clarify that color node accepts only integer values (#190)
I see it was written here before but it calls for clarifying a bit
2019-03-04 10:48:19 +01:00
Michał Osadnik
41fcf4b51b Bump RNGH (#189)
In new version of yarn integrity sum is dropped
2019-03-04 10:48:02 +01:00
Michał Osadnik
3e311846eb Follow up changes in mocks with new changes (#188) 2019-03-04 10:47:42 +01:00
Krzysztof Magiera
8765e8c9c7 Bump version -> alpha.12 2019-02-05 12:32:33 +01:00
Michał Osadnik
4408906731 Clear timeout if needed send event less often (#163)
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
2019-02-05 12:23:43 +01:00
Michał Osadnik
4a0798b752 Remove prop-types from AnimatedComponent (#180)
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
2019-02-05 12:20:26 +01:00
Mikael Sand
e75377aa98 Renamed ViewStyleProps to DeprecatedViewStyleProps. (#177)
https://github.com/facebook/react-native/pull/21415
https://github.com/facebook/react-native/issues/21342
2019-01-25 17:33:51 +01:00
Radek Pietruszewski
1497a9a1aa Language tweaks in readme (#173)
Some language tweaks for clarity
2019-01-17 21:44:30 +01:00
Cameron Knight
76e5cd465e Update react-native-reanimated.d.ts (#170)
This fixes a type error as an object in the left-hand position is considered a destructure of type `any`
2019-01-16 22:11:39 +01:00
rmevans9
b9f5bb2a8d Use versions from project configuration if available. (#164)
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.
2019-01-09 15:12:02 +01:00
Joe Goodall
d2e9437ff6 Update README.md (#154)
Grammatical changes and improvements to the README.
2019-01-07 16:01:29 +01:00
Krzysztof Magiera
b582ce77d4 Bump version -> alpha.11 2019-01-04 10:22:29 +01:00
Michał Osadnik
fae1f1528a Fix detaching already detached nodes on evaluateOnce (#153)
## 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.
2018-12-21 14:56:23 +01:00
Krisztiaan
e44a871d02 📚 Fix Clock example (#152)
Put the `runTimer` array in a `block`
2018-12-17 12:57:37 +01:00
Krosh
72b1792df7 Fix build on android (#148)
This commit fix error "Could not resolve all artifacts for configuration ':react-native-reanimated:classpath'". I just up grade version and add google repo
2018-12-12 16:46:35 +01:00
Sunny Luo
2eb45e2b47 Update react-native-reanimated.d.ts (#146)
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'.
2018-12-12 09:41:59 +01:00
Christian Bach
74c520204f Revert back to typeof to avoid ReferenceError: Can't find variable Proxy (#147) 2018-12-10 22:11:20 +01:00
Christian Bach
82f6608799 Check if Proxy is not undefined (#145)
* Check if typeof Proxy is a function

* Make Proxy support check simpler, add comment about iOS 8 & 9 in Polyfill

* Lint and format files
2018-12-10 21:09:03 +01:00
Michał Osadnik
bd19dee37f Add backward compatible API typings (#141)
Closes #138
2018-12-06 11:11:57 +01:00
William Candillon
6df9a32531 📚Add unit to cos() and sin() (#130)
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.
2018-11-13 11:16:18 +00:00
Michał Osadnik
2b81535141 Fix clock equals 0 on first evaluation (#121)
## 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.
2018-11-06 11:26:41 +01:00