Ei kuvausta

Btn.js 706B

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