React Native Button使用

前端之家收集整理的这篇文章主要介绍了React Native Button使用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

属性

  1. accessibilityLabel string
  2. 用于显示可访问性功能的文本
  3. color color
  4. 文本的颜色(IOS),或按钮的背景颜色(Android
  5. disabled bool
  6. If true,禁用该组件任何交互
  7. onPress function
  8. 用户点击按钮时要调用的处理程序
  9. title string
  10. 显示button上的文案

实例:

  1. import React,{
  2. Component,} from 'react';
  3.  
  4. import {
  5. Button
  6. Alert
  7. } from 'react-native';
  8.  
  9. const onButtonPress = () => {
  10. Alert.alert('Button has been pressed!');
  11. };
  12.  
  13. class ButtonComp extends Component {
  14. render() {
  15. return (
  16. <Button
  17. onPress={onButtonPress}
  18. title="I Am Disabled"
  19. accessibilityLabel="See an informative alert"
  20. />
  21. );
  22. }
  23. }

猜你在找的React相关文章