0.1.4 • Published 6 years ago

react-native-animated-tree-view v0.1.4

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

react-native-animated-tree-view

A React Native animated tree view component

platforms github release

Table of contents

  1. Show
  2. Usage
  3. Props

Show

react-native-animated-tree-view

Installation

yarn add react-native-animated-tree-view

Usage

Firstly, you have to define your data. Example:

const data = [
  {
    name: "Cheese",
    value: "cheese-value"
  },
  {
    name: "Cheese",
    value: "cheese-value",
    items: [
      {
        name: "Spicy",
        value: "spicy-value"
      },
      {
        name: "Cheese",
        value: "cheese-value",
        items: [
          {
            name: "Spicy",
            value: "spicy-value"
          },
          {
            name: "Spicy",
            value: "spicy-value"
          }
        ]
      }
    ]
  }
];

It is required that each node on the tree have its own value key which name should be "value". The tree nodes are defined in the items key. They are an array of objects, following the same structure as the parent.

After defining data, mount the component. Example:

import TreeView from "react-native-animated-tree-view";

export default App = () => {
  return <TreeView data={data} />;
};

Props

ListView

PropDescriptionTypeDefault
dataArray of nested itemsArrayRequired
onClickReturn clicked itemFunctionNot Require
displayNodeNameTakes a node to render a display textStringname
childrenNodeNameNode to determine in a node where are the children, by default it will try to find them in itemsStringitems
leftImageLeft side imageNot Require
rightImageRight side imageNot Require

Style Props

PropDescriptionType
containerStyleContainer StyleObject
listContainerStyleList Container StyleObject
listItemStyleList Item StyleObject
textStyleList Item Text StyleObject
leftImageStyleLeft side image styleObject
rightImageWrapperStyleRight side image wrapper styleObject
rightImageStyleRight side image styleObject