添加选择过度

This commit is contained in:
张成
2025-11-09 23:29:17 +08:00
parent 9801968af2
commit 649898e346
3 changed files with 24 additions and 7 deletions

View File

@@ -63,6 +63,7 @@ const ListPage = () => {
// 滚动相关状态
const scrollContextRef = useRef(null);
const scrollViewRef = useRef(null); // ScrollView 的 ref
const scrollTimeoutRef = useRef<NodeJS.Timeout | null>(null);
const lastScrollTopRef = useRef(0);
const scrollDirectionRef = useRef<'up' | 'down' | null>(null);
@@ -70,6 +71,7 @@ const ListPage = () => {
const loadingMoreRef = useRef(false); // 防止重复加载更多
const scrollStartPositionRef = useRef(0); // 记录开始滚动的位置
const [showSearchBar, setShowSearchBar] = useState(true); // 控制搜索框显示/隐藏(筛选始终显示)
const [scrollTop, setScrollTop] = useState(0); // 控制 ScrollView 滚动位置
// 动态控制 GuideBar 的 z-index
const [guideBarZIndex, setGuideBarZIndex] = useState<'low' | 'high'>('high');
@@ -92,6 +94,12 @@ const ListPage = () => {
setIsCityPickerVisible(visible);
}, []);
// 滚动到顶部的方法
const scrollToTop = useCallback(() => {
// 使用一个唯一值触发 scrollTop 更新,确保每次都能滚动到顶部
setScrollTop(prev => prev === 0 ? 0.1 : 0);
}, []);
// 监听所有弹窗和菜单的状态,动态调整 GuideBar 的 z-index
useEffect(() => {
if (isPublishMenuVisible) {
@@ -432,6 +440,7 @@ const ListPage = () => {
showInput: isShowInputCustomerNavBar,
}}
onCityPickerVisibleChange={handleCityPickerVisibleChange}
onScrollToTop={scrollToTop}
/>
{area_city !== "上海" ? (
renderCityQrcode()
@@ -485,7 +494,9 @@ const ListPage = () => {
{/* 可滚动的列表内容 */}
<ScrollView
ref={scrollViewRef}
scrollY
scrollTop={scrollTop}
className={styles.listScrollView}
scrollWithAnimation
enhanced