该模块已内置到框架中,可通过 Button 标签引用
Button 是基础的按钮组件。内部实现依赖 <Touchable> 支持 onPress 定义的点击事件。
Button 带有默认样式,同时也支持样式的自定义。
| 名称 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| onPress | Function | 点击事件 |
同时支持任意自定义属性的透传
// demo
import {createElement, Component, render} from 'rax';
class App extends Component {
render() {
return (
<View style={{ width: 750 }}>
<Button onPress={(evt) => { alert('你好'); }}>点我</Button>
</View>
);
}
}
render(<App />);