优化城市选择死循环
This commit is contained in:
@@ -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,
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user