实例:
- 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"
- />
- );
- }
- }