您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Button.js 937B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import { Text, TouchableOpacity } from 'react-native';
  4. type Props = {
  5. /**
  6. * React Elements to display within the component.
  7. */
  8. children: React$Node | Object,
  9. /**
  10. * Handler called when the user presses the button.
  11. */
  12. onValueChange: Function,
  13. /**
  14. * The component's external style
  15. */
  16. style: Object
  17. };
  18. /**
  19. * Renders a button.
  20. */
  21. export default class ButtonImpl extends Component<Props> {
  22. /**
  23. * Implements React's {@link Component#render()}, renders the button.
  24. *
  25. * @inheritdoc
  26. * @returns {ReactElement}
  27. */
  28. render() {
  29. return (
  30. <TouchableOpacity
  31. onPress = { this.props.onValueChange } >
  32. <Text style = { this.props.style }>
  33. { this.props.children }
  34. </Text>
  35. </TouchableOpacity>
  36. );
  37. }
  38. }