npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@grishjoshi/react-native-custom-button

v0.1.0

Published

A highly customizable button component for React Native

Readme

react-native-custom-button

A highly customizable, production-ready button component for React Native, supporting iOS, Android, and Expo. Built with TypeScript, Reanimated, and LinearGradient.

Features

  • 🎨 6 Button Variants: Primary, Secondary, Tertiary, Elevated, Outlined, Text.
  • 🌈 Gradient Support: Linear gradients with angle control.
  • Rich Animations: Scale interactions, customizable ripples, and loading states.
  • 🔧 Highly Customizable: extensive styling props and theme support.
  • Accessible: WCAG compliant touch targets and accessibility props.
  • 📱 Cross-Platform: Works on iOS, Android, and Web (with caveats).

Installation

npm install react-native-custom-button
# or
yarn add react-native-custom-button

Peer Dependencies

You need to install these packages if you haven't already:

npm install react-native-reanimated react-native-linear-gradient
# or
yarn add react-native-reanimated react-native-linear-gradient

Don't forget to configure react-native-reanimated in your babel.config.js.

Usage

import React from 'react';
import { View } from 'react-native';
import { CustomButton } from 'react-native-custom-button';

const App = () => {
  return (
    <View style={{ padding: 20, gap: 10 }}>
      {/* Primary Button */}
      <CustomButton 
        title="Primary Action" 
        onPress={() => console.log('Pressed')} 
      />

      {/* Gradient Button */}
      <CustomButton 
        title="Gradient Button" 
        gradientColors={['#4c669f', '#3b5998', '#192f6a']}
        onPress={() => {}} 
      />

      {/* Loading State */}
      <CustomButton 
        title="Loading..." 
        loading 
        variant="secondary"
      />

      {/* Icon Button */}
      <CustomButton 
        title="Settings" 
        variant="outlined"
        leftIcon={<SomeIconComponent />}
      />
    </View>
  );
};

Feature Showcase

Glowing Button

A continuous rotating glow effect, perfect for AI modes or highlighting special actions.

<CustomButton
  title="Dive deeper in AI Mode"
  onPress={() => Alert.alert('Glowing Button!')}
  glow
  glowColors={['#4285F4', '#46a05bff', '#FFD700']}
  glowDuration={5000}
  backgroundColor="#4968c6ff"
  style={{ width: 300, height: 60, borderRadius: 30 }}
/>

Advanced Gradients

Full control over gradient colors and direction.

<CustomButton
  title="Ocean Gradient"
  gradientColors={['#2193b0', '#6dd5ed']}
  gradientStart="top-left"
  gradientEnd="bottom-right"
  onPress={() => {}}
  style={{ marginTop: 10 }}
/>

States (Loading & Disabled)

<CustomButton title="Loading" loading variant="secondary" onPress={() => {}} />
<CustomButton title="Disabled" disabled onPress={() => {}} style={{ marginTop: 10 }} />

Custom Theming with Icons

Deeply customize appearance and layout.

<CustomButton
  title="Custom Themed"
  backgroundColor="#40cc7dff"
  variant="primary"
  textStyle={{ fontSize: 24 }}
  style={{ width: "100%", height: 50, borderRadius: 20 }}
  leftIcon={<MaterialIcons name="add" size={24} color="white" />}
  rightIcon={<MaterialIcons name="send" size={24} color="black" />}
  spacing={20}
  onPress={() => {}}
/>

Floating Action Button (FAB)

A dedicated compound component for FABs.

<CustomButton.Floating
  // Core styling
  style={{ width: 64, height: 64, borderRadius: 32 }}
  backgroundColor="#4966bfff"
  // Positioning
  floatingPosition="bottom-right"
  offset={{ x: 20, y: 10 }}
  // Interact
  onPress={() => Alert.alert('Super FAB Pressed')}
>
  <MaterialIcons name="add" size={30} color="white" /> //inside floating button
</CustomButton.Floating>

FAB Customization

The CustomButton.Floating component is designed to hover above your content. To ensure it stays fixed while scrolling, place it outside your ScrollView or FlatList.

| Prop | Type | Default | Description | |------|------|---------|-------------| | floatingPosition | 'bottom-right' \| 'bottom-left' \| 'top-right' \| 'top-left' | 'bottom-right' | Corner to anchor the button. | | offset | { x: number, y: number } | { x: 20, y: 20 } | Distance from the edge. | | label | string | - | If provided, creates an "Extended FAB" with text. | | style | ViewStyle | - | Override dimensions, colors, or shadows. |

Note: For the FAB to float correctly over scrollable content, ensure its parent container has flex: 1 relative to the screen, and the FAB is a sibling to the ScrollView, not a child.

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | title | string | - | The text to display. | | variant | 'primary' \| 'secondary' \| 'tertiary' \| 'elevated' \| 'outlined' \| 'text' | 'primary' | The visual style variants. | | size | 'small' \| 'medium' \| 'large' | 'medium' | Predefined sizes. | | loading | boolean | false | Shows a loading spinner. | | disabled | boolean | false | Disables interaction and modifies styles. | | gradientColors | string[] | - | Array of colors for background gradient. | | leftIcon | ReactNode | - | Element to render on the left. | | rightIcon | ReactNode | - | Element to render on the right. | | theme | ButtonTheme | - | Override default theme tokens. | | ...and standard Pressable props. |

License

MIT License

Copyright (c) 2025

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.