mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 16:59:41 +00:00
[Glitch] Update to latest eslint-plugin-react-hooks
Port 9addad8ce5 to glitch-soc
Co-authored-by: diondiondion <mail@diondiondion.com>
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -27,22 +27,23 @@ export const ExitAnimationWrapper: React.FC<{
|
||||
*/
|
||||
children: (delayedIsActive: boolean) => React.ReactNode;
|
||||
}> = ({ isActive = false, delayMs = 500, withEntryDelay, children }) => {
|
||||
const [delayedIsActive, setDelayedIsActive] = useState(false);
|
||||
const [delayedIsActive, setDelayedIsActive] = useState(
|
||||
isActive && !withEntryDelay,
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (isActive && !withEntryDelay) {
|
||||
setDelayedIsActive(true);
|
||||
const withDelay = !isActive || withEntryDelay;
|
||||
|
||||
return () => '';
|
||||
} else {
|
||||
const timeout = setTimeout(() => {
|
||||
const timeout = setTimeout(
|
||||
() => {
|
||||
setDelayedIsActive(isActive);
|
||||
}, delayMs);
|
||||
},
|
||||
withDelay ? delayMs : 0,
|
||||
);
|
||||
|
||||
return () => {
|
||||
clearTimeout(timeout);
|
||||
};
|
||||
}
|
||||
return () => {
|
||||
clearTimeout(timeout);
|
||||
};
|
||||
}, [isActive, delayMs, withEntryDelay]);
|
||||
|
||||
if (!isActive && !delayedIsActive) {
|
||||
|
||||
Reference in New Issue
Block a user