| | |
| | | setIsAdsorbed: (value: boolean) => void; |
| | | }; |
| | | |
| | | export default function useCitySwitch() { |
| | | export default function useCitySwitch(currentSelectedCityCode?: string) { |
| | | /** 跳过下次定位居中 */ |
| | | const skipNextLocationCenterRef = useRef(false); |
| | | /** 跳过 selectedCity 变更副作用 */ |
| | |
| | | return null; |
| | | } |
| | | const nextCode = selectedCity.code; |
| | | if (lastSelectedCityCodeRef.current && nextCode && lastSelectedCityCodeRef.current !== nextCode) { |
| | | const previousCode = lastSelectedCityCodeRef.current || currentSelectedCityCode; |
| | | if (previousCode && nextCode && previousCode !== nextCode) { |
| | | isCitySwitchingRef.current = true; |
| | | shouldMoveToSwitchedCityCenterRef.current = true; |
| | | Taro.removeStorageSync('startSite'); |