Button.js 708 Bytes
Newer Older
Gaëtan Renaudeau's avatar
Gaëtan Renaudeau committed
1 2
import React, {Component} from "react";
import {StyleSheet, View, Text, TouchableOpacity} from "react-native";
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

const styles = StyleSheet.create({
  root: {
    backgroundColor: "#ddd",
    borderRadius: 4,
    borderColor: "#ccc",
    borderWidth: 1,
    borderStyle: "solid",
    width: 150,
    padding: 10
  },
  text: {
    color: "#333"
  }
});

class Button extends Component {
  render () {
    const { children, width, ...rest } = this.props;
    return (
      <TouchableOpacity {...rest}>
        <View style={[ {width}, styles.root ]}>
          <Text style={styles.text}>{children}</Text>
        </View>
      </TouchableOpacity>
    );
  }
}

Button.propTypes = {
};

module.exports = Button;