Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support animating Svg Path d attribute on android #176

Closed

Conversation

msand
Copy link
Contributor

@msand msand commented Jan 23, 2019

software-mansion/react-native-svg#908

import * as React from 'react';
import { View, StyleSheet } from 'react-native';
import { Svg, Path } from 'react-native-svg';
import Animated from 'react-native-reanimated';

const { concat, multiply } = Animated;
const x = multiply(1, 2);
const y = multiply(2, 3);
const path = concat('M 0 0 L ', x, ' ', y);

const AnimatedPath = Animated.createAnimatedComponent(Path);

export default class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <Svg viewBox="0 0 10 10" width="100" height="100">
          <AnimatedPath d={path} stroke="black" />
        </Svg>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: '#ecf0f1',
  },
});

software-mansion/react-native-svg#908

```jsx
import * as React from 'react';
import { View, StyleSheet } from 'react-native';
import { Svg, Path } from 'react-native-svg';
import Animated from 'react-native-reanimated';

const { concat, multiply } = Animated;
const x = multiply(1, 2);
const y = multiply(2, 3);
const path = concat('M 0 0 L ', x, ' ', y);

const AnimatedPath = Animated.createAnimatedComponent(Path);

export default class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <Svg viewBox="0 0 10 10" width="100" height="100">
          <AnimatedPath d={path} stroke="black" />
        </Svg>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: '#ecf0f1',
  },
});
```
String key = entry.getKey();
String value = (String) node.value();
mPropMap.putString(key, value);
hasUIProps = true;
} else {
String key = entry.getKey();
if (mNodesManager.uiProps.contains(key)) {
Copy link

@reneeichhorn reneeichhorn Jan 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a small suggestion:
Does it make sense use a type check in the else block instead of a new else if block specially for ConcatNode.
In the future the might be more Nodes that do string operations.

I'm thinking about doing it the same it is done in line#75

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah most probably, I just made a quick patch to get it working. I'm thinking @kmagiera and @osdnk will probably have better insight into the rest of the codebase than me, perhaps they can take over from here? Otherwise, once they review it I can probably make any needed changes.

@osdnk
Copy link
Contributor

osdnk commented Jan 25, 2019

Hi!
I'm sorry, but I could not understand how it should help. Firstly, you check if some node is concat and if yes, then it is UI prop (like translateX etc), which could be updated by RN itself.
I think that it might help only by some unexpected side effect.

However, I see a wider problem. I think that it might be sometimes possible to update some non-style prop of component without passing bridge. This PR appears to do the same thing #131 so maybe try to fix this solution?

Also, please add some examples to Example app and try do add some comments if needed :)

@msand
Copy link
Contributor Author

msand commented Jan 25, 2019

The react-native-svg elements are native views and have property setters to handle the updates directly from the native animation driver, so, most of the props do not need to cross the bridge. Almost all props which take lengths/dimensions can be given either numbers or strings now, but path data (the d attribute of the Path element) needs to be a string, which this change allows to work. But, it might interfere with other use cases, I haven't used reanimated for anything else yet.

@osdnk
Copy link
Contributor

osdnk commented Jan 25, 2019

I could imagine that it might break something.

@reneeichhorn
Copy link

@osdnk Any idea whats the best way to proceed with this issue? I'd gladly help and contribute. Maybe it should be possible to extend createAnimatedComponent to specify what is a UI Prop and doesn't need to go over the bridge to update.
I'm also wondering what exactly happens on ios because it seems to work fine there as well.

@kmagiera
Copy link
Member

kmagiera commented Feb 6, 2019

Hey @msand and @reneeichhorn – thank you for your work on this. We are motivated to help push this effort forward.

I understand that what is needed is for the props node to support string values as opposed to supporting only styles and numeric values. If so I agree with @reneeichhorn suggestion that instead of doing a node type check we should verify the type of the value that the node returns.

On top of that I'd appreciate if you could update you PR description to include a few words about the scope of this change. The example you provided is very nice but would like a few words on what changes and why.

@msand
Copy link
Contributor Author

msand commented Feb 27, 2019

I've rebased my earlier PR to react-native to support string interpolation for use with e.g. react-native-svg: facebook/react-native#18187
@osdnk @kmagiera Would you mind having a look/review it? There's a few other examples there which could be replicated using reanimated as well. I can probably have a look at fixing this PR soon as well.

@msand
Copy link
Contributor Author

msand commented Feb 27, 2019

@kmagiera Were you thinking something like this?

  @Override
  protected Double evaluate() {
    boolean hasUIProps = false;
    boolean hasNativeProps = false;
    boolean hasJSProps = false;
    WritableMap jsProps = Arguments.createMap();
    final WritableMap nativeProps = Arguments.createMap();

    for (Map.Entry<String, Integer> entry : mMapping.entrySet()) {
      Node node = mNodesManager.findNodeById(entry.getValue(), Node.class);
      if (node instanceof StyleNode) {
        WritableMap style = (WritableMap) node.value();
        ReadableMapKeySetIterator iter = style.keySetIterator();
        while (iter.hasNextKey()) {
          String key = iter.nextKey();
          WritableMap dest;
          if (mNodesManager.uiProps.contains(key)) {
            hasUIProps = true;
            dest = mPropMap;
          } else if (mNodesManager.nativeProps.contains(key)){
            hasNativeProps = true;
            dest = nativeProps;
          } else {
            hasJSProps = true;
            dest = jsProps;
          }
          ReadableType type = style.getType(key);
          switch (type) {
            case Number:
              dest.putDouble(key, style.getDouble(key));
              break;
            case String:
              dest.putString(key, style.getString(key));
              break;
            case Array:
              dest.putArray(key, (WritableArray) style.getArray(key));
              break;
            default:
              throw new IllegalArgumentException("Unexpected type " + type);
          }
        }
      } else {
        String key = entry.getKey();
        Object value = node.value();
        if (mNodesManager.uiProps.contains(key)) {
          hasUIProps = true;
          if (value == null) {
            mPropMap.putNull(key);
          } else if (value instanceof Double) {
            mPropMap.putDouble(key, (Double) value);
          } else if (value instanceof Integer) {
            mPropMap.putInt(key, (Integer) value);
          } else if (value instanceof Number) {
            mPropMap.putDouble(key, ((Number) value).doubleValue());
          } else if (value instanceof Boolean) {
            mPropMap.putBoolean(key, (Boolean) value);
          } else if (value instanceof String) {
            mPropMap.putString(key, (String) value);
          } else if (value instanceof WritableArray) {
            mPropMap.putArray(key, (WritableArray)value);
          } else if (value instanceof WritableMap) {
            mPropMap.putMap(key, (WritableMap)value);
          } else {
            throw new IllegalStateException("Unknown type of animated value");
          }
        } else {
          hasNativeProps = true;
          if (value == null) {
            nativeProps.putNull(key);
          } else if (value instanceof Double) {
            nativeProps.putDouble(key, (Double) value);
          } else if (value instanceof Integer) {
            nativeProps.putInt(key, (Integer) value);
          } else if (value instanceof Number) {
            nativeProps.putDouble(key, ((Number) value).doubleValue());
          } else if (value instanceof Boolean) {
            nativeProps.putBoolean(key, (Boolean) value);
          } else if (value instanceof String) {
            nativeProps.putString(key, (String) value);
          } else if (value instanceof WritableArray) {
            nativeProps.putArray(key, (WritableArray)value);
          } else if (value instanceof WritableMap) {
            nativeProps.putMap(key, (WritableMap)value);
          } else {
            throw new IllegalStateException("Unknown type of animated value");
          }
        }
      }
    }

    if (mConnectedViewTag != View.NO_ID) {
      if (hasUIProps) {
        mUIImplementation.synchronouslyUpdateViewOnUIThread(
                mConnectedViewTag,
                mDiffMap);
      }
      if (hasNativeProps) {
        mNodesManager.enqueueUpdateViewOnNativeThread(mConnectedViewTag, nativeProps);
      }
      if (hasJSProps) {
        WritableMap evt = Arguments.createMap();
        evt.putInt("viewTag", mConnectedViewTag);
        evt.putMap("props", jsProps);
        mNodesManager.sendEvent("onReanimatedPropsChange", evt);
      }
    }

    return ZERO;
  }

@msand
Copy link
Contributor Author

msand commented Feb 27, 2019

This would require calling:
Animated.addWhitelistedUIProps({ d: true });
And similarly for almost all other react-native-svg properties (the ones which don't require any processing in javascript atm, ideally everything would support animation using purely native logic).
But, addWhitelistedUIProps isn't even listed in the types, and this comment exists instead:

// `addWhitelistedNativeProps` will likely be removed soon, and so is
// intentionally not exposed to TypeScript. If it is needed, it could be
// uncommented here, or just use
// `(Animated as any).addWhitelistedNativeProps({ myProp: true });`

// addWhitelistedNativeProps(props: { [key: string]: true }): void;

How are UIProps supposed to be registered once those are dropped?

@osdnk
Copy link
Contributor

osdnk commented Apr 25, 2019

@msand It won't be dropped. Could we remove this comment @adamczyk777?

Please, update PR following changes you've suggested, @msand

@wcandillon
Copy link
Contributor

@msand Thank you so much for doing this. Isn't the issue with string animated values on Android in general? I will try to take a look at it myself as well (#300). On iOS text values as well as SVG path can be animated, would be nice to have the same on Android of course.

@owinter86
Copy link
Contributor

owinter86 commented Jun 13, 2019

Is there anything blocking the release of this pull request (adjusted with the @msand comment updates)? I can confirm that it closes out issue #300 reported by @wcandillon and have tested on android with the following props.

text={concat("hello ", "world")}
text={new Animated.Value("hello")}

This TextInput setNativeProps solution is a really good way of tracking animated values without crossing the bridge, so it will be nice to include it in this package until RN core supports this functionality properly.

To allow the TextInput to track number values additional logic is required to convert the double values from new Animated.Value(10) to string as android TextInputs only accept string values.

That would fully close out #300 in my opinion, but I am unsure if this logic is suitable in this instance.

} else if (value instanceof Double) {
if (key.equals("text")) {
    // TextInput text prop only accepts string values
    // Convert animated values 'new Animated.Value(10)' to string
    nativeProps.putString(key, (String) Double.toString((Double) value));
} else {
    nativeProps.putDouble(key, (Double) value);
}
} else if (value instanceof Integer) {

@wcandillon
Copy link
Contributor

@owinter86 I'm able to build the lib locally but then how can I link it to my RN project in order to test it? I'd be curious to know who does the development setup look like.

@wcandillon
Copy link
Contributor

I can confirm that it solves the svg path animation issue. And it's very exciting. I lost overview on what needs to be done for this PR to be merge. Please let me know I would be happy to help.

@wcandillon
Copy link
Contributor

@owinter86 I was not able to get the text input example working with RN 0.59.9. Did something change there in the TextInput component?

@owinter86
Copy link
Contributor

@wcandillon it should be the same setup as you had in the #300 issue, I have forked this package and applied the patch so I can test it in my local setup.

If you modify your package json to include my commit like below, you should be able to test it out.

"react-native-reanimated": "https://github.com/owinter86/react-native-reanimated.git#bbbef93f146df86393a07cd23dde9006061fc2ae",

It includes @msand's above snippet and my small patch so that animated strings and animated values will work in android TextInput component.

@msand
Copy link
Contributor Author

msand commented Jun 13, 2019

@wcandillon If you have a plain react-native project, you can make changes directly in the code in node_modules and rebuild the native code using: react-native run-ios / run-android, or using xcode / android studio. You don't need any special setup, except whats required to build a plain project:

react-native init CleanProject
cd CleanProject/
npm i react-native-svg react-native-reanimated
react-native link
# make changes in app.js and node_modules and then build & run the project
react-native run-ios

You can use e.g. https://www.npmjs.com/package/patch-package if you don't want to create a fork of some codebase to monkeypatch it in a single project 😄Making a fork in github and pushing commits there instead enables reusing it in several projects.

I would normally do development directly in node_modules, and once I'm ready to publish a change, I diff the folder in node_modules with a separate folder (Webstorm has quite a nice folder diff tool for these kinds of use cases) where I've checked out the git repository of my fork of the module I'm changing, then commit in there and push to my fork on github.

Then it's just a matter of clicking the open pr button in github to spread the fixes/changes to the maintainers/community.

@msand
Copy link
Contributor Author

msand commented Jun 13, 2019

Your package.json can refer to git repos, and this way use forks of the module. E.g. to use the latest commit from this pr: https://github.com/msand/react-native-reanimated/tree/animate-svg-path-data-android
npm i react-native-reanimated@msand/react-native-reanimated#be87477
or
npm i react-native-reanimated@msand/react-native-reanimated#be87477ee75a8dbff68b14621203013bbc282585

@wcandillon
Copy link
Contributor

I opened #311 which seems to work great on my Android. Let me know your thoughts.

kmagiera pushed a commit that referenced this pull request Sep 26, 2019
@wcandillon
Copy link
Contributor

This issue is fixed via #311, @msand can you close it?

@msand
Copy link
Contributor Author

msand commented Sep 27, 2019

@wcandillon Ah, great. Thanks for helping out!

@msand msand closed this Sep 27, 2019
@wcandillon
Copy link
Contributor

@msand no, no, no, no ☝🏻Thank YOU 😀

osdnk pushed a commit that referenced this pull request Nov 11, 2019
* Add CI integration (#278)

Motivation
In React Native Gesture Handler repo we have integration with travisCI to test if our Example apps are building and some detox e2e tests on iOS. I thought that it is not much work to add CI here as we already have config and project config is similar so it would most likely work out of the box with little tweaks.

Changes
Added YAML config file and Travis CI integration

* Clarify set node description (#285)

* Add a mock implementation for test runners (#276)

I was recently using reanimated in react-navigation where I needed to mock it to be able to run it in Jest. It'll be great if the mock was in the library so we don't have to duplicate it in every project.

I looked through the typescript definitions and added a mock function for almost everything. I didn't use anything specific to a test runner such as Jest, so it should be possible to use the mock with any test runner.

* Create ReanimatedModule.web.js (#242)

Prevents crashing when referenced in libs like react-navigation.

* Fix example app's metro config on windows machines (#266)

glob-to-regexp does not escape backslashes as of version 0.4 which causes issues on windows machines. replacing backslashes with slashes only on windows fixes the issue.

* TVos support (#291)

* Add typing for concat#0 concat#1 (#293)

concat#1 can be useful to convert a numerical animated value to a string.

* Update README.md (#301)

* Remove react/react-native peerDependencies (#298)

* 💄Refine TypeScript type for boolean functions (#305)

* Get rid of Bezier's arguments check (#307)

* Bump version -> 1.1.0

* Add Math.log() operator (#320)

I had a need for Math.log in an Animation calculation. This code all seemed to work and I think I found all the touch points, but I'm not well versed on the native side of things so please let me know if anything needs to change.

* 💄 Refine TS type (#314)

* Fix android CI setup (#313)

* fix(🐛): Add TS support for animated transforms (#323)

* Replace forEach with for loop (#329)

Since `__addChild` etc. are called so many times, using a for loop makes it faster by around 10ms at least (on iOS simulator, on device it might be even more).

* Bypass animation queue for onScroll events (#312)

This PR is a proof of concept on how to address issues like #160 #309.

As outlined in my comment, the problem with the current batched updates are that reanimated lags behind event processing by at least one event, in some cases up to 3-4. If using something like react-native-gesture-handler this is generally not noticeable as reanimated will be responsible for positioning all elements, but when deriving an animated value from a scroll event this would cause the elements positioned by reanimated to be out of sync with the scroll view.

To address the lag, this PR introduces a concept of "direct events", that will bypass the queue and apply its effects immediately. Due to my unfamiliarity with the codebase I didn't really know how to do this in a nice way without also doing a quite big refactor. This is a low invasive change to illustrate how it can be addressed, I'm happy to receive feedback on how this can be done in a cleaner way.

Test plan
Using @lindesvard's reproduction of the issue https://github.com/lindesvard/reanimated-scroll-perf on a physical device, applying these changes should remove the lag and stuttering.

Adverse effects
Since the direct effects will bypass the queue, it will not retain the same order. Given the declarative nature of reanimated I think this should be OK in most cases, but still worth mentioning. A possible workaround is to flush the queue before applying direct events.
The current way to determine direct events are by event name which is not particularly specific. In the odd case of naming collision, I don't see it having profound negative effects however.

* (react-native-reanimated.d.ts) fix TransformsStyle (#339)

This fixes typescript error `Cannot find name 'TransformStyle'.`.

* target iOS 9.0 (#346)

* Make `ReanimatedModule.NAME` public (#356)

This allow using the constant directly with `TurboReactPackage`.

* Fix: Support optional string style types (#352)

* Add support for nodes inside proc (#354)

Motivation
When creating multiple dynamic animations with react-native-reanimated the number of nodes that needs to be transported over the bridge is a performance challenge. One of the limitations of the current primitives offered by reanimated is the lack of function nodes. Being able to define node trees that can be reused will offer better performance. A previous attempt has been done in this pull request: #42

Implementation
The suggested implementation tries to limit changes to the current source code by adding new nodes without changing the existing implementation too much. Three new nodes have been added:

ParamNode
CallFunctionNode
FunctionNode
A few changes to the NodeManager to be able to force reevaluation when calling functions have been added.

The implementation uses a simple proc function in Javascript to create function nodes. Following is an example of how a function is defined and used.

// Defining the function
const mulXY = proc((x, y) => multipy(x, y));

// Using the function
const myX = new Animated.Value(12);
const myY = new Animated.Value(14);
const myResult = mulXY(myX, myY);
Technical
The solution I have used in this implementation is to implement the ParamNode as a node that holds a reference to other nodes - returning the referenced node's value when evaluated and setting the referenced node's value when changed.

Calling the function node is done using the CallFuncNode that is created when calling the function (on the JS side). When the CallFuncNode is evaluated, it performs the following steps:

Start a new context
Copy current argument nodes to the param nodes (using a Stack in the param node)
Evaluate the function node's expression
Pop the current argument nodes from the param nodes
End context
I have also changed NodeManager's invalidate strategy so that it will force a reevaluation of nodes when we are in a function call to avoid returning the same value for multiple functions calls with different parameter references.

Using a stack in the ParamNode ensures that we can create recursive functions.

Memory
A single proc node should be created as a global constant in javascript since they are immediately attached and will never be removed.

Platforms
Both Android and iOS platform-specific code has been added in addition to the required JS code.

Further plans
Rewriting functionality in reanimated called often should be considered. Moving complex spring functions to functions could also be considered but is not necessarily part of this PR.

Testing
Convert built-in derived functionality to use proc nodes and verify that all examples work nicely. I have already done this for interpolate and easings and it seems to be working fine. Verify that no memory leaks exist.

I believe that the current implementation supports caching of function evaluation - would be happy if someone else could confirm this.

Co-authored-by: osdnk <micosa97@gmail.com>

* 💄Refine typing for cond() (#359)

* Fix: jest mock should use Animated.ScrollView (#344)

Ran into the issue here:
satya164/react-native-tab-view#845

This is because `ScrollView` doesn't have `.getNode()` but `Animated.ScrollView` does. 

This change fixes the error. I think this is the correct fix.

cc @simonbuerger

* doc: fix broken code block (#365)

replaced backticks(?) to "`"

* Remove deprecated componentWillMount (#342)

Refactors the create animated component removing the deprecated componentWillMount lifecycle and moving the attachProps to the constructor.

* Bump version -> 1.2.0

* Update README.md (#384)

Fix typo

* FIX javaCompileProvider (#393)

FIX for #315

* Remove prevPosition in SpringState (#386)

Creates a type name that is non-specific to one animation function. This is useful when an animation state is shared between animation functions (spring + decay for instance).

* add event mapping type (#388)

* Add createAnimatedComponent to mock (#389)

* Specify component typings as React.Component classes (#373)

*Rationale*

Currently `Animated.View`, `Animated.Text`, `Animated.Image`, `Animated.ScrollView` are exported as `const`ants with a `React.ComponentClass` type. This means they cannot be used as generics in (for example) `React.Ref<Animated.View>`, and that the useful `getNode()` method is not typed.

PR addresses this by changing the constants to `React.Component` class exports, decorated with the `getNode()` method

* migrate to AndroidX (#395)

Migrated source code to use AndroidX, and Example to use React Native 0.60.5. Also removed unnecessary files like flow and buck configurations, Gradle wrapper in android, etc... Removed Geolocation module from Example on iOS.

I can compile for Android and iOS versions of the example app, but metro fails to resolve react-native-reanimation from '../src/Animated' via babel configuration.

**HELP**: Help make metro work for example app.

* Update Example app to use RN 0.61 (#401)

* Optimize constant nodes creation and cleanup (#403)

This PR optimizes the way we create and cleanup value nodes.

When adapting constants (e.g. when doing interpolate({ inputRange: [0,1]}) we generate new nodes for start and end of the range) we've been creating new animated value nodes. This kind of nodes can never be updated on the native side and hence there is no need to send its final value back to JS when they get detached.

On top of there there are several constant values that are frequently used across the library and product code with reanimated. Those can only be instantiated once and reused in all the places. That list includes 0, 1 and -1 for now.

These two changes reduce the number of nodes instantiated by one third on colors/index.js example (from 88 down to 57) and reduce the number of nodes we call getValue for by 94% (from 88 down to 5).

* Update iOS Example project to build with RN 0.61 (#402)

* Update android Example project build.gradle to build with RN 0.61 (#407)

* fix(🐛): Fix Android bug when dealing with string animated values (#311)

This PR takes @msand and @osdnk  from #176 into consideration.

fixes #300

* Bump version -> 1.3.0

* Added web support (#390)

# Why

- [Preview](https://twitter.com/Baconbrix/status/1173825701192929280?s=20)
- [Demo](https://reanimated.netlify.com)

# How

- Enabled JS runner
- Added JS to broken runner nodes: `CallFunc`, `Param`
- Added support for web gesture-handler
- Added expo-web to Example
- Added `format` node for web color transform

# Test Plan

- [Example](https://reanimated.netlify.com) should run
  - Transitions API is not supported yet

* [iOS] Fix floor() implementation (#362)

fixes #316

* Fix invalid url in readme.md (example in event handling) (#418)

* fixed EventArgFunc typings (#422)

* 💄Export AnimateProps & AnimateStyle (#429)

Exporting these types can be useful for component definition.
For instance:

```ts
interface FlexibleCardProps extends CardProps {
  style?: Animated.AnimateStyle<ImageStyle>;
}

export const FlexibleCard = ({ card, style }: FlexibleCardProps) => (
  <Animated.Image
    style={[styles.flexibleContainer, style]}
    source={card.source}
  />
);
```
```

* bump -> 1.3.1

* Fix web support (#445)

* bump -> 1.3.2

* Add tvos podspec support (#440)

* 💄Refine debug() typing (#434)

Non-node value crash with debug()

* Bump morgan from 1.9.0 to 1.9.1 in /Example (#444)

Bumps [morgan](https://github.com/expressjs/morgan) from 1.9.0 to 1.9.1.
- [Release notes](https://github.com/expressjs/morgan/releases)
- [Changelog](https://github.com/expressjs/morgan/blob/master/HISTORY.md)
- [Commits](expressjs/morgan@1.9.0...1.9.1)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump extend from 3.0.1 to 3.0.2 in /Example (#442)

Bumps [extend](https://github.com/justmoon/node-extend) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/justmoon/node-extend/releases)
- [Changelog](https://github.com/justmoon/node-extend/blob/master/CHANGELOG.md)
- [Commits](justmoon/node-extend@v3.0.1...v3.0.2)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump js-yaml from 3.12.0 to 3.13.1 in /Example (#441)

Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.12.0 to 3.13.1.
- [Release notes](https://github.com/nodeca/js-yaml/releases)
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](nodeca/js-yaml@3.12.0...3.13.1)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump mixin-deep from 1.3.1 to 1.3.2 in /Example (#443)

Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/jonschlinkert/mixin-deep/releases)
- [Commits](jonschlinkert/mixin-deep@1.3.1...1.3.2)

Signed-off-by: dependabot[bot] <support@github.com>

* fix: mock.js NOOP to allow for "new" constructor call (#439)

i'm getting errors in my tests from this mock as the new Value(0) call throws for arrow functions, this seems to work when i updated my mock.js in node_modules.

* 🎣Allow to pass a callback as parameter of useCode() (#408)

fixes #343

This can enable us to save some unnecessary node creation but more importantly, it will enable us to benefit from the Exhaustive Deps eslint rule. This rule expect a callback as first parameter: https://github.com/facebook/react/blob/master/packages/eslint-plugin-react-hooks/src/ExhaustiveDeps.js#L64
This rule is incredibly useful to avoid bugs when using hooks that have dependencies.

* Add Jest doc to the README

Following #355 (comment) it's true that there is no easily accessible documentation about how to set up Jest tests with reanimated.

* Fix node dirty marking when new connection between nodes is made (#450)

This change fixes the problem where a parent node were marked as dirty while adding connection between nodes instead of the children node. We should be only marking children node as if we mark parent node there is a chance that this would trigger updates in leave nodes (final nodes) that should not be affected as the children added to parent node cannot impact its value.

On top of that the marking change relealed a bug where we initialized loop ID inproperly. We should be initializing it with a value that'd allow the node to be evaluated at least once. It's been working before as every node would be dirty marked. With the above change the root nodes were no longer being marked but we'd still require them to be evaluated. The invalid initial setting for last loop ID was making us skip evaluation of those parent nodes.

In order to test this change I created the following sample app: https://gist.github.com/7fce6b4a891f0284baa17d0d63455495
In this app there is a button that creates a new view that hooks into an existing animated value. Before this change when the view was added we'd reevaluate all the nodes that depend on that value and hence we'd get a consol.warn being shown twice (first on the initial render and then second time when we add the view). WIth this change in the `call` node should not be evaluated more than once and only on the initial render.

* Bump -> 1.4.0

* Fix ESLint dev setup and errors (#421)

* Fix ESLint setup and devDependencies

- Fix version of types/react-native
- Update husky and lint-staged

* Fix lint errors

* Rewrite README.md

* Format and update 04.transitions.md

* Format and update 05.value.md

* Format and update 07.block.md

* Format and update 09.code.md

* Format and update 10.event.md

* Format and update 11.baseNodes/set.md

* Add 11.baseNodes/log.md

* Format and update 11.baseNodes/floor.md

* Format and update 11.baseNodes/ceil.md

* Update min, max docs

* Add proc node docs

* Format pages

* Update README.md with latest version

* Remove unnecessary assets folders

* Update README.md

* Remove meme

:c

* Fix links and move 14.backward.md to 13.declarative.md

* Remove 1st person narrative in about page

* Remove assets/ from component-docs config

We don't need static assets right now
headfire94 pushed a commit to ExodusMovement/react-native-reanimated that referenced this pull request Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants