Transition: Revert some changes
This commit is contained in:
parent
93e9b17e44
commit
00caec5a31
@ -126,7 +126,6 @@ function Transition({
|
|||||||
const keys = Object.keys(rendersRef.current).map(Number);
|
const keys = Object.keys(rendersRef.current).map(Number);
|
||||||
const prevActiveIndex = renderCount ? prevActiveKey : keys.indexOf(prevActiveKey);
|
const prevActiveIndex = renderCount ? prevActiveKey : keys.indexOf(prevActiveKey);
|
||||||
const activeIndex = renderCount ? activeKey : keys.indexOf(activeKey);
|
const activeIndex = renderCount ? activeKey : keys.indexOf(activeKey);
|
||||||
const nextIndex = nextKey ? (renderCount ? nextKey : keys.indexOf(nextKey)) : -1;
|
|
||||||
|
|
||||||
const childNodes = Array.from(container.childNodes);
|
const childNodes = Array.from(container.childNodes);
|
||||||
if (!childNodes.length) {
|
if (!childNodes.length) {
|
||||||
@ -143,21 +142,22 @@ function Transition({
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!activeKeyChanged) {
|
if (!activeKeyChanged) {
|
||||||
const activeChild = childNodes[activeIndex];
|
if (childElements.length === 1 || (nextKey !== undefined && childElements.length === 2)) {
|
||||||
if (activeChild instanceof HTMLElement) {
|
const firstChild = childNodes[activeIndex] as HTMLElement;
|
||||||
addExtraClass(activeChild, CLASSES.active);
|
|
||||||
|
addExtraClass(firstChild, CLASSES.active);
|
||||||
|
|
||||||
if (isSlideOptimized) {
|
if (isSlideOptimized) {
|
||||||
setExtraStyles(activeChild, {
|
setExtraStyles(firstChild, {
|
||||||
transition: 'none',
|
transition: 'none',
|
||||||
transform: 'translate3d(0, 0, 0)',
|
transform: 'translate3d(0, 0, 0)',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const nextChild = nextIndex !== -1 && nextIndex !== activeIndex && childNodes[nextIndex] as HTMLElement;
|
if (childElements.length === 2) {
|
||||||
if (nextChild instanceof HTMLElement) {
|
const nextChild = childElements[0] === firstChild ? childElements[1] : childElements[0];
|
||||||
addExtraClass(nextChild, CLASSES.inactive);
|
addExtraClass(nextChild, CLASSES.inactive);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user