/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format * @flow */ 'use strict'; const ColorPropType = require('ColorPropType'); const Platform = require('Platform'); const React = require('React'); const StyleSheet = require('StyleSheet'); const Text = require('Text'); const TouchableNativeFeedback = require('TouchableNativeFeedback'); const TouchableOpacity = require('TouchableOpacity'); const View = require('View'); const invariant = require('fbjs/lib/invariant'); import type {PressEvent} from 'CoreEventTypes'; type ButtonProps = $ReadOnly<{| /** * Text to display inside the button */ title: string, /** * Handler to be called when the user taps the button */ onPress: (event?: PressEvent) => mixed, /** * Color of the text (iOS), or background color of the button (Android) */ color?: ?string, /** * TV preferred focus (see documentation for the View component). */ hasTVPreferredFocus?: ?boolean, /** * Text to display for blindness accessibility features */ accessibilityLabel?: ?string, /** * If true, disable all interactions for this component. */ disabled?: ?boolean, /** * Used to locate this view in end-to-end tests. */ testID?: ?string, |}>; /** * A basic button component that should render nicely on any platform. Supports * a minimal level of customization. * *
* * If this button doesn't look right for your app, you can build your own * button using [TouchableOpacity](docs/touchableopacity.html) * or [TouchableNativeFeedback](docs/touchablenativefeedback.html). * For inspiration, look at the [source code for this button component](https://github.com/facebook/react-native/blob/master/Libraries/Components/Button.js). * Or, take a look at the [wide variety of button components built by the community](https://js.coach/react-native?search=button). * * Example usage: * * ``` * import { Button } from 'react-native'; * ... * *