Button.js 866 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

const styles = StyleSheet.create({
  root: {
    backgroundColor: "#ddd",
    borderRadius: 4,
    borderColor: "#ccc",
    borderWidth: 1,
    borderStyle: "solid",
    width: 150,
12 13 14
    height: 30,
    alignItems: "center",
    justifyContent: "center",
15 16
  },
  text: {
17
    color: "#333",
18 19 20 21 22
  }
});

class Button extends Component {
  render () {
23
    const { children, style, textStyle, ...rest } = this.props;
24 25
    return (
      <TouchableOpacity {...rest}>
26 27 28 29 30 31 32 33
        <View style={[ style, styles.root ]}>
          <Text
            style={[
              styles.text,
              textStyle,
            ]}>
            {children}
          </Text>
34 35 36 37 38 39 40 41 42 43
        </View>
      </TouchableOpacity>
    );
  }
}

Button.propTypes = {
};

module.exports = Button;