Installations
npm install react-native-checkbox-tree
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
14.17.1
NPM Version
6.14.17
Score
39.1
Supply Chain
55.8
Quality
67
Maintenance
50
Vulnerability
93.4
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (81.93%)
JavaScript (17.13%)
Shell (0.94%)
Developer
hoaphantn7604
Download Statistics
Total Downloads
10,480
Last Day
2
Last Week
23
Last Month
137
Last Year
2,033
GitHub Statistics
25 Stars
31 Commits
6 Forks
2 Watching
1 Branches
1 Contributors
Package Meta Information
Latest Version
2.1.0
Package Id
react-native-checkbox-tree@2.1.0
Unpacked Size
75.89 kB
Size
14.71 kB
File Count
27
NPM Version
6.14.17
Node Version
14.17.1
Total Downloads
Cumulative downloads
Total Downloads
10,480
Last day
-60%
2
Compared to previous day
Last week
-48.9%
23
Compared to previous week
Last month
21.2%
137
Compared to previous month
Last year
-37.3%
2,033
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
5
Dev Dependencies
21
react-native-checkbox-tree
A simple and elegant checkbox tree for React Native. Implemented using react-native-vector-icons
Getting started
1 npm install react-native-checkbox-tree --save
or
1 yarn add react-native-checkbox-tree
Now we need to install react-native-vector-icons.
1 npm install react-native-vector-icons --save
or
1 yarn add react-native-vector-icons
Source code demo
react-native-template-components A beautiful template for React Native.
Demo
Props
Props | Params | isRequire | Description |
---|---|---|---|
data | Array | Yes | Data is a plain array |
textField | String | Yes | Extract the lable from the data item |
childField | String | Yes | Extract the field children from the data item |
onSelect | (item[])=> void | Yes | Selection callback |
style | ViewStyle | No | Styling for container view |
textStyle | TextStyle | No | Styling for text |
iconSize | Number | No | Customize icon size |
iconColor | String | No | Customize icon color |
autoSelectChilds | Boolean | No | Automatically select childs when selecting an item, default is true |
autoSelectParents | Boolean | No | Automatically select parent when all childs are selected, default is true |
openIcon | Element | No | Customize open icon. Only using react-native-vector-icons |
closeIcon | Element | No | Customize close icon. Only using react-native-vector-icons |
checkIcon | Element | No | Customize check icon. Only using react-native-vector-icons |
unCheckIcon | Element | No | Customize uncheck icon. Only using react-native-vector-icons |
renderItem | (item, isSelect, isOpen, onOpen, onClose, onSelect)=> Element | No | Takes an item from data and renders it into the list |
Method
API | Description |
---|---|
clear | Refresh data |
setSelectedItem | The input value is the result returned from onSelect |
Example 1
1import React, { useEffect, useRef, useState } from 'react'; 2import { StyleSheet, Text, TouchableOpacity, View } from 'react-native'; 3import CheckboxTree from 'react-native-checkbox-tree'; 4import AntDesign from 'react-native-vector-icons/AntDesign'; 5import Ionicons from 'react-native-vector-icons/Ionicons'; 6 7const recursiveData = [ 8 { 9 shopReportName: 'Name 1', 10 shopCode: '00001', 11 shopType: '2', 12 shopId: 1, 13 shopName: 'Name 1', 14 childs: [ 15 { 16 shopReportName: 'Name 2', 17 shopCode: '00002', 18 shopType: '3', 19 shopId: 2, 20 shopName: 'Name 2', 21 childs: [ 22 { 23 shopReportName: 'Name 3', 24 shopCode: '00003', 25 shopType: '4', 26 shopId: 3, 27 shopName: 'Name 3', 28 childs: [ 29 { 30 shopReportName: 'Name 4', 31 shopCode: '00004', 32 shopType: '4', 33 shopId: 4, 34 shopName: 'Name 4', 35 }, 36 { 37 shopReportName: 'Name 5', 38 shopCode: '00005', 39 shopType: '4', 40 shopId: 5, 41 shopName: 'Name 5', 42 childs: [ 43 { 44 shopReportName: 'Name 6', 45 shopCode: '00006', 46 shopType: '4', 47 shopId: 7, 48 shopName: 'Name 6', 49 childs: [ 50 { 51 shopReportName: 'Name 7', 52 shopCode: '00007', 53 shopType: '4', 54 shopId: 7, 55 shopName: 'Name 7', 56 }, 57 ], 58 }, 59 ], 60 }, 61 { 62 shopReportName: 'Name 8', 63 shopCode: '00008', 64 shopType: '4', 65 shopId: 8, 66 shopName: 'Name 8', 67 }, 68 ], 69 }, 70 ], 71 }, 72 ], 73 }, 74]; 75 76export interface Props {} 77 78const CheckboxTreeScreen: React.FC<Props> = _props => { 79 const [data] = useState<any[]>(recursiveData); 80 const ref: any = useRef(); 81 82 useEffect(() => { 83 if (ref && ref.current) { 84 ref.current.setSelectedItem([ 85 { 86 shopReportName: 'Name 1', 87 shopCode: '00001', 88 shopType: '2', 89 shopId: 1, 90 shopName: 'Name 1', 91 }, 92 { 93 shopReportName: 'Name 2', 94 shopCode: '00002', 95 shopType: '3', 96 shopId: 2, 97 shopName: 'Name 2', 98 }, 99 ]); 100 } 101 }, [ref]); 102 103 return ( 104 <View style={styles.container}> 105 <CheckboxTree 106 ref={ref} 107 data={data} 108 textField="shopName" 109 childField="childs" 110 textStyle={{ color: 'black' }} 111 iconColor="black" 112 iconSize={26} 113 openIcon={<AntDesign name="arrowdown" size={26} />} 114 closeIcon={<AntDesign name="arrowright" size={26} />} 115 renderItem={({ item, isSelect, isOpen, onOpen, onClose, onSelect }) => ( 116 <View style={styles.wrapItem}> 117 {isOpen ? ( 118 <TouchableOpacity onPress={onClose}> 119 <AntDesign size={30} name="arrowright" /> 120 </TouchableOpacity> 121 ) : ( 122 <TouchableOpacity onPress={onOpen}> 123 <AntDesign size={30} name="arrowdown" /> 124 </TouchableOpacity> 125 )} 126 <TouchableOpacity onPress={onSelect}> 127 <Ionicons 128 size={26} 129 name={isSelect ? 'checkbox-outline' : 'square-outline'} 130 /> 131 </TouchableOpacity> 132 <Text style={styles.name}>{item.shopName}</Text> 133 </View> 134 )} 135 onSelect={item => { 136 console.log(`Selected ${item.length} item`); 137 }} 138 /> 139 </View> 140 ); 141}; 142 143export default CheckboxTreeScreen; 144 145const styles = StyleSheet.create({ 146 container: { 147 flex: 1, 148 padding: 20, 149 }, 150 wrapItem: { 151 flexDirection: 'row', 152 alignItems: 'center', 153 marginVertical: 8, 154 }, 155 icon: { 156 marginHorizontal: 8, 157 }, 158 name: { 159 fontSize: 20, 160 marginLeft: 8, 161 }, 162});
Example 2
1 import React from 'react'; 2 import { StyleSheet, View } from 'react-native'; 3 import CheckboxTree from 'react-native-checkbox-tree'; 4 import AntDesign from 'react-native-vector-icons/AntDesign'; 5 6 const recursiveData = [ 7 { 8 shopReportName: 'Name 1', 9 shopCode: '00001', 10 shopType: '2', 11 shopId: 1, 12 shopName: 'Name 1', 13 childs: [ 14 { 15 shopReportName: 'Name 2', 16 shopCode: '00002', 17 shopType: '3', 18 shopId: 2, 19 shopName: 'Name 2', 20 childs: [ 21 { 22 shopReportName: 'Name 3', 23 shopCode: '00003', 24 shopType: '4', 25 shopId: 3, 26 shopName: 'Name 3', 27 childs: [ 28 { 29 shopReportName: 'Name 4', 30 shopCode: '00004', 31 shopType: '4', 32 shopId: 4, 33 shopName: 'Name 4', 34 }, 35 { 36 shopReportName: 'Name 5', 37 shopCode: '00005', 38 shopType: '4', 39 shopId: 5, 40 shopName: 'Name 5', 41 childs: [ 42 { 43 shopReportName: 'Name 6', 44 shopCode: '00006', 45 shopType: '4', 46 shopId: 7, 47 shopName: 'Name 6', 48 childs: [ 49 { 50 shopReportName: 'Name 7', 51 shopCode: '00007', 52 shopType: '4', 53 shopId: 7, 54 shopName: 'Name 7', 55 }, 56 ], 57 }, 58 ], 59 }, 60 { 61 shopReportName: 'Name 8', 62 shopCode: '00008', 63 shopType: '4', 64 shopId: 8, 65 shopName: 'Name 8', 66 }, 67 ], 68 }, 69 ], 70 }, 71 ], 72 }, 73 ]; 74 75 const CheckboxTreenScreen = _props => { 76 return ( 77 <View style={styles.container}> 78 <CheckboxTree 79 data={recursiveData} 80 textField="shopName" 81 childField="childs" 82 textStyle={{ color: 'black' }} 83 iconColor="black" 84 iconSize={26} 85 openIcon={<AntDesign name="arrowdown" size={26} />} 86 closeIcon={<AntDesign name="arrowright" size={26} />} 87 checkIcon={<View />} 88 unCheckIcon={<View />} 89 renderItem={item => ( 90 <View style={styles.wrapItem}> 91 <AntDesign 92 style={styles.iconItem} 93 name="folderopen" 94 size={20} 95 /> 96 <Text style={styles.text}>{item.shopName}</Text> 97 </View> 98 )} 99 onSelect={item => { 100 console.log(`Selected ${item.length} item`); 101 }} 102 /> 103 </View> 104 ); 105 }; 106 107 export default CheckboxTreenScreen; 108 109 const styles = StyleSheet.create({ 110 container: { 111 flex: 1, 112 paddingVertical: 40, 113 }, 114 wrapItem: { 115 flexDirection: 'row', 116 marginVertical: 8 117 }, 118 text: { 119 fontSize: 18 120 }, 121 iconItem:{ 122 marginHorizontal: 8 123 } 124 });
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
94 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-c2jc-4fpr-4vhg
- Warn: Project is vulnerable to: GHSA-crh6-fp67-6883
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-whgm-jr23-g3j9
- Warn: Project is vulnerable to: GHSA-cph5-m8f7-6c5x
- Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-rv95-896h-c2vc
- Warn: Project is vulnerable to: GHSA-qw6h-vgh9-j6wx
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-f5x2-xv93-4p23
- Warn: Project is vulnerable to: GHSA-gmpm-xp43-f7g6
- Warn: Project is vulnerable to: GHSA-pf27-929j-9pmm
- Warn: Project is vulnerable to: GHSA-327c-qx3v-h673
- Warn: Project is vulnerable to: GHSA-x4cf-6jr3-3qvp
- Warn: Project is vulnerable to: GHSA-mph8-6787-r8hw
- Warn: Project is vulnerable to: GHSA-7mhc-prgv-r3q4
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-c7qv-q95q-8v27
- Warn: Project is vulnerable to: GHSA-33f9-j839-rf8h
- Warn: Project is vulnerable to: GHSA-c36v-fmgq-m8hx
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g
- Warn: Project is vulnerable to: GHSA-5rrq-pxf6-6jx5
- Warn: Project is vulnerable to: GHSA-8fr3-hfg3-gpgp
- Warn: Project is vulnerable to: GHSA-gf8q-jrpm-jvxq
- Warn: Project is vulnerable to: GHSA-2r2c-g63r-vccr
- Warn: Project is vulnerable to: GHSA-cfm4-qjh2-4765
- Warn: Project is vulnerable to: GHSA-x4jg-mjrx-434g
- Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-rxrc-rgv4-jpvx
- Warn: Project is vulnerable to: GHSA-7f53-fmmv-mfjv
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-m6fv-jmcg-4jfg
- Warn: Project is vulnerable to: GHSA-cm22-4g7w-348p
- Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7
- Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9
- Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw
- Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc
- Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh
- Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3
- Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc
- Warn: Project is vulnerable to: GHSA-5fg8-2547-mr8q
- Warn: Project is vulnerable to: GHSA-3j8f-xvm3-ffx4
- Warn: Project is vulnerable to: GHSA-4p35-cfcx-8653
- Warn: Project is vulnerable to: GHSA-7f3x-x4pr-wqhj
- Warn: Project is vulnerable to: GHSA-jpp7-7chh-cf67
- Warn: Project is vulnerable to: GHSA-q6wq-5p59-983w
- Warn: Project is vulnerable to: GHSA-j9fq-vwqv-2fm2
- Warn: Project is vulnerable to: GHSA-pqw5-jmp5-px4v
- Warn: Project is vulnerable to: GHSA-4w2j-2rg4-5mjw
- Warn: Project is vulnerable to: GHSA-mrgp-mrhc-5jrq
- Warn: Project is vulnerable to: GHSA-7jxr-cg7f-gpgv
- Warn: Project is vulnerable to: GHSA-xj72-wvfv-8985
- Warn: Project is vulnerable to: GHSA-ch3r-j5x3-6q2m
- Warn: Project is vulnerable to: GHSA-p5gc-c584-jj6v
- Warn: Project is vulnerable to: GHSA-whpj-8f3w-67p5
- Warn: Project is vulnerable to: GHSA-cchq-frgv-rjh5
- Warn: Project is vulnerable to: GHSA-g644-9gfx-q4q4
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
Score
2
/10
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More