import React from "react";
import { Text, TouchableOpacity } from "react-native";
import { customeButtons,GetPageTheme } from "../styles/Global";
import { useRoute } from '@react-navigation/native';
import LinearGradient from 'react-native-linear-gradient';

const GradientButton = (props) => {
  const route = useRoute();
  const PageTheme=GetPageTheme(props.DarkTheme,route.name);
  const customeButton=customeButtons(props.DarkMode,route.name);

  return (
    <TouchableOpacity
      activeOpacity={0.6}
      onPress={props.onPress}
      disabled={props.disabled!=null?props.disabled:false}
      style={[customeButton.g_buttonStyle]}>      
        <LinearGradient colors={(props.colors!=null ? props.colors: [PageTheme.$secondary_color_light,PageTheme.$gradient2, PageTheme.$primary_color])} start={{ x: 0, y: 0 }} end={{ x: 1, y: 0 }} style={[customeButton.g_linearGradient,props.style!=null?props.style:{}]}>
            <Text style={customeButton.g_textStyle}>{props.title}</Text>
        </LinearGradient>
    </TouchableOpacity>
  );
};
export default GradientButton;