question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Web] Keyframe does not work on the web

See original GitHub issue

Description

example in doc https://docs.swmansion.com/react-native-reanimated/docs/api/LayoutAnimations/keyframeAnimations#example, does not work on web (no animation).

but work fine in native platform.

export function KeyframeAnimation(): React.ReactElement {
  const [show, setShow] = useState(false);

  const enteringAnimation = new Keyframe({
    0: {
      originX: 50,
      transform: [{ rotate: '45deg' }],
    },
    30: {
      originX: 10,
      transform: [{ rotate: '-90deg' }],
    },
    100: {
      originX: 0,
      transform: [{ rotate: '0deg' }],
      easing: Easing.quad,
    },
  }).duration(2000);

  const exitingAnimation = new Keyframe({
    0: {
      opacity: 1,
      transform: [{ skewX: '0deg' }],
    },
    30: {
      opacity: 0.5,
      transform: [{ skewX: '40deg' }],
      easing: Easing.exp,
    },
    100: {
      opacity: 0,
      transform: [{ skewX: '-10deg' }],
    },
  }).duration(2000);
  
  return (
    <View style={{ flexDirection: 'column-reverse' }}>
      <Button
        title="animate"
        onPress={() => {
          setShow((last) => !last);
        }}
      />
      <View
        style={{ height: 400, alignItems: 'center', justifyContent: 'center' }}>
        {show && (
            <Animated.View
              entering={enteringAnimation}
              exiting={exitingAnimation}
              style={{
                height: 100,
                width: 200,
                backgroundColor: 'blue',
                alignItems: 'center',
                justifyContent: 'center',
              }}
            />
        )}
      </View>
    </View>
  );
}

Steps to reproduce

copy code in project and run

Snack or a link to a repository

no

Reanimated version

2.9.0

React Native version

0.69.0

Platforms

Web

JavaScript runtime

No response

Workflow

No response

Architecture

No response

Build type

No response

Device

No response

Device model

No response

Acknowledgements

Yes

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
TNAJanssencommented, Nov 27, 2022

Yeah this feature would be really nice!

1reaction
tomekzawcommented, Sep 11, 2022

Any plans to add layout animations for web?

Yes, but first we need to finish refactoring Layout Animations for Android & iOS which is currently in progress.

Also it might be a good idea to add a blurb to https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support to explain that it’s not supported at this time.

That’s right, thanks for the suggestion!

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS Animations Not Working? Try These Fixes - HubSpot Blog
Learn how to fix common CSS animation error and get your animations looking how you want them.
Read more >
CSS @keyframes not working in Chrome - Stack Overflow
I have tried to use @-webkit-keyframes but the text doesn't move either in Chrome. It works fine with -webkit-keyframes and -webkit-animation .
Read more >
3 Ways to Fix Keyframes if not Working in Firefox
How do I fix keyframes if they are not working in Firefox? · 1. Double-check the code · 2. Set animation duration ·...
Read more >
Keyframe animation not working in Safari? - HTML & CSS
I have a keyframe animation that works just fine in firefox and chrome, but wont start in Safari for some reason. Here is...
Read more >
[Solved] Safari does not accept - CSS-Tricks
So yesterday, the website was working properly only under Firefox. Today I added the -webkit- vendor prefix for the keyframes and animations, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found