New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-native-tree-selection

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-tree-selection

A high-performance and lightweight tree selection library for React Native.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Tree-Selection

react-native-tree-selection

react-native-tree-selection on npm react-native-tree-selection downloads react-native-tree-selection install size Android iOS MIT

Hierarchical Tree Select Control, a high-performance and lightweight library designed to effortlessly render select components with hierarchical tree data. This versatile control not only facilitates the display of work selection but also empowers users to make their own selection.

It is simple to use and fully customizable. It works on both android and iOS platforms.

🎬 Preview

Tree Selection with No ChildrenTree Selection with children
Tree Selection with no ChildrenTree Selection with children

Quick Access

Getting Started 🔧

Installation

1. Install library
npm install react-native-tree-selection
--- or ---
yarn add react-native-tree-selection
2. Install cocoapods in the ios project
cd ios && pod install

Tree-selection

Tree Data Format

const treeData: TreeDataTypes[] = [
  {
    id: '1',
    title: 'Fruits',
    data: [
      {
        title: 'Apples',
        data: [
          {
            title: 'Red Delicious',
          },
          {
            title: 'Granny Smith',
          },
          {
            title: 'Gala',
          },
        ],
      },
      {
        title: 'Bananas',
        data: [
          {
            title: 'Cavendish',
          },
          {
            title: 'Lady Finger',
          },
        ],
      },
    ],
  },
];

Usage

<TreeSelect
  data={treeData}
  childKey="data"
  titleKey="title"
  onParentPress={onParentPress}
  onChildPress={onChildPress}
  onCheckBoxPress={onCheckBoxPress}
/>

Checkout TreeSelect Example here

App
import React from 'react';
import { TreeDataTypes, TreeSelect } from 'react-native-tree-selection';

const App = () => {
  return (
    <TreeSelect
      data={treeData}
      childKey="data"
      titleKey="title"
      onParentPress={onParentPress}
      onChildPress={onChildPress}
      onCheckBoxPress={onCheckBoxPress}
    />
  );
};

export default App;

Properties

PropDefaultTypeDescription
data-DataAn array of objects representing multiple data items organized in a tree structure. Each object can contain various types of data and can be extended to include additional information. This format allows for flexible data manipulation and integration.
childKeydatastringSpecifies the name of the property in each node object that contains the children to display.
titleKeytitlestringSpecifies the name of the property in each node object that contains the title to display.
onParentPress-functionA callback function that is called when a parent node is clicked.
onChildPress-functionA callback function that is called when a child node is clicked.
onCheckBoxPress-functionA callback function that is called when a checkbox is clicked.
rightIconStyles-ImageStyleCheckbox image style
leftIconStyles-ImageStyleArrow image style
parentContainerStyles-ViewStyleStyle for Parent Container
childContainerStyles-TextStyleStyle for Child Container
parentTextStyles-TextStyleText Styles for Parent
childTextStyles-TextStyleText Styles for Child
touchableActiveOpacity0.7activeOpacityactiveOpacity style for Touchable.
flatListProps-FlatListProps<ArrayData>Provide FlatList props.
autoSelectParentstrueBooleanParents will gets selected when all the children are selected.
autoSelectChildrentrueBooleanChildren will gets selected when parent is selected.
renderArrowOpen-ImagePropTypeChange icon for Arrow when parent expands.
renderArrowClosed-ImagePropTypeChange icon for checkbox when checkbox is selected.
renderSelect-ImagePropTypeChange icon for checkbox when checkbox is selected.
renderUnSelect-ImagePropTypeChange icon for checkbox when checkbox is unselected.

Example

A full working example project is here Example

yarn
yarn example ios   // For ios
yarn example android   // For Android

TODO

  • Provide dynamic render items

Find this library useful? ❤️

Support it by joining stargazers for this repository.⭐

Bugs / Feature requests / Feedbacks

For bugs, feature requests, and discussion please use GitHub Issues, GitHub New Feature, GitHub Feedback

🤝 How to Contribute

We'd love to have you improve this library or fix a problem 💪 Check out our Contributing Guide for ideas on contributing.

Awesome Mobile Libraries

License

Keywords

react

FAQs

Package last updated on 17 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts