优化城市选择死循环

This commit is contained in:
2025-11-19 16:53:40 +08:00
parent 5ecb352d1b
commit 07c41e7fa9

View File

@@ -60,17 +60,32 @@ function CityPicker(props) {
*/
const HomeNavbar = (props: IProps) => {
const { config, onCityPickerVisibleChange, onScrollToTop } = props;
const { showInput = false, inputLeftIcon, leftIconClick, title, showTitle = false } = config || {};
const {
showInput = false,
inputLeftIcon,
leftIconClick,
title,
showTitle = false,
} = config || {};
const { getLocationLoading, statusNavbarHeightInfo } = useGlobalState();
const { gamesNum, searchValue, cities, area, updateArea, fetchGetGamesCount, refreshBothLists } = useListState();
const { statusBarHeight = 0, navBarHeight = 44 } = statusNavbarHeightInfo || {};
const {
gamesNum,
searchValue,
cities,
area,
updateArea,
fetchGetGamesCount,
refreshBothLists,
} = useListState();
const { statusBarHeight = 0, navBarHeight = 44 } =
statusNavbarHeightInfo || {};
const [cityPopupVisible, setCityPopupVisible] = useState(false);
// 监听城市选择器状态变化,通知父组件
useEffect(() => {
onCityPickerVisibleChange?.(cityPopupVisible);
}, [cityPopupVisible, onCityPickerVisibleChange]);
}, [cityPopupVisible]);
const userInfo = useUserInfo();
const province = (userInfo as any)?.province || "";
@@ -148,13 +163,13 @@ const HomeNavbar = (props: IProps) => {
<View
className="homeNavbar"
style={{
position: 'fixed',
position: "fixed",
top: 0,
left: 0,
width: '100%',
width: "100%",
height: `${navBarHeight}px`,
paddingTop: `${statusBarHeight}px`,
backgroundColor: 'transparent',
backgroundColor: "transparent",
zIndex: 99,
}}
>