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