0.2.3 • Published 6 years ago

react-native-tree-picker v0.2.3

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

react-native-tree-picker

Props

    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

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>
        );
    }
}
	
0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago