@gradient-border/react-native-gradient-button
Version:
A powerful React Native gradient button component with support for gradient borders, text, and customizable styles. Perfect for creating beautiful, modern UI elements with minimal effort.
52 lines (51 loc) • 1.47 kB
TypeScript
import React from 'react';
import { StyleProp, ViewStyle, TextStyle, TouchableOpacityProps } from 'react-native';
export interface GradientButtonProps extends TouchableOpacityProps {
text: string;
colors: string[];
style?: StyleProp<ViewStyle>;
textStyle?: StyleProp<TextStyle>;
loading?: boolean;
loadingColor?: string;
loadingSize?: 'small' | 'large';
start?: {
x: number;
y: number;
};
end?: {
x: number;
y: number;
};
locations?: number[];
useAngle?: boolean;
angle?: number;
angleCenter?: {
x: number;
y: number;
};
accessibilityRole?: 'button';
accessibilityLabel?: string;
accessibilityHint?: string;
}
/**
* A customizable gradient button component for React Native
*
* @example
* ```tsx
* <GradientButton
* text="Submit"
* onPress={() => console.log('pressed')}
* colors={['#FF0000', '#00FF00']}
* style={{ borderRadius: 8 }}
* />
* ```
*
* @property {string} text - The text to display on the button
* @property {() => void} onPress - Function to call when button is pressed
* @property {string[]} colors - Array of at least 2 colors for the gradient
* @property {StyleProp<ViewStyle>} [style] - Optional styles for the button
* @property {StyleProp<TextStyle>} [textStyle] - Optional styles for the button text
* ...
*/
declare const GradientButton: React.FC<GradientButtonProps>;
export default GradientButton;