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

Animations flickering in React 18 #108

Open
rvision opened this issue Sep 9, 2022 · 2 comments
Open

Animations flickering in React 18 #108

rvision opened this issue Sep 9, 2022 · 2 comments

Comments

@rvision
Copy link

rvision commented Sep 9, 2022

When I changed code from ReactDOM.render to root.render, all animations appear buggy. Like element exists on the page and then dissapears.

Anyone faced this issue?

@rvision
Copy link
Author

rvision commented Sep 9, 2022

sass file:

@import '@animxyz/core';

@include xyz-all;

:root {
	--xyz-duration-default: 0.2s
}

animation wrapper components:

import { XyzTransition } from '@animxyz/react';

const Animate = () => {
	return <>Invalid animation</>;
};

Animate.FadeIn = ({ children }) => {
	return (
		<XyzTransition appear xyz="fade">
			{children}
		</XyzTransition>
	);
};

Animate.ZoomIn = ({ children }) => {
	return (
		<XyzTransition appear xyz="fade small-100%">
			{children}
		</XyzTransition>
	);
};

Animate.EnterLeft = ({ children }) => {
	return (
		<XyzTransition appear xyz="fade left duration-5s">
			{children}
		</XyzTransition>
	);
};

Animate.EnterRight = ({ children }) => {
	return (
		<XyzTransition appear xyz="fade right duration-5s">
			{children}
		</XyzTransition>
	);
};

export default Animate;

I am puzzled since all of this works properly when initializing the app with ReactDOM.render, but I get a warning for React 18 that rendering should be done with root.render

@rvision
Copy link
Author

rvision commented Sep 9, 2022

<React.StrictMode> causes this: when I remove it, all works properly

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

1 participant