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

[Web LA] Remove existingTransform #6060

Merged
merged 1 commit into from
May 29, 2024
Merged

[Web LA] Remove existingTransform #6060

merged 1 commit into from
May 29, 2024

Conversation

m-bert
Copy link
Contributor

@m-bert m-bert commented May 28, 2024

Summary

A while ago I've noticed that layout animations on mobile throw warning if one tries to add animation into View that has transform property. Now, while working on #5277 I've decided to remove code responsible for applying existing transform on web. Here are the reasons why I believe it is good idea:

  1. It unifies behavior with mobile platforms, which are main target of reanimated.
  2. Some of transforms were not applied correctly and required additional calculations to be implemented (like skew).
  3. Removing existing transforms means removing a lot of ifs and unnecessary code.

Test plan

Tested on example app on LA examples.

@m-bert m-bert requested a review from piaskowyk May 28, 2024 15:18
@m-bert m-bert added this pull request to the merge queue May 29, 2024
Merged via the queue into main with commit 98646b3 May 29, 2024
8 checks passed
@m-bert m-bert deleted the @mbert/remove-transform-LA branch May 29, 2024 13:30
renovate bot referenced this pull request in GSTJ/react-native-magic-modal Jun 3, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[react-native-reanimated](https://github.com/software-mansion/react-native-reanimated)
| [`~3.11.0` ->
`~3.12.0`](https://renovatebot.com/diffs/npm/react-native-reanimated/3.11.0/3.12.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/react-native-reanimated/3.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-native-reanimated/3.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-native-reanimated/3.11.0/3.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-native-reanimated/3.11.0/3.12.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>software-mansion/react-native-reanimated
(react-native-reanimated)</summary>

###
[`v3.12.0`](https://github.com/software-mansion/react-native-reanimated/releases/tag/3.12.0)

[Compare
Source](https://github.com/software-mansion/react-native-reanimated/compare/3.11.0...3.12.0)

#### What's Changed

- Give more meaningful warning when modifying a Shareable by
[@&#8203;tjzel](https://github.com/tjzel) in
[https://github.com/software-mansion/react-native-reanimated/pull/5548](https://github.com/software-mansion/react-native-reanimated/pull/5548)
- Make animated components use different tags for events by
[@&#8203;szydlovsky](https://github.com/szydlovsky) in
[https://github.com/software-mansion/react-native-reanimated/pull/5960](https://github.com/software-mansion/react-native-reanimated/pull/5960)
- Add `warning` and `failing` test decorators by
[@&#8203;Latropos](https://github.com/Latropos) in
[https://github.com/software-mansion/react-native-reanimated/pull/5929](https://github.com/software-mansion/react-native-reanimated/pull/5929)
- Update useAnimatedKeyboard docs by
[@&#8203;maciekstosio](https://github.com/maciekstosio) in
[https://github.com/software-mansion/react-native-reanimated/pull/5866](https://github.com/software-mansion/react-native-reanimated/pull/5866)
- Change the docs to mention, that `.springify()` works with
`.duration()` by [@&#8203;Latropos](https://github.com/Latropos) in
[https://github.com/software-mansion/react-native-reanimated/pull/5990](https://github.com/software-mansion/react-native-reanimated/pull/5990)
- \[Android]\[Keyboard] More consistent inequality check to compute
keyboard state by [@&#8203;antFrancon](https://github.com/antFrancon)
in
[https://github.com/software-mansion/react-native-reanimated/pull/5874](https://github.com/software-mansion/react-native-reanimated/pull/5874)
- fix typo on object key for `targetValues` in custom-animations.mdx by
[@&#8203;JDMathew](https://github.com/JDMathew) in
[https://github.com/software-mansion/react-native-reanimated/pull/5994](https://github.com/software-mansion/react-native-reanimated/pull/5994)
- Remove outdated code for unsupported React Native versions by
[@&#8203;tomekzaw](https://github.com/tomekzaw) in
[https://github.com/software-mansion/react-native-reanimated/pull/5979](https://github.com/software-mansion/react-native-reanimated/pull/5979)
- Remove REAInitializer by
[@&#8203;tomekzaw](https://github.com/tomekzaw) in
[https://github.com/software-mansion/react-native-reanimated/pull/5681](https://github.com/software-mansion/react-native-reanimated/pull/5681)
- Prevent crash on non-existent view updates in Android by
[@&#8203;thomas-rx](https://github.com/thomas-rx) in
[https://github.com/software-mansion/react-native-reanimated/pull/5767](https://github.com/software-mansion/react-native-reanimated/pull/5767)
- Fix location after shared element transition by
[@&#8203;piaskowyk](https://github.com/piaskowyk) in
[https://github.com/software-mansion/react-native-reanimated/pull/6010](https://github.com/software-mansion/react-native-reanimated/pull/6010)
- Make `useScrollviewOffset` ref nullable and simplify its code by
[@&#8203;szydlovsky](https://github.com/szydlovsky) in
[https://github.com/software-mansion/react-native-reanimated/pull/6009](https://github.com/software-mansion/react-native-reanimated/pull/6009)
- fix: use proper classes for bridgeless by
[@&#8203;WoLewicki](https://github.com/WoLewicki) in
[https://github.com/software-mansion/react-native-reanimated/pull/5997](https://github.com/software-mansion/react-native-reanimated/pull/5997)
- docs: add
[@&#8203;swmansion/t-rex-ui](https://github.com/swmansion/t-rex-ui) by
[@&#8203;patrycjakalinska](https://github.com/patrycjakalinska) in
[https://github.com/software-mansion/react-native-reanimated/pull/6015](https://github.com/software-mansion/react-native-reanimated/pull/6015)
- Remove `CellRendererComponent` from Animated.FlatList props by
[@&#8203;Latropos](https://github.com/Latropos) in
[https://github.com/software-mansion/react-native-reanimated/pull/5951](https://github.com/software-mansion/react-native-reanimated/pull/5951)
- Add `useComposedEventHandler` hook by
[@&#8203;szydlovsky](https://github.com/szydlovsky) in
[https://github.com/software-mansion/react-native-reanimated/pull/5890](https://github.com/software-mansion/react-native-reanimated/pull/5890)
- Align handling colors with RN by
[@&#8203;maciekstosio](https://github.com/maciekstosio) in
[https://github.com/software-mansion/react-native-reanimated/pull/5825](https://github.com/software-mansion/react-native-reanimated/pull/5825)
- Add more tests - useSharedValue, useAnimatedStyle , useDerivedValue by
[@&#8203;Latropos](https://github.com/Latropos) in
[https://github.com/software-mansion/react-native-reanimated/pull/5981](https://github.com/software-mansion/react-native-reanimated/pull/5981)
- Make animation RollInLeft work with modifers by
[@&#8203;Latropos](https://github.com/Latropos) in
[https://github.com/software-mansion/react-native-reanimated/pull/6039](https://github.com/software-mansion/react-native-reanimated/pull/6039)
- Test predefined entering animation by
[@&#8203;Latropos](https://github.com/Latropos) in
[https://github.com/software-mansion/react-native-reanimated/pull/5995](https://github.com/software-mansion/react-native-reanimated/pull/5995)
- Tests: cancelAnimation, useFrameCallback, measure, withDecay by
[@&#8203;Latropos](https://github.com/Latropos) in
[https://github.com/software-mansion/react-native-reanimated/pull/6016](https://github.com/software-mansion/react-native-reanimated/pull/6016)
- docs: fix useAnimatedKeyboard page crash by
[@&#8203;patrycjakalinska](https://github.com/patrycjakalinska) in
[https://github.com/software-mansion/react-native-reanimated/pull/6056](https://github.com/software-mansion/react-native-reanimated/pull/6056)
- \[Web LA] Remove `existingTransform` by
[@&#8203;m-bert](https://github.com/m-bert) in
[https://github.com/software-mansion/react-native-reanimated/pull/6060](https://github.com/software-mansion/react-native-reanimated/pull/6060)

#### New Contributors

[@&#8203;antFrancon](https://github.com/antFrancon),
[@&#8203;JDMathew](https://github.com/JDMathew),
[@&#8203;thomas-rx](https://github.com/thomas-rx),
[@&#8203;exploIF](https://github.com/exploIF)

#### 🙌 Thank you for your contributions!

**Full Changelog**:
software-mansion/react-native-reanimated@3.11.0...3.12.0

Package build:
https://github.com/software-mansion/react-native-reanimated/actions/runs/9287839734

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/GSTJ/react-native-magic-modal).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNzcuOCIsInVwZGF0ZWRJblZlciI6IjM3LjM3Ny44IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Jun 14, 2024
## Summary

In #6060 I've removed adding already existing transform into layout
animations on web (you can read more about reasoning in the mentioned
PR). This PR adds `warning` for users that suggests creating animated
wrapper if `Animated.View` with layout animation contains `transform` in
`style`.

## Test plan

Tested on example app (`MountingUnmounting` example) and on the
following code:

<details>
<summary> Test code </summary>

```jsx
import { StyleSheet, View } from 'react-native';
import React from 'react';
import Animated, { LightSpeedInLeft } from 'react-native-reanimated';

export default function EmptyExample() {
  return (
    <View style={styles.container}>
      <Animated.View
        entering={LightSpeedInLeft.duration(2500)}
        style={{
          width: 100,
          height: 100,
          backgroundColor: 'crimson',
          transform: [{ skewX: '25deg' }],
        }}
      />
    </View>
  );
}

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

</details>
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.

2 participants