EnumSliderCard 枚举型滑动条卡片

代码演示

亚克力风格

const data = [
{
label: 'close',
key: '0',
},
{
label: 'one',
key: '1',
},
{
label: 'two',
key: '2',
},
{
label: 'three',
key: '3',
},
];
export default () => {
const [activeKey1, setActiveKey1] = useState('3');
return (
<ListView
style={{ backgroundColor: '#f9f9f9', minHeight: 200 }}
list={[
{
title: 'Acrylic',
content: (
<View>
<AcrylicEnumSliderCard
data={data}
title="AcrylicEnumSliderCard"
icon={TuyaRNSvgs.power}
bottomPromptTexts={['Off', 'Max']}
activeKey={activeKey1}
handSlidingComplete={(key, index) => setActiveKey1(key)}
/>
<View style={{ marginTop: 20 }}>
<Button
onPress={() => setActiveKey1('2')}
title="click to change key 2"
/>
</View>
</View>
),
},
]}
/>
);
};

API

AcrylicEnumSliderCard

属性名描述类型默认值
data数据源EnumList[](必选)
activeKey当前选中的keystring--
handSlidingComplete值改变完成后回调(key: string, index: number) => void--
handValueChange值改变回调(key: string, index: number) => void--
sliderDotSize滚动条上小圆点尺寸number--
sliderDotColor参数右边的小圆点颜色string--
activeSliderDotColor参数左边的小圆点颜色string--
style外层容器样式StyleProp--
icon图标 svg pathstring--
iconSize图标尺寸numbercx(24)
iconBgSize组件背景尺寸numbercx(50)
showIconBg是否显示图标背景booleantrue
iconColor图标颜色string#fff
iconBgColor图标背景颜色 只能设置 rgb、rgba 或者 hexBackgroundType#158CFB
iconBgRadius图标背景圆角numbercx(50)
sliderPropsSlider props 文档:https://panel-docs.tuyacn.com/docs/data-entry/sliderSliderProps--
titleStyle标题容器样式StyleProp--
titleTextStyle标题字体样式StyleProp--
contentStyle内容容器样式StyleProp--
thumbStyleSlider滑块样式StyleProp--
themeSliderProps.theme 文档:https://panel-docs.tuyacn.com/docs/data-entry/sliderRecord--
backgroundColor组件背景颜色string--
radius组件背景圆角number--
trackStyle滑动槽样式StyleProp--
value滑动条的值number--
unit参数的单位string--
hasControl滑动条是否为受控的booleanfalse
canTouchTrack触摸轨道是否可以更改值booleanfalse
disabled是否禁用boolean--
type滑块的类型,parcel:包裹类型"parcel" | "normal"normal
renderMinimumTrack定制渲染小于当前值的轨道() => ReactElement>--
renderTitle自定义渲染标题(value: number) => ReactElement>--
padding外层容器的padding [上,右,下,左]number[]--
title标题string--
showTitle是否显示标题booleantrue
titleFontColor标题字体颜色string--
titleFontSize标题字体大小number--
titleFontWeight标题字重"normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"--
valueFontColor参数字体颜色string--
valueFontSize参数字体大小number--
valueFontWeight参数字重"normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"--
sliderBgColor滑动条背景色string--
sliderGrooveBgColor滑动槽背景色string--
sliderThumbColor滑块颜色string--
sliderThumbSize滑块大小number--
sliderThumbRadius滑块圆角number--
bottomPromptTexts底部左右提示文字[string, string]--
bottomPromptTextFontSize底部提示文字字体大小number--
bottomPromptTextFontColor底部提示文字字体颜色string--
bottomPromptTextFontWeight底部提示文字字重"normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"--
bothSideIcons滑动条两侧的图标[IconItem, IconItem]--
bothSideIconSize滑动条两侧图标的尺寸number--
bothSideIconColor滑动条两侧图标的颜色string--
renderValue自定义的值的渲染(value: number) => ReactNode--
iconIsImage卡片图标是否为图片booleanfalse
tuya07:31