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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-customize-btns

v1.0.3

Published

A React Native package for customized buttons

Downloads

7

Readme

react-native-customize-btns

A customizable button component for React Native applications, designed to support both Android and iOS platforms with flexibility in styling, icons, and images.

Installation

To install the package, run:

npm install react-native-customize-btns

Or, if you prefer using yarn:

yarn add react-native-customize-btns

Usage

First, import the Button component from the package:

import React from 'react';
import { Button } from 'react-native-customize-btns';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import { Image } from 'react-native';
// Make sure to replace './path/to/your/assets' with the actual path
import { images } from './path/to/your/assets';

You can then use the Button component in your application as shown in the following examples:

Basic Button

<Button
  title="Click Me"
  onPress={() => console.log('Button pressed!')}
  style={{ backgroundColor: 'blue', padding: 10 }}
  textStyle={{ color: 'white', fontSize: 24 }}
/>

Button with Left Icon

const LeftIcon = <MaterialIcons name="menu" size={24} color="white" />;

<Button
  title="Menu"
  onPress={() => console.log('Menu button pressed!')}
  style={{ backgroundColor: 'green', padding: 10 }}
  textStyle={{ color: 'white', fontSize: 24 }}
  leftIcon={LeftIcon}
/>

Button with Right Icon

const RightIcon = <MaterialIcons name="home" size={24} color="white" />;

<Button
  title="Home"
  onPress={() => console.log('Home button pressed!')}
  style={{ backgroundColor: 'orange', padding: 10 }}
  textStyle={{ color: 'white', fontSize: 24 }}
  rightIcon={RightIcon}
/>

Button with Both Icons

<Button
  title="Both Sides"
  onPress={() => console.log('Button with icons on both sides pressed!')}
  style={{ backgroundColor: 'purple', padding: 10 }}
  textStyle={{ color: 'white', fontSize: 24 }}
  leftIcon={LeftIcon}
  rightIcon={RightIcon}
/>

Button with Left Image

<Button
  title="LinkedIn"
  onPress={() => console.log('LinkedIn button pressed!')}
  style={{ backgroundColor: 'purple', padding: 10 }}
  textStyle={{ color: 'white', fontSize: 24 }}
  leftImage={<Image source={images.linkedin} style={{ resizeMode: 'contain', height: 30, width: 60 }} />}
/>

Button with Right Image

<Button
  title="Twitter"
  onPress={() => console.log('Twitter button pressed!')}
  style={{ backgroundColor: 'purple', padding: 10 }}
  textStyle={{ color: 'white', fontSize: 24 }}
  rightImage={<Image source={images.twitter} style={{ resizeMode: 'contain', height: 30, width: 60 }} />}
/>

Props

The Button component accepts the following props to customize its appearance and behavior:

  • title: The text to display on the button.
  • onPress: Function to call when the button is pressed.
  • style: Custom styles for the button's container.
  • textStyle: Custom styles for the button's title text.
  • activeOpacity: Opacity of the button when pressed.
  • leftIcon, rightIcon: Custom icon components to display on the left or right side of the button title.
  • leftImage, rightImage: Custom image components to display on the left or right side of the button title.
  • iconStyle: Custom styles for the icon's container.

Contributing

Contributions are welcome! Please submit a pull request or create an issue for any features or fixes.