Skip to content

cherry-pick: Layout animations with rotation not working in RN 0.79 #7400

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

Conversation

MatiPl01
Copy link
Member

Summary

This PR cherry-picks #7347

## Summary

This PR fixes issues with rotation transformation after RN upgrade to
0.79. Rotation strings without units are no longer supported so the
`rad` unit must me specified explicitly for them to work.

## Example recordings

### ZoomInRotate / ZoomOutRotate

| Before | After |
|-|-|
| <video
src="https://github.com/user-attachments/assets/93e0fbdc-519c-4b69-b710-045be29a991c"
/> | <video
src="https://github.com/user-attachments/assets/6752842f-8e07-4fb9-831a-33c0978a92bf"
/> |

### PinwheelIn / PinwheelOut

| Before | After |
|-|-|
| <video
src="https://github.com/user-attachments/assets/cb43cbb3-bb54-4a46-8014-22f0db3ba58d"
/> | <video
src="https://github.com/user-attachments/assets/dc45f65f-cc93-41a3-b4a9-b0e06e75143c"
/> |

<details>
<summary>Code snippet</summary>

```tsx
import React, { useState } from 'react';
import { Button, StyleSheet, View } from 'react-native';
import Animated, { PinwheelIn, PinwheelOut } from 'react-native-reanimated';

export default function DeleteAncestorOfExiting() {
  const [shown, setShown] = useState(true);

  return (
    <View style={styles.container}>
      <Button
        onPress={() => {
          setShown(!shown);
        }}
        title="Toggle"
      />
      {shown && (
        <Animated.View
          style={styles.box}
          exiting={PinwheelOut}
          entering={PinwheelIn}
        />
      )}
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    marginTop: 300,
  },
  box: {
    width: 100,
    height: 100,
    backgroundColor: 'red',
  },
});
```
</details>
@MatiPl01 MatiPl01 self-assigned this Apr 15, 2025
Copy link
Contributor

@patrycjakalinska patrycjakalinska left a comment

Choose a reason for hiding this comment

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

🪨

@MatiPl01 MatiPl01 merged commit 7ead635 into 3.17-stable Apr 15, 2025
31 of 40 checks passed
@MatiPl01 MatiPl01 deleted the @matipl01/cherry-pick/fix-layout-animations-with-rotation branch April 15, 2025 15:01
@MatiPl01 MatiPl01 mentioned this pull request Apr 16, 2025
MatiPl01 added a commit that referenced this pull request Apr 16, 2025
## Summary

Included fixes:
- #7376
- #7395
- #7394
- #7400


## Current state

|| Fabric (iOS) | Fabric (Android) | Paper (iOS) | Paper (Android) | Web
| MacOS | TVOS (iOS) | TVOS (android) |
|-|-|-|-|-|-|-|-|-|
| Builds           | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 
| Runs             | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
github-merge-queue bot pushed a commit that referenced this pull request Apr 16, 2025
## Summary

This PR adds missing `3.17.3` version and the new `3.17.4` version to
compatibility tables in docs.

I decided to mark only `3.17.4` as supporting RN 0.79 because of the
issue with some layout animations using rotation values without units
which stopped working on RN 0.79. Here is a PR with the fix: #7400

## Example recordings


https://github.com/user-attachments/assets/8d83fccf-3413-4384-95e6-f95ec375c3d3


https://github.com/user-attachments/assets/96893a75-3f2d-4dff-b314-8f6acb02553d
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.

3 participants