From 41482bccb3facbad82b0c2d9832858a0dfc1a01e Mon Sep 17 00:00:00 2001 From: Stephen Zhou <38493346+hyoban@users.noreply.github.com> Date: Mon, 30 Jun 2025 15:18:59 +0800 Subject: [PATCH] refactor(mobile): clean set page logic --- apps/mobile/src/components/native/PagerView/index.tsx | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/apps/mobile/src/components/native/PagerView/index.tsx b/apps/mobile/src/components/native/PagerView/index.tsx index 564f0de47..ee958961d 100644 --- a/apps/mobile/src/components/native/PagerView/index.tsx +++ b/apps/mobile/src/components/native/PagerView/index.tsx @@ -1,7 +1,7 @@ import { cn } from "@follow/utils" import { cssInterop } from "nativewind" import type { FC, ReactNode, Ref } from "react" -import { useEffect, useImperativeHandle, useRef, useState } from "react" +import { useImperativeHandle, useRef, useState } from "react" import type { StyleProp, ViewStyle } from "react-native" import { StyleSheet } from "react-native" @@ -50,14 +50,6 @@ export const PagerView: FC = ({ const [currentPage, setCurrentPage] = useState(page ?? 0) const nativeRef = useRef(null) - useEffect(() => { - if (nativeRef.current) { - const state = nativeRef.current.getState() - if (state === "idle" && currentPage !== nativeRef.current.getPage()) { - nativeRef.current.setPage(currentPage) - } - } - }, [currentPage]) useImperativeHandle(ref, () => ({ setPage: (index: number) => { setCurrentPage(index)