No Description

Btn.js 716B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //@flow
  2. import React, {
  3. Component,
  4. PropTypes,
  5. } from "react";
  6. import {
  7. Text,
  8. TouchableOpacity,
  9. StyleSheet,
  10. } from "react-native";
  11. const styles = StyleSheet.create({
  12. root: {
  13. margin: 3,
  14. paddingVertical: 4,
  15. paddingHorizontal: 8,
  16. color: "#36f",
  17. borderWidth: 1,
  18. borderColor: "#36f",
  19. fontSize: 12,
  20. }
  21. });
  22. export default class Btn extends Component {
  23. static propTypes = {
  24. onPress: PropTypes.func.isRequired,
  25. label: PropTypes.string.isRequired,
  26. };
  27. render () {
  28. const { onPress, label } = this.props;
  29. return (
  30. <TouchableOpacity onPress={onPress}>
  31. <Text style={styles.root}>
  32. {label}
  33. </Text>
  34. </TouchableOpacity>
  35. );
  36. }
  37. }