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-chipgroup

v1.0.7

Published

This is a library that provides custom React Native components for creating interactive chip elements and selectable chip groups. These components are designed to enhance user interaction in React Native applications by offering intuitive and customizable

Downloads

8

Readme

React Native Chipgroup

react-native-chipgroup is a library that provides custom React Native components for creating interactive chip elements and selectable chip groups. These components are designed to enhance user interaction in React Native applications by offering intuitive and customizable UI elements.

The library includes the following components:

  • Chip: A versatile chip component that supports different modes, custom icons, and actions.
  • SelectChip: A group of selectable chips allowing users to choose from a set of options, with customizable styling and selection handling.

Installation

Using npm:

  npm i react-native-chipgroup

Note: react-native-responsive-dimensions is a required dependency for react-native-chipgroup. Make sure to install it for proper functionality.

Basic Usage

import React from 'react';
import { View } from 'react-native';
import { Chip, SelectChip } from 'react-native-chipgroup';

const data = [
  { label: 'Option 1', value: 1 },
  { label: 'Option 2', value: 2 },
  { label: 'Option 3', value: 3 }
];

const App = () => {

  const handleSelect = (item, index) => {
    console.log(`Selected: ${item.value} at index ${index}`);
  };

  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>

      <Chip
        mode="outlined"
        onPress={() => console.log('Chip pressed')}
        isCloseIcon={true}
        onClose={() => console.log('Close icon pressed')}
      >
        Example Chip
      </Chip>

      <SelectChip
        data={data}
        onSelect={handleSelect}
        renderLabel={(item) => item.label}
        defaultSelectedIndex={0}
        containerStyle={{ marginTop: 20 }}
      />

    </View>
  );
};

export default App;

Props

Chip

| Prop name | Type | Required | Default value | Description | |----------------------|-----------------------------------------------------|----------|------------------------|--------------------------------------------------------------------------------------------------| | mode | 'flat' \| 'outlined' | No | 'flat' | The mode of the chip, either 'flat' or 'outlined'. | | children | ReactNode | No | - | The content of the chip. | | onPress | () => void | No | - | A function called when the chip is pressed. | | leftIcon | ReactNode | No | - | An icon to be displayed on the left side of the chip. | | rightIcon | ReactNode | No | - | An icon to be displayed on the right side of the chip. | | isCloseIcon | Boolean | No | - | Determines whether to show a close icon on the chip. | | onClose | () => void | No | - | A function called when the close icon is pressed. | | containerStyle | StyleProp<ViewStyle> or undefined | No | - | Optional styling for the container of the Chip component. | | style | StyleProp<ViewStyle> or (selected: boolean) => StyleProp<ViewStyle> or undefined | No | - | Optional styling for the chip. It can be either a style object or a function. | | labelStyle | StyleProp<TextStyle> or (selected: boolean) => StyleProp<TextStyle> or undefined | No | - | Optional styling for the label of the chip. It can be either a style object or a function. |

SelectChip

| Prop name | Type | Required | Default value | Description | |----------------------|-----------------------------------------------------|----------|------------------------|--------------------------------------------------------------------------------------------------| | data | any[] | Yes | - | An array of items to display as tags. | | onSelect | (item: any, index: number) => void | No | - | A function called when a tag is selected. It receives the selected item and its index. | | renderLabel | (item: any) => string | Yes | - | A function used to render the label of each tag. | | containerStyle | StyleProp<ViewStyle> or undefined | No | - | Optional styling for the container of the Tag component. | | style | StyleProp<ViewStyle> or (selected: boolean) => StyleProp<ViewStyle> or undefined | No | - | Optional styling for the tags. It can be either a style object or a function. | | labelStyle | StyleProp<TextStyle> or (selected: boolean) => StyleProp<TextStyle> or undefined | No | - | Optional styling for the label of the tags. It can be either a style object or a function. | | defaultSelectedIndex | number or undefined | No | 0 | The default index of the selected tag. |

License

The library is released under the ISC license. For more information see the License Tab.