accessibilityLabel string
用于显示可访问性功能的文本
color color
文本的颜色(IOS),或按钮的背景颜色(Android)
disabled bool
If true,禁用该组件任何交互
onPress function
当用户点击按钮时要调用的处理程序
title string
显示在button上的文案
实例:
import React,{
Component,} from 'react';
import {
Button,
Alert,
} from 'react-native';
const onButtonPress = () => {
Alert.alert('Button has been pressed!');
};
class ButtonComp extends Component {
render() {
return (
<Button
onPress={onButtonPress}
title="I Am Disabled"
accessibilityLabel="See an informative alert"
/>
);
}
}