Skip to content

Fix createAnimatedStyle when providing undefined transform style - #41176

Closed
gabrieldonadel wants to merge 3 commits into
react:mainfrom
gabrieldonadel:fix-create-animated-style-transform-undefined
Closed

Fix createAnimatedStyle when providing undefined transform style#41176
gabrieldonadel wants to merge 3 commits into
react:mainfrom
gabrieldonadel:fix-create-animated-style-transform-undefined

Conversation

@gabrieldonadel

Copy link
Copy Markdown
Collaborator

Summary:

#35198 introduced a regression where if an {transform: undefined} style is provided to an Animated View a Cannot read property 'map' of undefined type error is thrown

Changelog:

[GENERAL] [FIXED] - Fix createAnimatedStyle when providing an undefined transform style

Test Plan:

Render an `Animated.View` passing `style={{transform: undefined}}`

E.g.

const UndefinedTransform = () => {
return (
<View>
<Animated.View style={{transform: undefined}} />
</View>
);
}; 

RNTester

  1. Open the RNTester app and navigate to the Animated page
  2. Navigate to the Transform Styles page
  3. App should not throw any errors
BeforeAfter
Screen.Recording.2023-10-24.at.14.29.12.mov
Screen.Recording.2023-10-24.at.14.30.30.mov

@facebook-github-botfacebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Oct 24, 2023
Comment threadpackages/react-native/Libraries/Animated/nodes/AnimatedStyle.js Outdated
Co-authored-by: Pieter De Baets <pieter.debaets@gmail.com>
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@javache has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@github-actions

Copy link
Copy Markdown

This pull request was successfully merged by @gabrieldonadel in 7e26e02.

When will my fix make it into a release? | Upcoming Releases

@github-actionsgithub-actionsBot added the Merged This PR has been merged. label Oct 25, 2023
@gabrieldonadel
gabrieldonadel deleted the fix-create-animated-style-transform-undefined branch October 25, 2023 13:42
lunaleaps pushed a commit that referenced this pull request Nov 3, 2023
…41176)
Summary:
#35198 introduced a regression where if an `{transform: undefined}` style is provided to an Animated View a `Cannot read property 'map' of undefined` type error is thrown
<img src="https://github.com/facebook/react-native/assets/11707729/bb87781e-1ba7-40ec-879d-a57cef3e10d9" height="200" />
## Changelog:
[GENERAL] [FIXED] - Fix `createAnimatedStyle` when providing an undefined transform style
Pull Request resolved: #41176
Test Plan:
<details>
<summary>Render an `Animated.View` passing `style={{transform: undefined}}`</summary>
E.g.
```
const UndefinedTransform = () => {
return (
<View>
<Animated.View style={{transform: undefined}} />
</View>
);
};
```
</details>
### RNTester
1. Open the RNTester app and navigate to the Animated page
2. Navigate to the Transform Styles page
3. App should not throw any errors
<table>
<tr><th>Before</th><th>After</th></tr>
<tr>
<td><video src="https://github.com/facebook/react-native/assets/11707729/92ba9c3b-60b0-4805-8080-0e7fb7c00345"/></td>
<td><video src="https://github.com/facebook/react-native/assets/11707729/80e2bba8-6ff6-4cf5-bcb8-26de0b869036"/></td>
</tr>
</table>
Reviewed By: fabriziocucci
Differential Revision: D50638415
Pulled By: javache
fbshipit-source-id: 0ee949f019a77b8bef557888694e0e8404810105
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.MergedThis PR has been merged.p: ExpoPartner: ExpoPartnerShared with MetaApplied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@gabrieldonadel@facebook-github-bot@javache