Button.js 1.07 KB
Newer Older
Giang Tran committed
1
import React, {Component} from 'react';
Giang Tran committed
2 3 4 5 6 7 8 9
import {
  StyleSheet,
  TouchableOpacity,
  View,
  Text,
  ImageBackground,
} from 'react-native';
import R from '../assets/R';
Giang Tran committed
10
import {colors, sizes} from '../assets/theme';
Giang Tran committed
11
import {getFontXD, HEIGHTXD, WIDTHXD} from '../Config/Functions';
Giang Tran committed
12

Giang Tran committed
13
const Button = (props) => {
Giang Tran committed
14
  const {title, onClick} = props;
Giang Tran committed
15
  return (
Giang Tran committed
16
    <TouchableOpacity style={styles.container} onPress={onClick}>
Giang Tran committed
17
      <ImageBackground
Giang Tran committed
18
        resizeMode={'cover'}
Giang Tran committed
19
        style={{
Giang Tran committed
20 21
          height: 50,
          width: 300,
Giang Tran committed
22 23 24 25 26 27 28 29 30
          justifyContent: 'center',
          alignItems: 'center',
          borderRadius: 20,
        }}
        source={R.images.bgBtn}>
        <Text style={styles.txt}>{title}</Text>
      </ImageBackground>
    </TouchableOpacity>
  );
Giang Tran committed
31 32 33 34 35
};

export default Button;

const styles = StyleSheet.create({
Giang Tran committed
36 37 38 39
  container: {
    height: HEIGHTXD(150),

    borderRadius: 50,
Giang Tran committed
40
    justifyContent: 'center',
Giang Tran committed
41
    alignItems: 'center',
Giang Tran committed
42
  },
Giang Tran committed
43 44 45 46 47
  txt: {
    fontSize: getFontXD(48),
    textTransform: 'uppercase',
    color: R.colors.white,
    fontWeight: 'bold',
Giang Tran committed
48 49
  },
});