import { useState } from 'react'; import { Ionicons } from '@expo/vector-icons'; import { Pressable, StyleSheet, Text, View } from 'react-native'; import { colors } from '../../../src/theme'; import { useOnboarding } from '../../../src/hooks'; import { ScreenShell } from '../ui/ScreenShell'; import { SearchInput } from '../ui/SearchInput'; import { Tag, TagGroup } from '../ui/Tag'; const ALL = ['北京', '上海', '广州', '深圳', '杭州', '成都', '南京', '武汉', '西安', '苏州', '天津', '重庆', '青岛', '长沙', '郑州', '东莞']; const HOT = ['北京', '上海', '广州', '深圳', '杭州', '成都']; export function P5City() { const { data, setData, back, meta } = useOnboarding(); const [query, setQuery] = useState(''); const pick = (city: string) => { setData({ city }); back(); }; const list = query ? ALL.filter((c) => c.includes(query)) : ALL; return ( setQuery('')} /> pick('上海')}> 自动定位:上海 热门城市 {HOT.map((c) => ( pick(c)} /> ))} 全部城市 {list.map((c) => ( pick(c)}> {c} {data.city === c ? : null} ))} ); } const styles = StyleSheet.create({ locate: { flexDirection: 'row', alignItems: 'center', gap: 8, paddingVertical: 14, marginTop: 12 }, locateText: { fontSize: 14, fontWeight: '600', color: colors.primaryText }, section: { fontSize: 14, fontWeight: '700', color: colors.textPrimary, marginTop: 22, marginBottom: 12 }, list: { gap: 2 }, cityItem: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingVertical: 13, borderBottomWidth: 1, borderColor: colors.borderLight, }, cityName: { fontSize: 15, color: colors.textPrimary }, cityNameActive: { color: colors.primary, fontWeight: '700' }, });