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

Fix merge conflict #3

Merged
merged 13 commits into from
Jul 20, 2020
Merged

Fix merge conflict #3

merged 13 commits into from
Jul 20, 2020

Conversation

wcandillon
Copy link

Description

Fixes # .

Changes

Screenshots / GIFs

Before

After

Szymon20000 and others added 13 commits July 14, 2020 11:51
WHY:
-------------
HOW:
https://react-native-community.github.io/upgrade-helper/?from=0.62.2&to=0.63.0

CHANGE 0
The pull-request also changes the way in which we plug Reanimated to an app. We create NativeProxy in ReanimatedJSIModulePackage.getJSIModules Instead of imitating TurboModuleManager. That's a correct place because it's called before TurboModuleManager is created and late enough to have access to context and NodesManager.

CHANGE 1
Because we need to support both RN 62 and RN 63 as a temporary solution we include 2 aar packages to npm package. In order to do it, I've made changes to build.gradle of android-npm and createNPMPackage.sh. 

build.gradle (before)
``` groovy
configurations.maybeCreate("default")
artifacts.add("default", file('react-native-reanimated.aar'))
```
build.gradle (after)
``` groovy
import groovy.json.JsonSlurper;
configurations.maybeCreate("default")

def inputFile = new File(projectDir, '../../react-native/package.json')
def json = new JsonSlurper().parseText(inputFile.text)
def reactNativeVersion = json.version as String
def (major, minor, patch) = reactNativeVersion.tokenize('.')

artifacts.add("default", file("react-native-reanimated-${minor}.aar"))
```

As you can see a proper aar is chosen based on RN version.
* error handler works for iOS

* add android error handler + modifications

* handle more errors
## How
Initialize global bridge variable in AppDelegate.jsExecutorFactoryForBridge. It's cleared in REAModule.invalidate. 

## Testing
Checked if reload works on iOS.

## Closes
resolves: software-mansion#979
The primary goal of this PR is to add new animation helper called "sequence".

Sequence takes a number of animations and runs them one after another. This is a convenience method and could've previously be done by starting animations with callback and then starting next one in callback, but we see there are some nice usecases sequence fits in and we'd like to include it in the API.

This PR also makes a braking change to `loop` method. We are deprecating `loop` and adding `repeat` method instead. The difference between `loop` and `repeat` is that `repeat` does not "reverse" the animation by default. This behavior, however, can be adjusted with an option. It makes more sense not to "reverse" by default, as the "reverse" behavior can be easily reproduced using `repeat` and `sequence` (enough to make a sequence that is the animation and its reverse). The second argument for this change is that the automatic reverse does not work in most of the cases and can only be applied to plain animations that can be directly modified by us (we need to change animation settings to make it animate to a different target value). For compatibility we are keeping `loop` that defaults to call `repeat` with `reverse: true` but also warns that the method is deprecated. We also removed `loop` from the documentation and added docs for `repeat` and `sequence`.

One other change I made in reverse is that I removed the workaround for broken default value of function parameter (with a corresponding todo). This seem to no longer be an issue, not sure if the actual resolution of this problem is due to some change in the plugin or to refactor that allowed for animations to be started from main JS thread.

Last minor change I made to make examples work is to fix `withTiming` reuse scheme. Now we compare `toValue` before we decide whether we reuse current timing or start a new one. This approach had a problem when the animation was already done. In that case we want to start the new animation each time. To fix that, I reset `startTime` when the animation reaches the end.

In this PR I also fixed a problem with missing 'worklet' directive in some of the Easing method. This change also triggered prettier reformatting.

# Testing

I tested this change by running a number of loop examples. One sample I tested in particular is when we implement a wobble effect (animate rotation starting from 0, then lean left a bit and then do a couple of oscillations before coming back to 0).

```
const ANGLE = 10;
rotation.value = sequence(
  withTiming(-ANGLE, { duration: 50 }),
  loop(
    sequence(
      withTiming(ANGLE, { duration: 100 }),
      withTiming(-ANGLE, { duration: 100 })
    ),
    10
  ),
  withTiming(0, { duration: 50 })
);
```
…ftware-mansion#987)

The commit message really says it all: remove the undefined (and unused) toValue variable from withDecay.
Update info about:
 - useTurboModule step on Android (We no longer use TurboModuleManager on Android)
 - The constructor signature of TurboModuleManager  has changed on iOS
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.10 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.10...4.17.19)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.15...4.17.19)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@renanmav renanmav merged commit b2d9bb0 into renanmav:v2-types Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants