Skip to content

Commit fbe706e

Browse files
authored
Merge pull request #135 from JairajJangle/develop
Develop
2 parents bbd6d3d + 77fd268 commit fbe706e

File tree

9 files changed

+5968
-5941
lines changed

9 files changed

+5968
-5941
lines changed

.github/actions/setup/action.yml

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,33 +22,23 @@ runs:
2222
- name: Setup Corepack and Yarn
2323
run: |
2424
corepack enable
25-
corepack prepare [email protected] --activate
25+
corepack prepare [email protected] --activate
26+
yarn --version
2627
shell: bash
2728

28-
# Create required directory and install plugins
29-
- name: Setup plugins
29+
- name: Configure Yarn and Generate .yarnrc.yml
3030
run: |
31-
mkdir -p .yarn/plugins
32-
yarn plugin import @yarnpkg/plugin-interactive-tools
33-
yarn plugin import @yarnpkg/plugin-workspace-tools
31+
yarn set version 4.9.2
32+
yarn config set nodeLinker node-modules
33+
yarn config set nmHoistingLimits workspaces
3434
shell: bash
3535

36-
# Now update .yarnrc.yml to include the plugins
37-
- name: Update Yarn config with plugins
36+
- name: Verify .yarnrc.yml
3837
run: |
39-
cat > .yarnrc.yml << EOF
40-
nodeLinker: node-modules
41-
nmHoistingLimits: workspaces
42-
43-
plugins:
44-
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
45-
spec: "@yarnpkg/plugin-interactive-tools"
46-
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
47-
spec: "@yarnpkg/plugin-workspace-tools"
48-
EOF
38+
cat .yarnrc.yml
4939
shell: bash
5040

51-
- name: Restore cache
41+
- name: Restore Yarn Cache
5242
uses: actions/cache/restore@v4
5343
id: yarn-cache
5444
with:
@@ -66,7 +56,7 @@ runs:
6656
run: yarn install
6757
shell: bash
6858

69-
- name: Save cache
59+
- name: Save Yarn Cache
7060
uses: actions/cache/save@v4
7161
if: steps.yarn-cache.outputs.cache-hit != 'true'
7262
with:
@@ -75,4 +65,4 @@ runs:
7565
.yarn/cache
7666
.yarn/unplugged
7767
.yarn/install-state.gz
78-
key: ${{ steps.yarn-cache.outputs.cache-primary-key || format('{0}-yarn-{1}-{2}', runner.os, hashFiles('yarn.lock'), hashFiles('**/package.json', '!node_modules/**')) }}
68+
key: ${{ steps.yarn-cache.outputs.cache-primary-key }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ android/keystores/debug.keystore
6767
# Yarn
6868
.yarn/
6969
.pnp.*
70+
.yarnrc.yml
7071

7172
# Expo
7273
.expo/

.yarnrc.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,50 @@ Contributions are always welcome, no matter how large or small!
44

55
We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the [code of conduct](./CODE_OF_CONDUCT.md).
66

7-
## Development workflow
7+
## Development Workflow
88

9-
To get started with the project, run `yarn` in the root directory to install the required dependencies for each package:
9+
This project is a monorepo managed using [Yarn Workspaces](https://yarnpkg.com/features/workspaces) with Yarn 4.9.2. It contains the following packages:
1010

11-
```sh
12-
yarn
13-
```
11+
- The library package in the root directory.
12+
- An example app in the `example/` directory.
13+
14+
To get started with the project, follow these steps:
15+
16+
1. **Ensure Node.js is installed**: Use Node.js 22.12.0 or higher (as specified in `.nvmrc`). Install via [nvm](https://github.com/nvm-sh/nvm) if needed:
17+
18+
```sh
19+
nvm install 22.12.0
20+
nvm use 22.12.0
21+
```
22+
23+
2. **Enable Corepack**: Yarn 4.9.2 is managed via Corepack, included with Node.js. Enable it to ensure the correct Yarn version:
24+
25+
```sh
26+
corepack enable
27+
corepack prepare [email protected] --activate
28+
```
29+
30+
3. Set up Yarn configuration: In the root directory, configure Yarn 4.9.2 and generate the .yarnrc.yml file:
31+
32+
```sh
33+
yarn set version 4.9.2
34+
yarn config set nodeLinker node-modules
35+
yarn config set nmHoistingLimits workspaces
36+
```
37+
38+
4. **Install dependencies**: Install dependencies for all packages:
1439

15-
> While it's possible to use [`npm`](https://github.com/npm/cli), the tooling is built around [`yarn`](https://classic.yarnpkg.com/), so you'll have an easier time if you use `yarn` for development.
40+
```sh
41+
yarn
42+
```
1643

17-
While developing, you can run the [example app](/example/) to test your changes. Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild. If you change any native code, then you'll need to rebuild the example app.
44+
> Important: This project relies on Yarn Workspaces and Yarn 4.9.2. Do not use npm or other package managers for development, as they are not compatible with the monorepo setup.
45+
46+
The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make.
47+
48+
It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app.
49+
50+
You can use various commands from the root directory to work with the project.
1851

1952
To start the packager:
2053

@@ -34,6 +67,12 @@ To run the example app on iOS:
3467
yarn example ios
3568
```
3669

70+
To run the example app on Web:
71+
72+
```sh
73+
yarn example web
74+
```
75+
3776
Make sure your code passes TypeScript and ESLint. Run the following to verify:
3877

3978
```sh
@@ -53,10 +92,6 @@ Remember to add tests for your change if possible. Run the unit tests by:
5392
yarn test
5493
```
5594

56-
To edit the Objective-C or Swift files, open `example/ios/TreeMultiSelectExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-tree-multi-select`.
57-
58-
To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-tree-multi-select` under `Android`.
59-
6095

6196
### Commit message convention
6297

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"provenance": true
7979
},
8080
"devDependencies": {
81+
"@babel/runtime": "^7.27.6",
8182
"@commitlint/config-conventional": "^19.7.1",
8283
"@evilmartians/lefthook": "^1.10.10",
8384
"@expo/vector-icons": "14.1.0",
@@ -125,7 +126,7 @@
125126
"optional": true
126127
}
127128
},
128-
"packageManager": "yarn@3.6.1",
129+
"packageManager": "yarn@4.9.2",
129130
"jest": {
130131
"preset": "react-native",
131132
"setupFilesAfterEnv": [
@@ -213,7 +214,7 @@
213214
]
214215
},
215216
"dependencies": {
216-
"@futurejj/react-native-checkbox": "^1.0.3",
217+
"@futurejj/react-native-checkbox": "^1.0.4",
217218
"fast-is-equal": "^1.2.3",
218219
"zustand": "^5.0.5"
219220
},

src/components/CheckboxView.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,15 @@ function _CheckboxView(props: BuiltInCheckBoxViewProps) {
7171
<View
7272
style={checkboxParentViewStyle}>
7373
<Checkbox
74+
testID={`checkbox_${props.testID}`}
7475
{...checkboxProps}
7576
status={customCheckboxValToCheckboxValType(value)}
7677
onPress={onValueChangeModifier} />
7778
</View>
7879

7980
{text ? (
8081
<TouchableOpacity
82+
testID={`touchable_text_${props.testID}`}
8183
style={textTouchableStyle}
8284
onPress={onValueChangeModifier}>
8385
<Text

src/components/NodeList.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,22 @@ function _Node<ID>(props: NodeProps<ID>) {
205205

206206
if (!CustomNodeRowComponent) {
207207
return (
208-
<View style={[
209-
styles.nodeCheckboxAndArrowRow,
210-
{ paddingStart: level * indentationMultiplier }
211-
]}>
208+
<View
209+
testID={`node_row_${node.id}`}
210+
style={[
211+
styles.nodeCheckboxAndArrowRow,
212+
{ paddingStart: level * indentationMultiplier }
213+
]}>
212214
<CheckboxComponent
213215
text={node.name}
214216
onValueChange={_onCheck}
215217
value={value}
218+
testID={`${node.id}`}
216219
{...checkBoxViewStyleProps} />
217220

218221
{node.children?.length ? (
219222
<ExpandCollapseTouchableComponent
223+
testID={`expandable_arrow_${node.id}`}
220224
style={styles.nodeExpandableArrowTouchable}
221225
onPress={_onToggleExpand}>
222226
<ExpandCollapseIconComponent

src/types/treeView.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export interface CheckBoxViewProps {
9696
value: CheckboxValueType;
9797
onValueChange: (value: boolean) => void;
9898
text: string;
99+
testID?: string;
99100
}
100101

101102
export interface BuiltInCheckBoxViewStyleProps {

0 commit comments

Comments
 (0)