remove RAF in transitionend
This commit is contained in:
parent
03653601d8
commit
cfdad61058
@ -121,7 +121,6 @@ const useAway =(inRef:React.Ref<HTMLElement>, handleAway:Handler)=>
|
||||
, []);
|
||||
};
|
||||
|
||||
|
||||
type StyleSize = [classes:string, width:number, height:number];
|
||||
type StylePack = Record<string, string>;
|
||||
type StyleCalc = Record<string, StyleSize>;
|
||||
@ -171,12 +170,9 @@ export function Collapser(inElement:HTMLElement, initialState:string, library:Re
|
||||
}
|
||||
else
|
||||
{
|
||||
frameRequest = requestAnimationFrame(()=>
|
||||
{
|
||||
inElement.setAttribute("style", "");
|
||||
inTransition = false;
|
||||
userDone(userMode);
|
||||
});
|
||||
inElement.setAttribute("style", "");
|
||||
inTransition = false;
|
||||
userDone(userMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -199,19 +195,19 @@ export function Collapser(inElement:HTMLElement, initialState:string, library:Re
|
||||
|
||||
if(measurements)
|
||||
{
|
||||
const [classes, width, height] = measurements[inState] as StyleSize;
|
||||
const oldWidth = inElement.offsetWidth;
|
||||
const oldHeight = inElement.offsetHeight;
|
||||
inElement.style.width = oldWidth + "px";
|
||||
inElement.style.height = oldHeight + "px";
|
||||
inTransition = true;
|
||||
const [classes, width, height] = measurements[inState] as StyleSize;
|
||||
const oldWidth = inElement.offsetWidth;
|
||||
const oldHeight = inElement.offsetHeight;
|
||||
inElement.style.width = oldWidth + "px";
|
||||
inElement.style.height = oldHeight + "px";
|
||||
inTransition = true;
|
||||
|
||||
frameRequest = requestAnimationFrame(()=>
|
||||
{
|
||||
inElement.style.height = height + "px";
|
||||
inElement.style.width = width + "px";
|
||||
inElement.className = classes;
|
||||
});
|
||||
frameRequest = requestAnimationFrame(()=>
|
||||
{
|
||||
inElement.style.height = height + "px";
|
||||
inElement.style.width = width + "px";
|
||||
inElement.className = classes;
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user