diff --git a/src/components/HomeNavbar/index.tsx b/src/components/HomeNavbar/index.tsx index 6857f21..7c739ac 100644 --- a/src/components/HomeNavbar/index.tsx +++ b/src/components/HomeNavbar/index.tsx @@ -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) => { @@ -167,7 +182,7 @@ const HomeNavbar = (props: IProps) => { )} - + {/* 首页logo 导航*/} {!showTitle && ( { ${!showInput ? "visible" : ""}`} style={navbarStyle} > - - {/* logo */} - - - - - {/* 位置 */} - {area_city} - {!getLocationLoading && area_city && ( - - )} - - - 附近{gamesNum}场球局 + + {/* logo */} + + + + + {/* 位置 */} + {area_city} + {!getLocationLoading && area_city && ( + + )} + + + 附近{gamesNum}场球局 + - )} - + {/* 搜索导航 */} {!showTitle && ( { } ${showInput ? "inputCustomerNavbarShowInput" : ""}`} style={navbarStyle} > - - {/* logo */} - - {/* 搜索框 */} - + + {/* logo */} - + {/* 搜索框 */} + + + + - )} {cityPopupVisible && !showTitle && (