Button

Demo

Studio

import { ClassicButton } from 'tuya-panel-style-button';
import TuyaRNSvgs from 'tuya-panel-kit/lib/components/iconfont/svg/defaultSvg';
<View
style={{
display: 'flex',
}}
>
<ClassicButton
onLongPress={() => console.log('long press')}
icon={TuyaRNSvgs.power}
text="switch"
/>
<Text style={styles.title}>No icon, no background</Text>
<View style={{ flexDirection: 'row' }}>
<ClassicButton
width={90}
showIcon={false}
icon={TuyaRNSvgs.power}
text="switch"
iconColor="#FFF"
padding={[5, 0, 0, 5]}
/>
<ClassicButton
width={90}
showIconBg={false}
icon={TuyaRNSvgs.power}
text="switch"
iconColor="#158CFC"
style={{ marginLeft: 10 }}
/>
</View>
<Text style={styles.title}>Set padding</Text>
<ClassicButton
icon={TuyaRNSvgs.power}
text="switch"
iconColor="#FFF"
style={{ marginLeft: 10 }}
padding={[10, 40, 0, 0]}
/>
</View>;

Nordic

import { NordicButton } from 'tuya-panel-style-button';
import TuyaRNSvgs from 'tuya-panel-kit/lib/components/iconfont/svg/defaultSvg';
<NordicButton icon={TuyaRNSvgs.power} text="switch" iconColor="#FFF" />;

Acrylic

<AcrylicButton icon={TuyaRNSvgs.power} text="switch" iconColor="#FFF" />

API

ClassicButton

NameDescriptionTypeDefault
styleOutermost container styleStyleProp--
iconBgStyleIcon background styleStyleProp--
textStyleText styleStyleProp--
activeOpacityTransparency at touchnumber--
textButton textstring--
disabledDisable componentsbooleanfalse
widthWidthnumber--
padding[paddingTop, paddingRight, paddingBottom, paddingLeft]number[]--
radiusRadiusnumber--
backgroundColorComponent Background colorstring--
fontColorButton text font colorstring(required)
fontSizeButton text font sizenumber(required)
fontWeightButton text font weight"normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"(required)
millisecondsLong press time The unit is in msnumber200
onPressClick the button to call back() => void--
onLongPressLong press button callback function() => void--
iconicon svg pathstring--
imageimage url,icon has a higher prioritystring--
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