Button.js 718 Bytes
Newer Older
1 2 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 36 37 38 39 40 41 42
const React = require("react-native");

const {
  StyleSheet,
  Component,
  View,
  Text,
  TouchableOpacity
} = React;

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;