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

No animation inside shadow root #215

Open
msuess opened this issue Sep 7, 2023 · 2 comments
Open

No animation inside shadow root #215

msuess opened this issue Sep 7, 2023 · 2 comments

Comments

@msuess
Copy link

msuess commented Sep 7, 2023

When rendering Flipper and Flipped inside shadow dom, the transformation gets applied to the flipped element but the animation does not start.

See this CodeSandbox.

import React, { useState } from "react";
import ReactDOM from "react-dom";
import { Flipper, Flipped } from "react-flip-toolkit";
import root from "react-shadow";

const AnimatedSquare = () => {
  const [fullScreen, setFullScreen] = useState(false);
  const toggleFullScreen = () => setFullScreen((prevState) => !prevState);

  let style = {
    background: "red",
    width: "200px",
    height: "200px"
  };

  if (fullScreen) {
    style = {
      background: "blue",
      width: "400px",
      height: "400px"
    };
  }

  return (
    <root.div>
      <div style={{ width: "100vw", height: "100vh" }}>
        <Flipper flipKey={fullScreen}>
          <Flipped flipId="square">
            <div style={style} onClick={toggleFullScreen}>
              hi
            </div>
          </Flipped>
        </Flipper>
      </div>
    </root.div>
  );
};

ReactDOM.render(<AnimatedSquare />, document.querySelector("#root"));
@msuess msuess changed the title No animation inside shadow dom No animation inside react-shadow Sep 7, 2023
@ilyasmez
Copy link

ilyasmez commented Sep 7, 2023

Just want to highlight that this is not specific to react-shadow.
The library is not working inside shadow DOM in general.

Would love to know if there is a trick to work around this, or any clues to open a PR to fix it.

@msuess msuess changed the title No animation inside react-shadow No animation inside shadow root Sep 8, 2023
@ilyasmez
Copy link

@aholachek thoughts?

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

No branches or pull requests

2 participants