Page 1 of 1

PickerView 组件 设置indicatorStyle 字体颜色 没作用

Posted: 2025年 Sep 11日 17:51
by MwM-Mai

/** 时间选择器(hour / minute / second) */
const TimePickerPanel = ({ label, value, onChange }) => {
const hours = Array.from({ length: 24 }, (, i) => i);
const minutes = Array.from({ length: 60 }, (
, i) => i);
const seconds = Array.from({ length: 60 }, (_, i) => i);

return (
<View className={styles.timePicker}>
<Text className={styles.tpLabel}>{label}</Text>
<PickerView
value={[value.hour, value.minute, value.second]}
style={{ height: '180px', width: '100%' }}
indicatorStyle={{ color: "#095BE3" }}
onChange={(e) => {
const [h, m, s] = e.detail.value;
onChange({ hour: h, minute: m, second: s });
}}
>
<PickerViewColumn>
{hours.map((h) => (
<View key={h} className={styles.pickerItem}>
{h.toString().padStart(2, '0')}
</View>
))}
</PickerViewColumn>
<PickerViewColumn>
{minutes.map((m) => (
<View key={m} className={styles.pickerItem}>
{m.toString().padStart(2, '0')}
</View>
))}
</PickerViewColumn>
<PickerViewColumn>
{seconds.map((s) => (
<View key={s} className={styles.pickerItem}>
{s.toString().padStart(2, '0')}
</View>
))}
</PickerViewColumn>
</PickerView>
</View>
);
};


Re: PickerView 组件 设置indicatorStyle 字体颜色 没作用

Posted: 2025年 Sep 12日 10:44
by Lucy

不好意思,我们会尽快修复该问题,有进展会同步你。


Re: PickerView 组件 设置indicatorStyle 字体颜色 没作用

Posted: 2025年 Sep 12日 14:22
by tangxue.li@tuya.com

indicatorStyle属性只是设置选择器中间选中框的样式,目前原生picker view组件并不支持设置选中项字体的样式,可以使用smart UI或许可以满足你的需求https://developer.tuya.com/material/smartui?comId=picker