EnumTabsButtonCard

Demo

Studio

const data = [
{
label: '1',
key: '1',
disabled: true,
},
{
label: '2',
key: 'two',
},
{
label: '3',
key: '3',
},
{
label: '4',
key: '5',
},
{
label: '5',
key: '6',
},
{
label: '6',
key: '7',
},
];
export default () => {
const [activeKey, setActiveKey] = useState('7');
return (
<ListView
style={{ backgroundColor: '#f9f9f9', minHeight: 200 }}
list={[
{
title: 'Classic',
content: (
<View>
<ClassicEnumTabsButtonCard
activeKey={activeKey}
data={data}
title="Classic"
icon={TuyaRNSvgs.power}
unit="step"
onChange={key => setActiveKey(key)}
/>
<ClassicEnumTabsButtonCard
style={{ marginTop: 20 }}
data={data}
title="Custom theme"
icon={TuyaRNSvgs.power}
unit="step"
valueFontColor="#ff6700"
grooveBgColor="#000"
activeTextColor="#fff"
thumbBgColor="#ff6700"
onChange={key => setActiveKey(key)}
/>
</View>
),
},
]}
/>
);
};

API

ClassicEnumTabsButtonCard

NameDescriptionTypeDefault
dataThe data sourceEnumItem[](required)
activeKeyThe currently selected keystring--
defaultActiveKeyThe key selected by defaultstring--
onChangeCallback for key changes(key: string, data: EnumItem) => void--
iconIsImageIcon is a picturebooleanfalse
styleOutermost container styleStyleProp--
contentStyleContent container styleStyleProp--
titleStyleTitle container styleStyleProp--
titleTextStyleTitle text styleStyleProp--
circleStyleThe pattern of small dots in the sliding grooveViewStyle--
unitUnit, the text to the right of valuestring--
paddingPadding of the outer container [top, right, bottom, left]number--
titleTitlestring--
showTitleWhether to show the titlebooleantrue
titleFontColorTitle font colorstring--
titleFontSizeTitle font sizenumber--
titleFontWeightTitle font weight"normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"--
valueFontColorThe value font colorstring--
valueFontSizeThe value font sizenumber--
valueFontWeightThe value font weight"normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"--
backgroundColorComponent background colorstring--
radiusComponent radiusnumber--
grooveBgColorSlide groove background colorstring--
grooveHeightSlide groove heightnumber--
thumbBgColorSlider thumb background colorstring--
thumbHeightSlider thumb heightnumber--
activeTextColorThe font color of the currently selected itemstring--
activeTextFontSizeThe font size of the currently selected itemnumber--
iconicon svg pathstring--
iconSizeicon sizenumbercx(24)
iconBgSizeicon background sizenumbercx(50)
showIconWhether to display iconbooleantrue
showIconBgWhether to display icon backgroundbooleantrue
iconColoricon colorstring#fff
iconBgColoricon background color, only rgb、rgba or hexBackgroundType#158CFB
iconBgRadiusicon background radiusnumbercx(50)
imageRadiusimage radiusnumber0
tuya07:31