Skip to content

Commit

Permalink
fix: feed list can switch view, fix RSSNext#278
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Sep 7, 2024
1 parent 5f61579 commit 76a33b6
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions src/renderer/src/modules/feed-column/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@ export function FeedColumn({ children }: PropsWithChildren) {
</ActionButton>
))}
</div>
<div className="relative flex size-full overflow-hidden" ref={carouselRef}>
<div
className="relative flex size-full overflow-hidden"
ref={carouselRef}
>
<SwipeWrapper active={active}>
{views.map((item, index) => (
<section
Expand Down Expand Up @@ -207,21 +210,6 @@ const SwipeWrapper: FC<{
const feedColumnWidth = useUISettingKey("feedColWidth")
const containerRef = useRef<HTMLDivElement>(null)

// useLayoutEffect(() => {
// const $container = containerRef.current;
// if (!$container) return;

// const x = -active * feedColumnWidth;
// // NOTE: To fix the misalignment of the browser's layout, use display to re-render it.
// if (x !== $container.getBoundingClientRect().x) {
// $container.style.display = "none";

// nextFrame(() => {
// $container.style.display = "";
// });
// }
// }, []);

const prevActiveIndexRef = useRef(-1)
const [isReady, setIsReady] = useState(false)

Expand All @@ -248,7 +236,14 @@ const SwipeWrapper: FC<{
}, [active])

if (reduceMotion) {
return <div ref={containerRef}>{children}</div>
return (
<div
ref={containerRef}

>
{children[currentAnimtedActive]}
</div>
)
}

return (
Expand Down

0 comments on commit 76a33b6

Please sign in to comment.