# react-native-tree-picker

> React native tree picker

Latest version **0.2.3** (published 2018-03-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-tree-picker
pnpm add react-native-tree-picker
yarn add react-native-tree-picker
bun add react-native-tree-picker
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.3 |
| Published | 2018-03-27 |
| First published | 2018-01-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 30.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | deadtriggerf5 |
| Maintainers | alexander.yakhatin |

## Links

- npm: https://www.npmjs.com/package/react-native-tree-picker
- Repository: https://github.com/deadtriggerf5/react-native-tree-picker
- Issues: https://github.com/deadtriggerf5/react-native-tree-picker/issues
- npm.io page: https://npm.io/package/react-native-tree-picker

## Dependencies (2)

- [prop-types](https://npm.io/package/prop-types.md) ^15.6.0
- [react-native-material-ui](https://npm.io/package/react-native-material-ui.md) ^1.16.0

## Recent versions

- 0.2.3 (latest) — 2018-03-27
- 0.2.2 — 2018-01-30
- 0.2.1 — 2018-01-23
- 0.2.0 — 2018-01-22
- 0.1.9 — 2018-01-21
- 0.1.8 — 2018-01-18
- 0.1.7 — 2018-01-18
- 0.1.6 — 2018-01-18
- 0.1.5 — 2018-01-18
- 0.1.4 — 2018-01-18
- 0.1.3 — 2018-01-18
- 0.1.2 — 2018-01-17

## README

# react-native-tree-picker

# Props
```javascript
    static propTypes = {
        multipleSelection: PropTypes.bool,
        title: PropTypes.string.isRequired,
        data: PropTypes.arrayOf(PropTypes.object).isRequired,
        onPress: PropTypes.func.isRequired,
        selectParent: PropTypes.bool,
        selectAllChildren: PropTypes.bool,
        style: PropTypes.shape({
            text: PropTypes.shape({
                color: PropTypes.string
            }),
            icon: PropTypes.shape({
                color: PropTypes.string
            }),
            underline: PropTypes.shape({
                borderBottomColor: PropTypes.string,
                paddingBottom: PropTypes.number
            }),
            firstBtnColor: PropTypes.string,
            scndBtnColor: PropTypes.string,
            firstBtnTxtColor: PropTypes.string,
            scndBtnTxtColor: PropTypes.string
        }),
        firstBtnTitle: PropTypes.string,
        scndBtnTitle: PropTypes.string,
        customTitle: PropTypes.func,
        clearAfterSelect: PropTypes.bool
    }

    static defaultProps = {
        multipleSelection: false,
        selectParent: false,
        selectAllChildren: false,
        style: {
            text: {
                color: 'white'
            },
            icon: {
                color: 'white'
            },
            underline: {
                borderBottomColor: 'white',
                paddingBottom: 10
            },
            firstBtnColor: '#1A3D80',
            scndBtnColor: 'white',
            firstBtnTxtColor: 'white',
            scndBtnTxtColor: 'black'
        },
        firstBtnTitle: null,
        scndBtnTitle: null,
        customTitle: null,
        clearAfterSelect: false
    }
    
```
# Example
```javascript
import React, { Component } from 'react';
import { View } from 'react-native';
import TreePicker from 'react-native-tree-picker';

const data = [
    {
        Id, 
        Title, 
        Children: [
            {
                Id, 
                Title,
                < Here Children can be too >
            }
        ]
    },
    {
        Id, 
        Title
    }
];

export default class Test extends Component {
    onPress = (selected) => {
        alert(JSON.stringify(selected));
    }
    
    customTitle = (funcShowPicker) => {
    	<Text onPress={funcShowPicker}>
	        Show picker
	</Text>
    }

    render() {
        return (
            <View style={{ flex: 1 }}>
                <TreePicker 
                    title="Select" 
                    data={data}
                    onPress={this.onPress}
                    selectParent={true} />
		 <TreePicker 
                    title="Select" 
                    data={data}
                    onPress={this.onPress}
                    selectParent={true}
		    customTitle={this.customTitle}/>
            </View>
        );
    }
}
	
```

---
_Source: https://npm.io/package/react-native-tree-picker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
