Skip to content

Commit

Permalink
Ignore layout animation props on web (software-mansion#3714)
Browse files Browse the repository at this point in the history
## Description

Fixes software-mansion#3464.

Currently, Layout Animations are implemented only on Android and iOS.

Using `Animated.View` with `entering`, `layout` or `exiting` prop on web
should be a no-op, but instead it throws the following error:

```
TypeError: e.LayoutAnimationRepository is undefined
    t createAnimatedComponent.js:151
    setLocalRef createAnimatedComponent.js:149
    default setAndForwardRef.js:7
    r index.js:22
```

In this PR I've changed the implementation of `createAnimatedComponent`
to disable configuration of layout animation on web, in particular to
avoid calling `global.LayoutAnimationRepository.registerConfig(tag,
config);`.
  • Loading branch information
tomekzaw authored and fluiddot committed Jun 5, 2023
1 parent 7c0a3b5 commit 6cace45
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/createAnimatedComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,11 @@ export default function createAnimatedComponent(
// TODO update config
const tag = findNodeHandle(ref);
if (
!shouldBeUseWeb() &&
(this.props.layout || this.props.entering || this.props.exiting) &&
tag != null
) {
if (!shouldBeUseWeb()) {
enableLayoutAnimations(true, false);
}
enableLayoutAnimations(true, false);
let layout = this.props.layout ? this.props.layout : DefaultLayout;
let entering = this.props.entering
? this.props.entering
Expand Down

0 comments on commit 6cace45

Please sign in to comment.