You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.6 KiB
43 lines
1.6 KiB
import { Linking, Pressable, StyleSheet, Text, View } from 'react-native';
|
|
import { colors, spacing } from '../../../src/theme';
|
|
import { SUPERVISION_PHONE, SUPPORT_HOTLINE } from '../../../src/constants';
|
|
|
|
/**
|
|
* 合规页脚:服务热线 / 举报监督电话。
|
|
*
|
|
* 原先是三行纯文本,没号码也没点击反馈(P1 与 P2Q 各复制一份)。
|
|
* 这里改为读常量:**号码未配置时整块不渲染** —— 号码属于真实主体信息,
|
|
* 编一个摆上去就是假数据。填入 `SUPPORT_HOTLINE` / `SUPERVISION_PHONE` 后
|
|
* 页脚自动出现并支持点击拨号。
|
|
*/
|
|
export function SupportFooter() {
|
|
const items = [
|
|
{ key: 'hotline', label: '服务热线', phone: SUPPORT_HOTLINE },
|
|
{ key: 'supervision', label: '举报监督电话', phone: SUPERVISION_PHONE },
|
|
].filter((item) => item.phone !== '');
|
|
|
|
if (items.length === 0) return null;
|
|
|
|
/** 设备不支持 tel:(如平板 / 模拟器)时 openURL 会 reject,不弹未捕获异常 */
|
|
const call = (phone: string) => {
|
|
void Linking.openURL(`tel:${phone}`).catch(() => undefined);
|
|
};
|
|
|
|
return (
|
|
<View style={styles.row}>
|
|
{items.map((item) => (
|
|
<Pressable key={item.key} onPress={() => call(item.phone)} hitSlop={6}>
|
|
<Text style={styles.item}>
|
|
{item.label} {item.phone}
|
|
</Text>
|
|
</Pressable>
|
|
))}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
// 两串「标签 + 11 位号码」在窄屏上会挤,允许换行
|
|
row: { flexDirection: 'row', flexWrap: 'wrap', justifyContent: 'center', gap: spacing.block },
|
|
item: { fontSize: 12, color: colors.textHint },
|
|
});
|
|
|