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 (<ListViewstyle={{ backgroundColor: '#f9f9f9', minHeight: 200 }}list={[{title: 'Classic',content: (<View><ClassicEnumTabsButtonCardactiveKey={activeKey}data={data}title="Classic"icon={TuyaRNSvgs.power}unit="step"onChange={key => setActiveKey(key)}/><ClassicEnumTabsButtonCardstyle={{ 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
| Name | Description | Type | Default |
|---|---|---|---|
| data | The data source | EnumItem[] | (required) |
| activeKey | The currently selected key | string | -- |
| defaultActiveKey | The key selected by default | string | -- |
| onChange | Callback for key changes | (key: string, data: EnumItem) => void | -- |
| iconIsImage | Icon is a picture | boolean | false |
| style | Outermost container style | StyleProp | -- |
| contentStyle | Content container style | StyleProp | -- |
| titleStyle | Title container style | StyleProp | -- |
| titleTextStyle | Title text style | StyleProp | -- |
| circleStyle | The pattern of small dots in the sliding groove | ViewStyle | -- |
| unit | Unit, the text to the right of value | string | -- |
| padding | Padding of the outer container [top, right, bottom, left] | number | -- |
| title | Title | string | -- |
| showTitle | Whether to show the title | boolean | true |
| titleFontColor | Title font color | string | -- |
| titleFontSize | Title font size | number | -- |
| titleFontWeight | Title font weight | "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | -- |
| valueFontColor | The value font color | string | -- |
| valueFontSize | The value font size | number | -- |
| valueFontWeight | The value font weight | "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | -- |
| backgroundColor | Component background color | string | -- |
| radius | Component radius | number | -- |
| grooveBgColor | Slide groove background color | string | -- |
| grooveHeight | Slide groove height | number | -- |
| thumbBgColor | Slider thumb background color | string | -- |
| thumbHeight | Slider thumb height | number | -- |
| activeTextColor | The font color of the currently selected item | string | -- |
| activeTextFontSize | The font size of the currently selected item | number | -- |
| icon | icon svg path | string | -- |
| iconSize | icon size | number | cx(24) |
| iconBgSize | icon background size | number | cx(50) |
| showIcon | Whether to display icon | boolean | true |
| showIconBg | Whether to display icon background | boolean | true |
| iconColor | icon color | string | #fff |
| iconBgColor | icon background color, only rgb、rgba or hex | BackgroundType | #158CFB |
| iconBgRadius | icon background radius | number | cx(50) |
| imageRadius | image radius | number | 0 |