react-native-tree-multi-select 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/.editorconfig +0 -15
- package/.gitattributes +0 -3
- package/.github/FUNDING.yml +0 -13
- package/.github/ISSUE_TEMPLATE/bug-report.md +0 -42
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -30
- package/.github/actions/setup/action.yml +0 -28
- package/.github/assets/Jairaj_Jangle_Google_Pay_UPI_QR_Code.jpg +0 -0
- package/.github/assets/paypal_donate.png +0 -0
- package/.github/assets/upi.png +0 -0
- package/.github/workflows/ci.yml +0 -225
- package/.gitignore +0 -73
- package/.nvmrc +0 -1
- package/.watchmanconfig +0 -1
- package/.yarnrc +0 -3
- package/CHANGELOG.md +0 -145
- package/CODE_OF_CONDUCT.md +0 -133
- package/CONTRIBUTING.md +0 -114
- package/babel.config.js +0 -3
- package/example/.bundle/config +0 -2
- package/example/.watchmanconfig +0 -1
- package/example/Gemfile +0 -6
- package/example/README.md +0 -79
- package/example/android/app/build.gradle +0 -130
- package/example/android/app/debug.keystore +0 -0
- package/example/android/app/proguard-rules.pro +0 -10
- package/example/android/app/src/debug/AndroidManifest.xml +0 -13
- package/example/android/app/src/debug/java/com/treemultiselectexample/ReactNativeFlipper.java +0 -75
- package/example/android/app/src/main/AndroidManifest.xml +0 -25
- package/example/android/app/src/main/java/com/treemultiselectexample/MainActivity.java +0 -32
- package/example/android/app/src/main/java/com/treemultiselectexample/MainApplication.java +0 -62
- package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -36
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/values/strings.xml +0 -3
- package/example/android/app/src/main/res/values/styles.xml +0 -9
- package/example/android/app/src/release/java/com/treemultiselectexample/ReactNativeFlipper.java +0 -20
- package/example/android/build.gradle +0 -23
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/example/android/gradle.properties +0 -44
- package/example/android/gradlew +0 -244
- package/example/android/gradlew.bat +0 -92
- package/example/android/settings.gradle +0 -4
- package/example/app.json +0 -4
- package/example/babel.config.js +0 -17
- package/example/index.js +0 -5
- package/example/ios/.xcode.env +0 -11
- package/example/ios/File.swift +0 -6
- package/example/ios/Podfile +0 -62
- package/example/ios/Podfile.lock +0 -639
- package/example/ios/TreeMultiSelectExample/AppDelegate.h +0 -6
- package/example/ios/TreeMultiSelectExample/AppDelegate.mm +0 -26
- package/example/ios/TreeMultiSelectExample/Images.xcassets/AppIcon.appiconset/Contents.json +0 -53
- package/example/ios/TreeMultiSelectExample/Images.xcassets/Contents.json +0 -6
- package/example/ios/TreeMultiSelectExample/Info.plist +0 -74
- package/example/ios/TreeMultiSelectExample/LaunchScreen.storyboard +0 -47
- package/example/ios/TreeMultiSelectExample/main.m +0 -10
- package/example/ios/TreeMultiSelectExample-Bridging-Header.h +0 -3
- package/example/ios/TreeMultiSelectExample.xcodeproj/project.pbxproj +0 -706
- package/example/ios/TreeMultiSelectExample.xcodeproj/xcshareddata/xcschemes/TreeMultiSelectExample.xcscheme +0 -88
- package/example/ios/TreeMultiSelectExample.xcworkspace/contents.xcworkspacedata +0 -10
- package/example/ios/TreeMultiSelectExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/example/ios/TreeMultiSelectExampleTests/Info.plist +0 -24
- package/example/ios/TreeMultiSelectExampleTests/TreeMultiSelectExampleTests.m +0 -66
- package/example/metro.config.js +0 -45
- package/example/package.json +0 -41
- package/example/react-native.config.js +0 -10
- package/example/src/App.tsx +0 -70
- package/example/src/components/CustomArrow.tsx +0 -71
- package/example/src/components/CustomCheckboxView.tsx +0 -119
- package/example/src/components/CustomNodeRowView.tsx +0 -124
- package/example/src/components/SearchInput.tsx +0 -68
- package/example/src/screens/CustomArrowScreen.tsx +0 -99
- package/example/src/screens/CustomCheckboxScreen.tsx +0 -99
- package/example/src/screens/CustomNodeRowViewScreen.tsx +0 -99
- package/example/src/screens/LargeDataScreen.tsx +0 -95
- package/example/src/screens/MediumDataScreen.tsx +0 -96
- package/example/src/screens/SmallDataScreen.tsx +0 -96
- package/example/src/screens/screens.styles.ts +0 -25
- package/example/src/utils/sampleDataGenerator.ts +0 -32
- package/example/yarn.lock +0 -6368
- package/lefthook.yml +0 -17
- package/lib/typescript/__mocks__/generateTree.mock.d.ts +0 -17
- package/lib/typescript/__mocks__/generateTree.mock.d.ts.map +0 -1
- package/lib/typescript/__mocks__/zustand.d.ts +0 -3
- package/lib/typescript/__mocks__/zustand.d.ts.map +0 -1
- package/lib/typescript/__tests__/expandCollapse.helper.test.d.ts +0 -2
- package/lib/typescript/__tests__/expandCollapse.helper.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/flattenTree.helper.test.d.ts +0 -2
- package/lib/typescript/__tests__/flattenTree.helper.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/initNodeMap.helper.test.d.ts +0 -2
- package/lib/typescript/__tests__/initNodeMap.helper.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/search.helper.test.d.ts +0 -2
- package/lib/typescript/__tests__/search.helper.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/selectAll.helper.test.d.ts +0 -2
- package/lib/typescript/__tests__/selectAll.helper.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/store.test.d.ts +0 -2
- package/lib/typescript/__tests__/store.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/toggleCheckbox.helper.test.d.ts +0 -2
- package/lib/typescript/__tests__/toggleCheckbox.helper.test.d.ts.map +0 -1
- package/scripts/bootstrap.js +0 -29
- package/src/__mocks__/generateTree.mock.ts +0 -125
- package/src/__mocks__/zustand.ts +0 -24
- package/src/__tests__/expandCollapse.helper.test.ts +0 -189
- package/src/__tests__/flattenTree.helper.test.ts +0 -78
- package/src/__tests__/initNodeMap.helper.test.ts +0 -46
- package/src/__tests__/search.helper.test.ts +0 -47
- package/src/__tests__/selectAll.helper.test.ts +0 -233
- package/src/__tests__/store.test.ts +0 -208
- package/src/__tests__/toggleCheckbox.helper.test.ts +0 -124
- package/tsconfig.build.json +0 -5
- package/tsconfig.json +0 -31
- package/turbo.json +0 -34
- package/yarn.lock +0 -9953
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import React, { useRef } from "react";
|
|
2
|
-
import { TextInput, StyleSheet, View, TouchableOpacity } from "react-native";
|
|
3
|
-
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
onChange: (value: string) => void;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const SearchInput = React.memo(_SearchInput);
|
|
10
|
-
export default SearchInput;
|
|
11
|
-
|
|
12
|
-
function _SearchInput(props: Props) {
|
|
13
|
-
const { onChange } = props;
|
|
14
|
-
|
|
15
|
-
const textInputRef = useRef<any>();
|
|
16
|
-
|
|
17
|
-
const handleChange = (value: string) => {
|
|
18
|
-
onChange(value);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const clearText = () => {
|
|
22
|
-
textInputRef.current?.clear?.();
|
|
23
|
-
onChange("");
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<View
|
|
28
|
-
style={styles.parentView}>
|
|
29
|
-
<TextInput
|
|
30
|
-
ref={textInputRef}
|
|
31
|
-
style={styles.textInput}
|
|
32
|
-
onChangeText={handleChange}
|
|
33
|
-
placeholder='Search here'
|
|
34
|
-
placeholderTextColor={"#888"}
|
|
35
|
-
/>
|
|
36
|
-
<TouchableOpacity
|
|
37
|
-
onPress={clearText}>
|
|
38
|
-
<Icon
|
|
39
|
-
name={"close-circle"}
|
|
40
|
-
size={25}
|
|
41
|
-
color="grey"
|
|
42
|
-
style={styles.clearButtonIcon}
|
|
43
|
-
/>
|
|
44
|
-
</TouchableOpacity>
|
|
45
|
-
</View>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const styles = StyleSheet.create({
|
|
51
|
-
parentView: {
|
|
52
|
-
flexDirection: "row",
|
|
53
|
-
alignItems: "center",
|
|
54
|
-
},
|
|
55
|
-
textInput: {
|
|
56
|
-
color: "black",
|
|
57
|
-
borderRadius: 10,
|
|
58
|
-
margin: 10,
|
|
59
|
-
padding: 10,
|
|
60
|
-
backgroundColor: "#EEE",
|
|
61
|
-
height: 40,
|
|
62
|
-
fontSize: 16,
|
|
63
|
-
flex: 1
|
|
64
|
-
},
|
|
65
|
-
clearButtonIcon: {
|
|
66
|
-
marginEnd: 15
|
|
67
|
-
}
|
|
68
|
-
});
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Button,
|
|
5
|
-
SafeAreaView,
|
|
6
|
-
View
|
|
7
|
-
} from 'react-native';
|
|
8
|
-
|
|
9
|
-
import SearchInput from '../components/SearchInput';
|
|
10
|
-
|
|
11
|
-
import { debounce } from "lodash";
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
TreeView,
|
|
15
|
-
type TreeViewRef
|
|
16
|
-
} from 'react-native-tree-multi-select';
|
|
17
|
-
|
|
18
|
-
import { styles } from './screens.styles';
|
|
19
|
-
import { generateTreeList } from '../utils/sampleDataGenerator';
|
|
20
|
-
import { CustomArrow } from '../components/CustomArrow';
|
|
21
|
-
|
|
22
|
-
export default function CustomArrowScreen() {
|
|
23
|
-
const sampleData = React.useRef(generateTreeList(50, 4, 5));
|
|
24
|
-
const treeViewRef = React.useRef<TreeViewRef | null>(null);
|
|
25
|
-
|
|
26
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27
|
-
const debouncedSetSearchText = React.useCallback(
|
|
28
|
-
debounce((text) => treeViewRef.current?.setSearchText(text), 375, {
|
|
29
|
-
leading: true,
|
|
30
|
-
trailing: true,
|
|
31
|
-
maxWait: 750
|
|
32
|
-
}),
|
|
33
|
-
[]
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const handleSelectionChange = (_checkedIds: string[]) => {
|
|
37
|
-
// NOTE: Handle _checkedIds here
|
|
38
|
-
};
|
|
39
|
-
const handleExpanded = (_expandedIds: string[]) => {
|
|
40
|
-
// NOTE: Handle _expandedIds here
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// Expand collapse calls using ref
|
|
44
|
-
const expandAllPress = () => treeViewRef.current?.expandAll?.();
|
|
45
|
-
const collapseAllPress = () => treeViewRef.current?.collapseAll?.();
|
|
46
|
-
|
|
47
|
-
// Multi-select calls using ref
|
|
48
|
-
const onSelectAllPress = () => treeViewRef.current?.selectAll?.();
|
|
49
|
-
const onUnselectAllPress = () => treeViewRef.current?.unselectAll?.();
|
|
50
|
-
const onSelectAllFilteredPress = () => treeViewRef.current?.selectAllFiltered?.();
|
|
51
|
-
const onUnselectAllFilteredPress = () => treeViewRef.current?.unselectAllFiltered?.();
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<SafeAreaView
|
|
55
|
-
style={styles.mainView}>
|
|
56
|
-
<SearchInput onChange={debouncedSetSearchText} />
|
|
57
|
-
<View
|
|
58
|
-
style={styles.selectionButtonRow}>
|
|
59
|
-
<Button
|
|
60
|
-
title='Select All'
|
|
61
|
-
onPress={onSelectAllPress} />
|
|
62
|
-
<Button
|
|
63
|
-
title='Unselect All'
|
|
64
|
-
onPress={onUnselectAllPress} />
|
|
65
|
-
</View>
|
|
66
|
-
<View
|
|
67
|
-
style={styles.selectionButtonRow}>
|
|
68
|
-
<Button
|
|
69
|
-
title='Select Filtered'
|
|
70
|
-
onPress={onSelectAllFilteredPress} />
|
|
71
|
-
<Button
|
|
72
|
-
title='Unselect Filtered'
|
|
73
|
-
onPress={onUnselectAllFilteredPress} />
|
|
74
|
-
</View>
|
|
75
|
-
|
|
76
|
-
<View
|
|
77
|
-
style={[styles.selectionButtonRow, styles.selectionButtonBottom]}>
|
|
78
|
-
<Button
|
|
79
|
-
title='Expand All'
|
|
80
|
-
onPress={expandAllPress} />
|
|
81
|
-
<Button
|
|
82
|
-
title='Collapse All'
|
|
83
|
-
onPress={collapseAllPress} />
|
|
84
|
-
</View>
|
|
85
|
-
|
|
86
|
-
<View
|
|
87
|
-
style={styles.treeViewParent}>
|
|
88
|
-
<TreeView
|
|
89
|
-
ref={treeViewRef}
|
|
90
|
-
data={sampleData.current}
|
|
91
|
-
onCheck={handleSelectionChange}
|
|
92
|
-
onExpand={handleExpanded}
|
|
93
|
-
|
|
94
|
-
ExpandCollapseIconComponent={CustomArrow}
|
|
95
|
-
/>
|
|
96
|
-
</View>
|
|
97
|
-
</SafeAreaView>
|
|
98
|
-
);
|
|
99
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Button,
|
|
5
|
-
SafeAreaView,
|
|
6
|
-
View
|
|
7
|
-
} from 'react-native';
|
|
8
|
-
|
|
9
|
-
import SearchInput from '../components/SearchInput';
|
|
10
|
-
|
|
11
|
-
import { debounce } from "lodash";
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
TreeView,
|
|
15
|
-
type TreeViewRef
|
|
16
|
-
} from 'react-native-tree-multi-select';
|
|
17
|
-
|
|
18
|
-
import { styles } from './screens.styles';
|
|
19
|
-
import { generateTreeList } from '../utils/sampleDataGenerator';
|
|
20
|
-
import { CustomCheckboxView } from '../components/CustomCheckboxView';
|
|
21
|
-
|
|
22
|
-
export default function CustomCheckboxScreen() {
|
|
23
|
-
const sampleData = React.useRef(generateTreeList(50, 4, 5));
|
|
24
|
-
const treeViewRef = React.useRef<TreeViewRef | null>(null);
|
|
25
|
-
|
|
26
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27
|
-
const debouncedSetSearchText = React.useCallback(
|
|
28
|
-
debounce((text) => treeViewRef.current?.setSearchText(text), 375, {
|
|
29
|
-
leading: true,
|
|
30
|
-
trailing: true,
|
|
31
|
-
maxWait: 750
|
|
32
|
-
}),
|
|
33
|
-
[]
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const handleSelectionChange = (_checkedIds: string[]) => {
|
|
37
|
-
// NOTE: Handle _checkedIds here
|
|
38
|
-
};
|
|
39
|
-
const handleExpanded = (_expandedIds: string[]) => {
|
|
40
|
-
// NOTE: Handle _expandedIds here
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// Expand collapse calls using ref
|
|
44
|
-
const expandAllPress = () => treeViewRef.current?.expandAll?.();
|
|
45
|
-
const collapseAllPress = () => treeViewRef.current?.collapseAll?.();
|
|
46
|
-
|
|
47
|
-
// Multi-select calls using ref
|
|
48
|
-
const onSelectAllPress = () => treeViewRef.current?.selectAll?.();
|
|
49
|
-
const onUnselectAllPress = () => treeViewRef.current?.unselectAll?.();
|
|
50
|
-
const onSelectAllFilteredPress = () => treeViewRef.current?.selectAllFiltered?.();
|
|
51
|
-
const onUnselectAllFilteredPress = () => treeViewRef.current?.unselectAllFiltered?.();
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<SafeAreaView
|
|
55
|
-
style={styles.mainView}>
|
|
56
|
-
<SearchInput onChange={debouncedSetSearchText} />
|
|
57
|
-
<View
|
|
58
|
-
style={styles.selectionButtonRow}>
|
|
59
|
-
<Button
|
|
60
|
-
title='Select All'
|
|
61
|
-
onPress={onSelectAllPress} />
|
|
62
|
-
<Button
|
|
63
|
-
title='Unselect All'
|
|
64
|
-
onPress={onUnselectAllPress} />
|
|
65
|
-
</View>
|
|
66
|
-
<View
|
|
67
|
-
style={styles.selectionButtonRow}>
|
|
68
|
-
<Button
|
|
69
|
-
title='Select Filtered'
|
|
70
|
-
onPress={onSelectAllFilteredPress} />
|
|
71
|
-
<Button
|
|
72
|
-
title='Unselect Filtered'
|
|
73
|
-
onPress={onUnselectAllFilteredPress} />
|
|
74
|
-
</View>
|
|
75
|
-
|
|
76
|
-
<View
|
|
77
|
-
style={[styles.selectionButtonRow, styles.selectionButtonBottom]}>
|
|
78
|
-
<Button
|
|
79
|
-
title='Expand All'
|
|
80
|
-
onPress={expandAllPress} />
|
|
81
|
-
<Button
|
|
82
|
-
title='Collapse All'
|
|
83
|
-
onPress={collapseAllPress} />
|
|
84
|
-
</View>
|
|
85
|
-
|
|
86
|
-
<View
|
|
87
|
-
style={styles.treeViewParent}>
|
|
88
|
-
<TreeView
|
|
89
|
-
ref={treeViewRef}
|
|
90
|
-
data={sampleData.current}
|
|
91
|
-
onCheck={handleSelectionChange}
|
|
92
|
-
onExpand={handleExpanded}
|
|
93
|
-
|
|
94
|
-
CheckboxComponent={CustomCheckboxView}
|
|
95
|
-
/>
|
|
96
|
-
</View>
|
|
97
|
-
</SafeAreaView>
|
|
98
|
-
);
|
|
99
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Button,
|
|
5
|
-
SafeAreaView,
|
|
6
|
-
View
|
|
7
|
-
} from 'react-native';
|
|
8
|
-
|
|
9
|
-
import SearchInput from '../components/SearchInput';
|
|
10
|
-
|
|
11
|
-
import { debounce } from "lodash";
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
TreeView,
|
|
15
|
-
type TreeViewRef
|
|
16
|
-
} from 'react-native-tree-multi-select';
|
|
17
|
-
|
|
18
|
-
import { styles } from './screens.styles';
|
|
19
|
-
import { generateTreeList } from '../utils/sampleDataGenerator';
|
|
20
|
-
import { CustomNodeRowView } from '../components/CustomNodeRowView';
|
|
21
|
-
|
|
22
|
-
export default function CustomNodeRowViewScreen() {
|
|
23
|
-
const sampleData = React.useRef(generateTreeList(50, 4, 5));
|
|
24
|
-
const treeViewRef = React.useRef<TreeViewRef | null>(null);
|
|
25
|
-
|
|
26
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27
|
-
const debouncedSetSearchText = React.useCallback(
|
|
28
|
-
debounce((text) => treeViewRef.current?.setSearchText(text), 375, {
|
|
29
|
-
leading: true,
|
|
30
|
-
trailing: true,
|
|
31
|
-
maxWait: 750
|
|
32
|
-
}),
|
|
33
|
-
[]
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const handleSelectionChange = (_checkedIds: string[]) => {
|
|
37
|
-
// NOTE: Handle _checkedIds here
|
|
38
|
-
};
|
|
39
|
-
const handleExpanded = (_expandedIds: string[]) => {
|
|
40
|
-
// NOTE: Handle _expandedIds here
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// Expand collapse calls using ref
|
|
44
|
-
const expandAllPress = () => treeViewRef.current?.expandAll?.();
|
|
45
|
-
const collapseAllPress = () => treeViewRef.current?.collapseAll?.();
|
|
46
|
-
|
|
47
|
-
// Multi-select calls using ref
|
|
48
|
-
const onSelectAllPress = () => treeViewRef.current?.selectAll?.();
|
|
49
|
-
const onUnselectAllPress = () => treeViewRef.current?.unselectAll?.();
|
|
50
|
-
const onSelectAllFilteredPress = () => treeViewRef.current?.selectAllFiltered?.();
|
|
51
|
-
const onUnselectAllFilteredPress = () => treeViewRef.current?.unselectAllFiltered?.();
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<SafeAreaView
|
|
55
|
-
style={styles.mainView}>
|
|
56
|
-
<SearchInput onChange={debouncedSetSearchText} />
|
|
57
|
-
<View
|
|
58
|
-
style={styles.selectionButtonRow}>
|
|
59
|
-
<Button
|
|
60
|
-
title='Select All'
|
|
61
|
-
onPress={onSelectAllPress} />
|
|
62
|
-
<Button
|
|
63
|
-
title='Unselect All'
|
|
64
|
-
onPress={onUnselectAllPress} />
|
|
65
|
-
</View>
|
|
66
|
-
<View
|
|
67
|
-
style={styles.selectionButtonRow}>
|
|
68
|
-
<Button
|
|
69
|
-
title='Select Filtered'
|
|
70
|
-
onPress={onSelectAllFilteredPress} />
|
|
71
|
-
<Button
|
|
72
|
-
title='Unselect Filtered'
|
|
73
|
-
onPress={onUnselectAllFilteredPress} />
|
|
74
|
-
</View>
|
|
75
|
-
|
|
76
|
-
<View
|
|
77
|
-
style={[styles.selectionButtonRow, styles.selectionButtonBottom]}>
|
|
78
|
-
<Button
|
|
79
|
-
title='Expand All'
|
|
80
|
-
onPress={expandAllPress} />
|
|
81
|
-
<Button
|
|
82
|
-
title='Collapse All'
|
|
83
|
-
onPress={collapseAllPress} />
|
|
84
|
-
</View>
|
|
85
|
-
|
|
86
|
-
<View
|
|
87
|
-
style={styles.treeViewParent}>
|
|
88
|
-
<TreeView
|
|
89
|
-
ref={treeViewRef}
|
|
90
|
-
data={sampleData.current}
|
|
91
|
-
onCheck={handleSelectionChange}
|
|
92
|
-
onExpand={handleExpanded}
|
|
93
|
-
|
|
94
|
-
CustomNodeRowComponent={CustomNodeRowView}
|
|
95
|
-
/>
|
|
96
|
-
</View>
|
|
97
|
-
</SafeAreaView>
|
|
98
|
-
);
|
|
99
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Button,
|
|
5
|
-
SafeAreaView,
|
|
6
|
-
View
|
|
7
|
-
} from 'react-native';
|
|
8
|
-
|
|
9
|
-
import SearchInput from '../components/SearchInput';
|
|
10
|
-
|
|
11
|
-
import { debounce } from "lodash";
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
TreeView,
|
|
15
|
-
type TreeViewRef
|
|
16
|
-
} from 'react-native-tree-multi-select';
|
|
17
|
-
|
|
18
|
-
import { styles } from './screens.styles';
|
|
19
|
-
import { generateTreeList } from '../utils/sampleDataGenerator';
|
|
20
|
-
|
|
21
|
-
export default function LargeDataScreen() {
|
|
22
|
-
const sampleData = React.useRef(generateTreeList(200, 5, 6));
|
|
23
|
-
const treeViewRef = React.useRef<TreeViewRef | null>(null);
|
|
24
|
-
|
|
25
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
|
-
const debouncedSetSearchText = React.useCallback(
|
|
27
|
-
debounce((text) => treeViewRef.current?.setSearchText(text), 1000, {
|
|
28
|
-
trailing: true,
|
|
29
|
-
leading: false
|
|
30
|
-
}),
|
|
31
|
-
[]
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const handleSelectionChange = (_checkedIds: string[]) => {
|
|
35
|
-
// NOTE: Handle _checkedIds here
|
|
36
|
-
};
|
|
37
|
-
const handleExpanded = (_expandedIds: string[]) => {
|
|
38
|
-
// NOTE: Handle _expandedIds here
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
// Expand collapse calls using ref
|
|
42
|
-
const expandAllPress = () => treeViewRef.current?.expandAll?.();
|
|
43
|
-
const collapseAllPress = () => treeViewRef.current?.collapseAll?.();
|
|
44
|
-
|
|
45
|
-
// Multi-select calls using ref
|
|
46
|
-
const onSelectAllPress = () => treeViewRef.current?.selectAll?.();
|
|
47
|
-
const onUnselectAllPress = () => treeViewRef.current?.unselectAll?.();
|
|
48
|
-
const onSelectAllFilteredPress = () => treeViewRef.current?.selectAllFiltered?.();
|
|
49
|
-
const onUnselectAllFilteredPress = () => treeViewRef.current?.unselectAllFiltered?.();
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<SafeAreaView
|
|
53
|
-
style={styles.mainView}>
|
|
54
|
-
<SearchInput onChange={debouncedSetSearchText} />
|
|
55
|
-
<View
|
|
56
|
-
style={styles.selectionButtonRow}>
|
|
57
|
-
<Button
|
|
58
|
-
title='Select All'
|
|
59
|
-
onPress={onSelectAllPress} />
|
|
60
|
-
<Button
|
|
61
|
-
title='Unselect All'
|
|
62
|
-
onPress={onUnselectAllPress} />
|
|
63
|
-
</View>
|
|
64
|
-
<View
|
|
65
|
-
style={styles.selectionButtonRow}>
|
|
66
|
-
<Button
|
|
67
|
-
title='Select Filtered'
|
|
68
|
-
onPress={onSelectAllFilteredPress} />
|
|
69
|
-
<Button
|
|
70
|
-
title='Unselect Filtered'
|
|
71
|
-
onPress={onUnselectAllFilteredPress} />
|
|
72
|
-
</View>
|
|
73
|
-
|
|
74
|
-
<View
|
|
75
|
-
style={[styles.selectionButtonRow, styles.selectionButtonBottom]}>
|
|
76
|
-
<Button
|
|
77
|
-
title='Expand All'
|
|
78
|
-
onPress={expandAllPress} />
|
|
79
|
-
<Button
|
|
80
|
-
title='Collapse All'
|
|
81
|
-
onPress={collapseAllPress} />
|
|
82
|
-
</View>
|
|
83
|
-
|
|
84
|
-
<View
|
|
85
|
-
style={styles.treeViewParent}>
|
|
86
|
-
<TreeView
|
|
87
|
-
ref={treeViewRef}
|
|
88
|
-
data={sampleData.current}
|
|
89
|
-
onCheck={handleSelectionChange}
|
|
90
|
-
onExpand={handleExpanded}
|
|
91
|
-
/>
|
|
92
|
-
</View>
|
|
93
|
-
</SafeAreaView>
|
|
94
|
-
);
|
|
95
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Button,
|
|
5
|
-
SafeAreaView,
|
|
6
|
-
View
|
|
7
|
-
} from 'react-native';
|
|
8
|
-
|
|
9
|
-
import SearchInput from '../components/SearchInput';
|
|
10
|
-
|
|
11
|
-
import { debounce } from "lodash";
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
TreeView,
|
|
15
|
-
type TreeViewRef
|
|
16
|
-
} from 'react-native-tree-multi-select';
|
|
17
|
-
|
|
18
|
-
import { styles } from './screens.styles';
|
|
19
|
-
import { generateTreeList } from '../utils/sampleDataGenerator';
|
|
20
|
-
|
|
21
|
-
export default function MediumDataScreen() {
|
|
22
|
-
const sampleData = React.useRef(generateTreeList(20, 4, 5));
|
|
23
|
-
const treeViewRef = React.useRef<TreeViewRef | null>(null);
|
|
24
|
-
|
|
25
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
|
-
const debouncedSetSearchText = React.useCallback(
|
|
27
|
-
debounce((text) => treeViewRef.current?.setSearchText(text), 375, {
|
|
28
|
-
leading: true,
|
|
29
|
-
trailing: true,
|
|
30
|
-
maxWait: 750
|
|
31
|
-
}),
|
|
32
|
-
[]
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
const handleSelectionChange = (_checkedIds: string[]) => {
|
|
36
|
-
// NOTE: Handle _checkedIds here
|
|
37
|
-
};
|
|
38
|
-
const handleExpanded = (_expandedIds: string[]) => {
|
|
39
|
-
// NOTE: Handle _expandedIds here
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// Expand collapse calls using ref
|
|
43
|
-
const expandAllPress = () => treeViewRef.current?.expandAll?.();
|
|
44
|
-
const collapseAllPress = () => treeViewRef.current?.collapseAll?.();
|
|
45
|
-
|
|
46
|
-
// Multi-select calls using ref
|
|
47
|
-
const onSelectAllPress = () => treeViewRef.current?.selectAll?.();
|
|
48
|
-
const onUnselectAllPress = () => treeViewRef.current?.unselectAll?.();
|
|
49
|
-
const onSelectAllFilteredPress = () => treeViewRef.current?.selectAllFiltered?.();
|
|
50
|
-
const onUnselectAllFilteredPress = () => treeViewRef.current?.unselectAllFiltered?.();
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<SafeAreaView
|
|
54
|
-
style={styles.mainView}>
|
|
55
|
-
<SearchInput onChange={debouncedSetSearchText} />
|
|
56
|
-
<View
|
|
57
|
-
style={styles.selectionButtonRow}>
|
|
58
|
-
<Button
|
|
59
|
-
title='Select All'
|
|
60
|
-
onPress={onSelectAllPress} />
|
|
61
|
-
<Button
|
|
62
|
-
title='Unselect All'
|
|
63
|
-
onPress={onUnselectAllPress} />
|
|
64
|
-
</View>
|
|
65
|
-
<View
|
|
66
|
-
style={styles.selectionButtonRow}>
|
|
67
|
-
<Button
|
|
68
|
-
title='Select Filtered'
|
|
69
|
-
onPress={onSelectAllFilteredPress} />
|
|
70
|
-
<Button
|
|
71
|
-
title='Unselect Filtered'
|
|
72
|
-
onPress={onUnselectAllFilteredPress} />
|
|
73
|
-
</View>
|
|
74
|
-
|
|
75
|
-
<View
|
|
76
|
-
style={[styles.selectionButtonRow, styles.selectionButtonBottom]}>
|
|
77
|
-
<Button
|
|
78
|
-
title='Expand All'
|
|
79
|
-
onPress={expandAllPress} />
|
|
80
|
-
<Button
|
|
81
|
-
title='Collapse All'
|
|
82
|
-
onPress={collapseAllPress} />
|
|
83
|
-
</View>
|
|
84
|
-
|
|
85
|
-
<View
|
|
86
|
-
style={styles.treeViewParent}>
|
|
87
|
-
<TreeView
|
|
88
|
-
ref={treeViewRef}
|
|
89
|
-
data={sampleData.current}
|
|
90
|
-
onCheck={handleSelectionChange}
|
|
91
|
-
onExpand={handleExpanded}
|
|
92
|
-
/>
|
|
93
|
-
</View>
|
|
94
|
-
</SafeAreaView>
|
|
95
|
-
);
|
|
96
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Button,
|
|
5
|
-
SafeAreaView,
|
|
6
|
-
View
|
|
7
|
-
} from 'react-native';
|
|
8
|
-
|
|
9
|
-
import SearchInput from '../components/SearchInput';
|
|
10
|
-
|
|
11
|
-
import { debounce } from "lodash";
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
TreeView,
|
|
15
|
-
type TreeViewRef
|
|
16
|
-
} from 'react-native-tree-multi-select';
|
|
17
|
-
|
|
18
|
-
import { styles } from './screens.styles';
|
|
19
|
-
import { generateTreeList } from '../utils/sampleDataGenerator';
|
|
20
|
-
|
|
21
|
-
export default function SmallDataScreen() {
|
|
22
|
-
const sampleData = React.useRef(generateTreeList(5, 4, 3));
|
|
23
|
-
const treeViewRef = React.useRef<TreeViewRef | null>(null);
|
|
24
|
-
|
|
25
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
|
-
const debouncedSetSearchText = React.useCallback(
|
|
27
|
-
debounce((text) => treeViewRef.current?.setSearchText(text), 375, {
|
|
28
|
-
leading: true,
|
|
29
|
-
trailing: true,
|
|
30
|
-
maxWait: 750
|
|
31
|
-
}),
|
|
32
|
-
[]
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
const handleSelectionChange = (_checkedIds: string[]) => {
|
|
36
|
-
// NOTE: Handle _checkedIds here
|
|
37
|
-
};
|
|
38
|
-
const handleExpanded = (_expandedIds: string[]) => {
|
|
39
|
-
// NOTE: Handle _expandedIds here
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// Expand collapse calls using ref
|
|
43
|
-
const expandAllPress = () => treeViewRef.current?.expandAll?.();
|
|
44
|
-
const collapseAllPress = () => treeViewRef.current?.collapseAll?.();
|
|
45
|
-
|
|
46
|
-
// Multi-select calls using ref
|
|
47
|
-
const onSelectAllPress = () => treeViewRef.current?.selectAll?.();
|
|
48
|
-
const onUnselectAllPress = () => treeViewRef.current?.unselectAll?.();
|
|
49
|
-
const onSelectAllFilteredPress = () => treeViewRef.current?.selectAllFiltered?.();
|
|
50
|
-
const onUnselectAllFilteredPress = () => treeViewRef.current?.unselectAllFiltered?.();
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<SafeAreaView
|
|
54
|
-
style={styles.mainView}>
|
|
55
|
-
<SearchInput onChange={debouncedSetSearchText} />
|
|
56
|
-
<View
|
|
57
|
-
style={styles.selectionButtonRow}>
|
|
58
|
-
<Button
|
|
59
|
-
title='Select All'
|
|
60
|
-
onPress={onSelectAllPress} />
|
|
61
|
-
<Button
|
|
62
|
-
title='Unselect All'
|
|
63
|
-
onPress={onUnselectAllPress} />
|
|
64
|
-
</View>
|
|
65
|
-
<View
|
|
66
|
-
style={styles.selectionButtonRow}>
|
|
67
|
-
<Button
|
|
68
|
-
title='Select Filtered'
|
|
69
|
-
onPress={onSelectAllFilteredPress} />
|
|
70
|
-
<Button
|
|
71
|
-
title='Unselect Filtered'
|
|
72
|
-
onPress={onUnselectAllFilteredPress} />
|
|
73
|
-
</View>
|
|
74
|
-
|
|
75
|
-
<View
|
|
76
|
-
style={[styles.selectionButtonRow, styles.selectionButtonBottom]}>
|
|
77
|
-
<Button
|
|
78
|
-
title='Expand All'
|
|
79
|
-
onPress={expandAllPress} />
|
|
80
|
-
<Button
|
|
81
|
-
title='Collapse All'
|
|
82
|
-
onPress={collapseAllPress} />
|
|
83
|
-
</View>
|
|
84
|
-
|
|
85
|
-
<View
|
|
86
|
-
style={styles.treeViewParent}>
|
|
87
|
-
<TreeView
|
|
88
|
-
ref={treeViewRef}
|
|
89
|
-
data={sampleData.current}
|
|
90
|
-
onCheck={handleSelectionChange}
|
|
91
|
-
onExpand={handleExpanded}
|
|
92
|
-
/>
|
|
93
|
-
</View>
|
|
94
|
-
</SafeAreaView>
|
|
95
|
-
);
|
|
96
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
|
2
|
-
|
|
3
|
-
export const styles = StyleSheet.create({
|
|
4
|
-
mainView: {
|
|
5
|
-
flex: 1,
|
|
6
|
-
alignSelf: "flex-start",
|
|
7
|
-
backgroundColor: "white",
|
|
8
|
-
},
|
|
9
|
-
selectionButtonRow: {
|
|
10
|
-
borderTopWidth: 0.5,
|
|
11
|
-
borderColor: "lightgrey",
|
|
12
|
-
paddingVertical: 2,
|
|
13
|
-
flexDirection: "row",
|
|
14
|
-
justifyContent: "space-between",
|
|
15
|
-
marginHorizontal: 10,
|
|
16
|
-
},
|
|
17
|
-
selectionButtonBottom: {
|
|
18
|
-
borderBottomWidth: 0.5,
|
|
19
|
-
borderColor: "lightgrey"
|
|
20
|
-
},
|
|
21
|
-
treeViewParent: {
|
|
22
|
-
flex: 1,
|
|
23
|
-
minWidth: "100%"
|
|
24
|
-
}
|
|
25
|
-
});
|