react-native-tree-multi-select 0.8.7 → 0.8.8

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.
Files changed (66) hide show
  1. package/lib/commonjs/TreeView.js +14 -12
  2. package/lib/commonjs/TreeView.js.map +1 -1
  3. package/lib/commonjs/components/NodeList.js +12 -8
  4. package/lib/commonjs/components/NodeList.js.map +1 -1
  5. package/lib/commonjs/constants/treeView.constants.js +9 -0
  6. package/lib/commonjs/constants/treeView.constants.js.map +1 -0
  7. package/lib/commonjs/helpers/expandCollapse.helper.js +6 -6
  8. package/lib/commonjs/helpers/expandCollapse.helper.js.map +1 -1
  9. package/lib/commonjs/helpers/initNodeMap.helper.js +2 -2
  10. package/lib/commonjs/helpers/initNodeMap.helper.js.map +1 -1
  11. package/lib/commonjs/helpers/selectAll.helper.js +5 -5
  12. package/lib/commonjs/helpers/selectAll.helper.js.map +1 -1
  13. package/lib/commonjs/helpers/toggleCheckbox.helper.js +2 -2
  14. package/lib/commonjs/helpers/toggleCheckbox.helper.js.map +1 -1
  15. package/lib/commonjs/store/{global.store.js → treeView.store.js} +9 -9
  16. package/lib/commonjs/store/treeView.store.js.map +1 -0
  17. package/lib/module/TreeView.js +14 -12
  18. package/lib/module/TreeView.js.map +1 -1
  19. package/lib/module/components/NodeList.js +12 -8
  20. package/lib/module/components/NodeList.js.map +1 -1
  21. package/lib/module/constants/treeView.constants.js +2 -0
  22. package/lib/module/constants/treeView.constants.js.map +1 -0
  23. package/lib/module/helpers/expandCollapse.helper.js +6 -6
  24. package/lib/module/helpers/expandCollapse.helper.js.map +1 -1
  25. package/lib/module/helpers/initNodeMap.helper.js +2 -2
  26. package/lib/module/helpers/initNodeMap.helper.js.map +1 -1
  27. package/lib/module/helpers/selectAll.helper.js +5 -5
  28. package/lib/module/helpers/selectAll.helper.js.map +1 -1
  29. package/lib/module/helpers/toggleCheckbox.helper.js +2 -2
  30. package/lib/module/helpers/toggleCheckbox.helper.js.map +1 -1
  31. package/lib/module/store/{global.store.js → treeView.store.js} +7 -7
  32. package/lib/module/store/treeView.store.js.map +1 -0
  33. package/lib/typescript/TreeView.d.ts.map +1 -1
  34. package/lib/typescript/components/NodeList.d.ts +1 -9
  35. package/lib/typescript/components/NodeList.d.ts.map +1 -1
  36. package/lib/typescript/constants/treeView.constants.d.ts +2 -0
  37. package/lib/typescript/constants/treeView.constants.d.ts.map +1 -0
  38. package/lib/typescript/helpers/expandCollapse.helper.d.ts.map +1 -1
  39. package/lib/typescript/helpers/selectAll.helper.d.ts.map +1 -1
  40. package/lib/typescript/store/{global.store.d.ts → treeView.store.d.ts} +7 -6
  41. package/lib/typescript/store/treeView.store.d.ts.map +1 -0
  42. package/lib/typescript/types/treeView.types.d.ts +15 -6
  43. package/lib/typescript/types/treeView.types.d.ts.map +1 -1
  44. package/package.json +1 -1
  45. package/src/TreeView.tsx +22 -12
  46. package/src/components/NodeList.tsx +15 -33
  47. package/src/constants/treeView.constants.ts +1 -0
  48. package/src/helpers/expandCollapse.helper.ts +9 -5
  49. package/src/helpers/initNodeMap.helper.ts +3 -3
  50. package/src/helpers/selectAll.helper.ts +9 -5
  51. package/src/helpers/toggleCheckbox.helper.ts +2 -2
  52. package/src/store/{global.store.ts → treeView.store.ts} +11 -9
  53. package/src/types/treeView.types.ts +27 -10
  54. package/android/build.gradle +0 -94
  55. package/android/gradle.properties +0 -5
  56. package/android/src/main/AndroidManifest.xml +0 -4
  57. package/android/src/main/java/com/treemultiselect/TreeMultiSelectModule.kt +0 -25
  58. package/android/src/main/java/com/treemultiselect/TreeMultiSelectPackage.kt +0 -17
  59. package/ios/TreeMultiSelect-Bridging-Header.h +0 -2
  60. package/ios/TreeMultiSelect.mm +0 -14
  61. package/ios/TreeMultiSelect.swift +0 -8
  62. package/ios/TreeMultiSelect.xcodeproj/project.pbxproj +0 -283
  63. package/lib/commonjs/store/global.store.js.map +0 -1
  64. package/lib/module/store/global.store.js.map +0 -1
  65. package/lib/typescript/store/global.store.d.ts.map +0 -1
  66. package/react-native-tree-multi-select.podspec +0 -41
@@ -4,22 +4,19 @@ import {
4
4
  StyleSheet,
5
5
 
6
6
  TouchableOpacity,
7
- type TouchableOpacityProps,
8
7
  } from "react-native";
9
8
  import { FlashList } from "@shopify/flash-list";
10
9
 
11
10
  import type {
12
- TreeFlatListProps,
13
11
  TreeNode,
14
12
 
15
13
  CheckboxValueType,
16
- ExpandIconProps,
17
- CheckBoxViewStyleProps,
18
- CheckBoxViewProps,
19
14
  __FlattenedTreeNode__,
15
+ NodeListProps,
16
+ NodeProps,
20
17
  } from "../types/treeView.types";
21
18
 
22
- import { useStore } from "../store/global.store";
19
+ import { useTreeViewStore } from "../store/treeView.store";
23
20
  import {
24
21
  doesNodeContainSearchTerm,
25
22
  handleToggleExpand,
@@ -27,15 +24,7 @@ import {
27
24
  } from "../helpers";
28
25
  import { CheckboxView } from "./CheckboxView";
29
26
  import CustomExpandCollapseIcon from "./CustomExpandCollapseIcon";
30
-
31
- interface NodeListProps {
32
- treeFlashListProps?: TreeFlatListProps;
33
- checkBoxViewStyleProps?: CheckBoxViewStyleProps;
34
-
35
- CheckboxComponent?: React.ComponentType<CheckBoxViewProps>;
36
- ExpandCollapseIconComponent?: React.ComponentType<ExpandIconProps>;
37
- ExpandCollapseTouchableComponent?: React.ComponentType<TouchableOpacityProps>;
38
- }
27
+ import { defaultIndentationMultiplier } from "../constants/treeView.constants";
39
28
 
40
29
  const NodeList = React.memo(_NodeList);
41
30
  export default NodeList;
@@ -44,6 +33,7 @@ function _NodeList(props: NodeListProps) {
44
33
  const {
45
34
  treeFlashListProps,
46
35
  checkBoxViewStyleProps,
36
+ indentationMultiplier,
47
37
 
48
38
  CheckboxComponent,
49
39
  ExpandCollapseIconComponent,
@@ -52,11 +42,11 @@ function _NodeList(props: NodeListProps) {
52
42
 
53
43
  const {
54
44
  expanded,
55
- globalData,
45
+ initialTreeViewData,
56
46
  updatedInnerMostChildrenIds,
57
47
  searchKeys,
58
48
  searchText
59
- } = useStore();
49
+ } = useTreeViewStore();
60
50
 
61
51
  const [filteredTree, setFilteredTree] = React.useState<TreeNode[]>([]);
62
52
  const [flattenedFilteredNodes, setFlattenedFilteredNodes]
@@ -85,9 +75,9 @@ function _NodeList(props: NodeListProps) {
85
75
  return filtered;
86
76
  };
87
77
 
88
- const tempFilterTree = filterTreeData(globalData);
78
+ const tempFilterTree = filterTreeData(initialTreeViewData);
89
79
  setFilteredTree(tempFilterTree);
90
- }, [searchText, searchKeys, globalData]);
80
+ }, [searchText, searchKeys, initialTreeViewData]);
91
81
 
92
82
  React.useEffect(() => {
93
83
  const flattenTreeData = (
@@ -134,6 +124,7 @@ function _NodeList(props: NodeListProps) {
134
124
  level={item.level || 0}
135
125
 
136
126
  checkBoxViewStyleProps={checkBoxViewStyleProps}
127
+ indentationMultiplier={indentationMultiplier}
137
128
 
138
129
  CheckboxComponent={CheckboxComponent}
139
130
  ExpandCollapseIconComponent={ExpandCollapseIconComponent}
@@ -144,7 +135,8 @@ function _NodeList(props: NodeListProps) {
144
135
  CheckboxComponent,
145
136
  ExpandCollapseIconComponent,
146
137
  ExpandCollapseTouchableComponent,
147
- checkBoxViewStyleProps
138
+ checkBoxViewStyleProps,
139
+ indentationMultiplier
148
140
  ]);
149
141
 
150
142
  return (
@@ -168,17 +160,6 @@ function HeaderFooterView() {
168
160
  );
169
161
  }
170
162
 
171
- interface NodeProps {
172
- node: __FlattenedTreeNode__;
173
- level: number;
174
-
175
- checkBoxViewStyleProps?: CheckBoxViewStyleProps;
176
-
177
- ExpandCollapseIconComponent?: React.ComponentType<ExpandIconProps>;
178
- CheckboxComponent?: React.ComponentType<CheckBoxViewProps>;
179
- ExpandCollapseTouchableComponent?: React.ComponentType<TouchableOpacityProps>;
180
- }
181
-
182
163
  function getValue(
183
164
  isChecked: boolean,
184
165
  isIndeterminate: boolean
@@ -199,13 +180,14 @@ function _Node(props: NodeProps) {
199
180
  level,
200
181
 
201
182
  checkBoxViewStyleProps,
183
+ indentationMultiplier = defaultIndentationMultiplier,
202
184
 
203
185
  ExpandCollapseIconComponent = CustomExpandCollapseIcon,
204
186
  CheckboxComponent = CheckboxView,
205
187
  ExpandCollapseTouchableComponent = TouchableOpacity,
206
188
  } = props;
207
189
 
208
- const { expanded, checked, indeterminate } = useStore();
190
+ const { expanded, checked, indeterminate } = useTreeViewStore();
209
191
 
210
192
  const isChecked = checked.has(node.id);
211
193
  const isIndeterminate = indeterminate.has(node.id);
@@ -228,7 +210,7 @@ function _Node(props: NodeProps) {
228
210
  return (
229
211
  <View style={[
230
212
  styles.nodeParentView,
231
- { marginLeft: level * 15, }
213
+ { marginStart: level * indentationMultiplier, }
232
214
  ]}>
233
215
  <View style={styles.nodeCheckboxAndArrowRow}>
234
216
  <CheckboxComponent
@@ -0,0 +1 @@
1
+ export const defaultIndentationMultiplier = 15;
@@ -1,5 +1,5 @@
1
1
  import { TreeNode } from "../types/treeView.types";
2
- import { useStore } from "../store/global.store";
2
+ import { useTreeViewStore } from "../store/treeView.store";
3
3
 
4
4
  /**
5
5
  * Toggle the expanded state of a tree node by its ID.
@@ -10,7 +10,11 @@ import { useStore } from "../store/global.store";
10
10
  * @param id - The ID of the tree node to toggle.
11
11
  */
12
12
  export function handleToggleExpand(id: string) {
13
- const { globalData, expanded, updateExpanded } = useStore.getState();
13
+ const {
14
+ initialTreeViewData,
15
+ expanded,
16
+ updateExpanded
17
+ } = useTreeViewStore.getState();
14
18
 
15
19
  // Create a new Set based on the current expanded state
16
20
  const newExpanded = new Set(expanded);
@@ -50,7 +54,7 @@ export function handleToggleExpand(id: string) {
50
54
  }
51
55
 
52
56
  // Find the node to expand or collapse
53
- const node = findNode(globalData);
57
+ const node = findNode(initialTreeViewData);
54
58
 
55
59
  if (expanded.has(id)) {
56
60
  // If the node is currently expanded, collapse it and its descendants
@@ -71,7 +75,7 @@ export function handleToggleExpand(id: string) {
71
75
  * Expand all nodes in the tree.
72
76
  */
73
77
  export function expandAll() {
74
- const { nodeMap, updateExpanded } = useStore.getState();
78
+ const { nodeMap, updateExpanded } = useTreeViewStore.getState();
75
79
  // Create a new Set containing the IDs of all nodes
76
80
  const newExpanded = new Set(nodeMap.keys());
77
81
  updateExpanded(newExpanded);
@@ -81,7 +85,7 @@ export function expandAll() {
81
85
  * Collapse all nodes in the tree.
82
86
  */
83
87
  export function collapseAll() {
84
- const { updateExpanded } = useStore.getState();
88
+ const { updateExpanded } = useTreeViewStore.getState();
85
89
  // Create an empty Set
86
90
  const newExpanded = new Set<string>();
87
91
  updateExpanded(newExpanded);
@@ -1,7 +1,7 @@
1
1
  import type { TreeNode } from "../types/treeView.types";
2
2
  import {
3
- useStore
4
- } from "../store/global.store";
3
+ useTreeViewStore
4
+ } from "../store/treeView.store";
5
5
  import { toggleCheckboxes } from "./toggleCheckbox.helper";
6
6
 
7
7
  /**
@@ -20,7 +20,7 @@ export function initializeNodeMaps(
20
20
  const {
21
21
  updateNodeMap,
22
22
  updateChildToParentMap
23
- } = useStore.getState();
23
+ } = useTreeViewStore.getState();
24
24
 
25
25
  const tempNodeMap: Map<string, TreeNode> = new Map();;
26
26
  const tempChildToParentMap: Map<string, string> = new Map();;
@@ -1,4 +1,4 @@
1
- import { useStore } from "../store/global.store";
1
+ import { useTreeViewStore } from "../store/treeView.store";
2
2
  import { toggleCheckboxes } from "./toggleCheckbox.helper";
3
3
 
4
4
  /**
@@ -7,7 +7,7 @@ import { toggleCheckboxes } from "./toggleCheckbox.helper";
7
7
  * If there is no search text, then it selects all nodes; otherwise, it selects all visible nodes.
8
8
  */
9
9
  export function selectAllFiltered() {
10
- const { searchText, innerMostChildrenIds } = useStore.getState();
10
+ const { searchText, innerMostChildrenIds } = useTreeViewStore.getState();
11
11
 
12
12
 
13
13
  // If there's no search text, select all nodes
@@ -25,7 +25,7 @@ export function selectAllFiltered() {
25
25
  * If there is no search text, then it unselects all nodes; otherwise, it unselects all visible nodes.
26
26
  */
27
27
  export function unselectAllFiltered() {
28
- const { searchText, innerMostChildrenIds } = useStore.getState();
28
+ const { searchText, innerMostChildrenIds } = useTreeViewStore.getState();
29
29
 
30
30
  // If there's no search text, unselect all nodes
31
31
  if (!searchText) {
@@ -42,7 +42,11 @@ export function unselectAllFiltered() {
42
42
  * This function selects all nodes by adding all node ids to the checked set and clearing the indeterminate set.
43
43
  */
44
44
  export function selectAll() {
45
- const { nodeMap, updateChecked, updateIndeterminate } = useStore.getState();
45
+ const {
46
+ nodeMap,
47
+ updateChecked,
48
+ updateIndeterminate
49
+ } = useTreeViewStore.getState();
46
50
 
47
51
  // Create a new set containing the ids of all nodes
48
52
  const newChecked = new Set(nodeMap.keys());
@@ -58,7 +62,7 @@ export function selectAll() {
58
62
  * This function unselects all nodes by clearing both the checked and indeterminate sets.
59
63
  */
60
64
  export function unselectAll() {
61
- const { updateChecked, updateIndeterminate } = useStore.getState();
65
+ const { updateChecked, updateIndeterminate } = useTreeViewStore.getState();
62
66
  // Update the state to mark all nodes as unchecked
63
67
 
64
68
  updateChecked(new Set());
@@ -1,4 +1,4 @@
1
- import { useStore } from "../store/global.store";
1
+ import { useTreeViewStore } from "../store/treeView.store";
2
2
 
3
3
  /**
4
4
  * Function to toggle checkbox state for a tree structure.
@@ -17,7 +17,7 @@ export function toggleCheckboxes(ids: string[], forceCheck?: boolean) {
17
17
 
18
18
  nodeMap,
19
19
  childToParentMap
20
- } = useStore.getState();
20
+ } = useTreeViewStore.getState();
21
21
 
22
22
  // Create new sets for checked and indeterminate state so as not to mutate the original state.
23
23
  const tempChecked = new Set(checked);
@@ -2,7 +2,7 @@ import type { TreeNode } from "src/types/treeView.types";
2
2
 
3
3
  import { create } from 'zustand';
4
4
 
5
- export type GlobalState = {
5
+ type TreeViewState = {
6
6
  checked: Set<string>;
7
7
  updateChecked: (checked: Set<string>) => void;
8
8
 
@@ -12,8 +12,8 @@ export type GlobalState = {
12
12
  expanded: Set<string>;
13
13
  updateExpanded: (expanded: Set<string>) => void;
14
14
 
15
- globalData: TreeNode[];
16
- updateGlobalData: (globalData: TreeNode[]) => void;
15
+ initialTreeViewData: TreeNode[];
16
+ updateInitialTreeViewData: (initialTreeViewData: TreeNode[]) => void;
17
17
 
18
18
  nodeMap: Map<string, TreeNode>;
19
19
  updateNodeMap: (nodeMap: Map<string, TreeNode>) => void;
@@ -30,10 +30,10 @@ export type GlobalState = {
30
30
  innerMostChildrenIds: string[];
31
31
  updatedInnerMostChildrenIds: (innerMostChildrenIds: string[]) => void;
32
32
 
33
- cleanUpGlobalStore: () => void;
33
+ cleanUpTreeViewStore: () => void;
34
34
  };
35
35
 
36
- export const useStore = create<GlobalState>((set) => ({
36
+ export const useTreeViewStore = create<TreeViewState>((set) => ({
37
37
  checked: new Set(),
38
38
  updateChecked: (checked: Set<string>) => set({ checked }),
39
39
 
@@ -43,8 +43,10 @@ export const useStore = create<GlobalState>((set) => ({
43
43
  expanded: new Set<string>(),
44
44
  updateExpanded: (expanded: Set<string>) => set({ expanded }),
45
45
 
46
- globalData: [],
47
- updateGlobalData: (globalData: TreeNode[]) => set({ globalData }),
46
+ initialTreeViewData: [],
47
+ updateInitialTreeViewData: (initialTreeViewData: TreeNode[]) => set({
48
+ initialTreeViewData
49
+ }),
48
50
 
49
51
  nodeMap: new Map<string, TreeNode>(),
50
52
  updateNodeMap: (nodeMap: Map<string, TreeNode>) => set({ nodeMap }),
@@ -61,12 +63,12 @@ export const useStore = create<GlobalState>((set) => ({
61
63
  innerMostChildrenIds: [],
62
64
  updatedInnerMostChildrenIds: (innerMostChildrenIds: string[]) => set({ innerMostChildrenIds }),
63
65
 
64
- cleanUpGlobalStore: () =>
66
+ cleanUpTreeViewStore: () =>
65
67
  set({
66
68
  checked: new Set(),
67
69
  indeterminate: new Set(),
68
70
  expanded: new Set<string>(),
69
- globalData: [],
71
+ initialTreeViewData: [],
70
72
  nodeMap: new Map<string, TreeNode>(),
71
73
  childToParentMap: new Map<string, string>(),
72
74
  searchText: "",
@@ -1,4 +1,9 @@
1
- import type { StyleProp, TextProps, TouchableOpacityProps, ViewStyle } from "react-native";
1
+ import type {
2
+ StyleProp,
3
+ TextProps,
4
+ TouchableOpacityProps,
5
+ ViewStyle
6
+ } from "react-native";
2
7
  import type { FlashListProps } from "@shopify/flash-list";
3
8
  import {
4
9
  type Props as RNPaperCheckboxAndroidProps
@@ -28,22 +33,34 @@ export type TreeFlatListProps<ItemT = any> = Omit<
28
33
  | "renderItem"
29
34
  >;
30
35
 
31
- export interface TreeViewProps {
32
- data: TreeNode[];
33
-
34
- onCheck?: (checkedIds: string[]) => void;
35
- onExpand?: (expandedIds: string[]) => void;
36
-
37
- preselectedIds?: string[],
38
-
39
- treeFlashListProps?: TreeFlatListProps;
36
+ export interface TreeItemCustomizations {
40
37
  checkBoxViewStyleProps?: CheckBoxViewStyleProps;
41
38
 
39
+ indentationMultiplier?: number;
40
+
42
41
  CheckboxComponent?: React.ComponentType<CheckBoxViewProps>;
43
42
  ExpandCollapseIconComponent?: React.ComponentType<ExpandIconProps>;
44
43
  ExpandCollapseTouchableComponent?: React.ComponentType<TouchableOpacityProps>;
45
44
  }
46
45
 
46
+ export interface NodeProps extends TreeItemCustomizations {
47
+ node: __FlattenedTreeNode__;
48
+ level: number;
49
+ }
50
+
51
+ export interface NodeListProps extends TreeItemCustomizations {
52
+ treeFlashListProps?: TreeFlatListProps;
53
+ }
54
+
55
+ export interface TreeViewProps extends NodeListProps {
56
+ data: TreeNode[];
57
+
58
+ onCheck?: (checkedIds: string[]) => void;
59
+ onExpand?: (expandedIds: string[]) => void;
60
+
61
+ preselectedIds?: string[];
62
+ }
63
+
47
64
  type CheckboxProps = Omit<RNPaperCheckboxAndroidProps, "onPress" | "status">;
48
65
 
49
66
  export interface CheckBoxViewStyleProps {
@@ -1,94 +0,0 @@
1
- buildscript {
2
- // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
- def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["TreeMultiSelect_kotlinVersion"]
4
-
5
- repositories {
6
- google()
7
- mavenCentral()
8
- }
9
-
10
- dependencies {
11
- classpath "com.android.tools.build:gradle:7.2.1"
12
- // noinspection DifferentKotlinGradleVersion
13
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14
- }
15
- }
16
-
17
- def isNewArchitectureEnabled() {
18
- return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
19
- }
20
-
21
- apply plugin: "com.android.library"
22
- apply plugin: "kotlin-android"
23
-
24
-
25
- def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
26
-
27
- if (isNewArchitectureEnabled()) {
28
- apply plugin: "com.facebook.react"
29
- }
30
-
31
- def getExtOrDefault(name) {
32
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["TreeMultiSelect_" + name]
33
- }
34
-
35
- def getExtOrIntegerDefault(name) {
36
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["TreeMultiSelect_" + name]).toInteger()
37
- }
38
-
39
- def isAGPVersionGreaterThan(version) {
40
- def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
41
- return agpVersion > version
42
- }
43
-
44
- android {
45
- if (isAGPVersionGreaterThan(7)) {
46
- namespace "com.treemultiselect"
47
- }
48
-
49
- compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
50
-
51
- defaultConfig {
52
- minSdkVersion getExtOrIntegerDefault("minSdkVersion")
53
- targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
54
- buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
55
- }
56
- buildTypes {
57
- release {
58
- minifyEnabled false
59
- }
60
- }
61
-
62
- lintOptions {
63
- disable "GradleCompatible"
64
- }
65
-
66
- compileOptions {
67
- sourceCompatibility JavaVersion.VERSION_1_8
68
- targetCompatibility JavaVersion.VERSION_1_8
69
- }
70
-
71
- }
72
-
73
- repositories {
74
- mavenCentral()
75
- google()
76
- }
77
-
78
- def kotlin_version = getExtOrDefault("kotlinVersion")
79
-
80
- dependencies {
81
- // For < 0.71, this will be from the local maven repo
82
- // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
83
- //noinspection GradleDynamicVersion
84
- implementation "com.facebook.react:react-native:+"
85
- implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
86
- }
87
-
88
- if (isNewArchitectureEnabled()) {
89
- react {
90
- jsRootDir = file("../src/")
91
- libraryName = "TreeMultiSelect"
92
- codegenJavaPackageName = "com.treemultiselect"
93
- }
94
- }
@@ -1,5 +0,0 @@
1
- TreeMultiSelect_kotlinVersion=1.8.0
2
- TreeMultiSelect_minSdkVersion=21
3
- TreeMultiSelect_targetSdkVersion=31
4
- TreeMultiSelect_compileSdkVersion=31
5
- TreeMultiSelect_ndkversion=21.4.7075529
@@ -1,4 +0,0 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.treemultiselect">
3
-
4
- </manifest>
@@ -1,25 +0,0 @@
1
- package com.treemultiselect
2
-
3
- import com.facebook.react.bridge.ReactApplicationContext
4
- import com.facebook.react.bridge.ReactContextBaseJavaModule
5
- import com.facebook.react.bridge.ReactMethod
6
- import com.facebook.react.bridge.Promise
7
-
8
- class TreeMultiSelectModule(reactContext: ReactApplicationContext) :
9
- ReactContextBaseJavaModule(reactContext) {
10
-
11
- override fun getName(): String {
12
- return NAME
13
- }
14
-
15
- // Example method
16
- // See https://reactnative.dev/docs/native-modules-android
17
- @ReactMethod
18
- fun multiply(a: Double, b: Double, promise: Promise) {
19
- promise.resolve(a * b)
20
- }
21
-
22
- companion object {
23
- const val NAME = "TreeMultiSelect"
24
- }
25
- }
@@ -1,17 +0,0 @@
1
- package com.treemultiselect
2
-
3
- import com.facebook.react.ReactPackage
4
- import com.facebook.react.bridge.NativeModule
5
- import com.facebook.react.bridge.ReactApplicationContext
6
- import com.facebook.react.uimanager.ViewManager
7
-
8
-
9
- class TreeMultiSelectPackage : ReactPackage {
10
- override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
11
- return listOf(TreeMultiSelectModule(reactContext))
12
- }
13
-
14
- override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
15
- return emptyList()
16
- }
17
- }
@@ -1,2 +0,0 @@
1
- #import <React/RCTBridgeModule.h>
2
- #import <React/RCTViewManager.h>
@@ -1,14 +0,0 @@
1
- #import <React/RCTBridgeModule.h>
2
-
3
- @interface RCT_EXTERN_MODULE(TreeMultiSelect, NSObject)
4
-
5
- RCT_EXTERN_METHOD(multiply:(float)a withB:(float)b
6
- withResolver:(RCTPromiseResolveBlock)resolve
7
- withRejecter:(RCTPromiseRejectBlock)reject)
8
-
9
- + (BOOL)requiresMainQueueSetup
10
- {
11
- return NO;
12
- }
13
-
14
- @end
@@ -1,8 +0,0 @@
1
- @objc(TreeMultiSelect)
2
- class TreeMultiSelect: NSObject {
3
-
4
- @objc(multiply:withB:withResolver:withRejecter:)
5
- func multiply(a: Float, b: Float, resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void {
6
- resolve(a*b)
7
- }
8
- }