Skip to content

Commit 374766a

Browse files
authored
add react-native-cloud-kit & react-native-keychain-module & react-native-background-thread (#3)
1 parent 5512d9d commit 374766a

File tree

271 files changed

+22886
-119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

271 files changed

+22886
-119
lines changed

README.md

Lines changed: 4 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -4,122 +4,12 @@
44

55
### Create Nitro Module
66

7-
> **Important**: Avoid generating a new `node_modules` folder. All dependencies should be managed from the monorepo root to avoid conflicts and ensure proper workspace linking.
8-
9-
10-
1. Create project with `npx create-react-native-library@latest` then select turbo module or turbo view
11-
12-
2. Remove `packageManager` field from `package.json` in the new library, then run `yarn` to install dependencies
13-
14-
3. Generate Nitro module code. Run the following command in the module directory to generate `./nitrogen/generated` files, which are required by both iOS and Android.
15-
16-
4. Modify the `react-native.config.js` file in the example directory of the current project to configure the module dependency.
17-
18-
```Javascript
19-
const path = require('path');
20-
const pkg = require('../package.json');
21-
const baseConfig = require('../../../react-native.base.config');
22-
23-
module.exports = {
24-
...baseConfig,
25-
dependencies: {
26-
[pkg.name]: {
27-
root: path.join(__dirname, '..'),
28-
platforms: {
29-
// Codegen script incorrectly fails without this
30-
// So we explicitly specify the platforms with empty object
31-
ios: {},
32-
android: {},
33-
},
34-
},
35-
},
36-
};
37-
```
38-
5. Run `pod install` in the `example/ios` directory of the current module to install dependencies.
39-
40-
6. Now you can start the example app in iOS Simulator to test the module.
41-
42-
7. Modify the `metro.config.js` file in the example directory to configure the monorepo setup:
43-
44-
```
45-
const path = require('path');
46-
const { getDefaultConfig } = require('@react-native/metro-config');
47-
const { withMetroConfig } = require('react-native-monorepo-config');
48-
49-
const root = path.resolve(__dirname, '..');
50-
51-
/**
52-
* Metro configuration
53-
* https://facebook.github.io/metro/docs/configuration
54-
*
55-
* @type {import('metro-config').MetroConfig}
56-
*/
57-
const workspaceRoot = path.resolve(__dirname, '../../../');
58-
const metroConfig = withMetroConfig(getDefaultConfig(__dirname), {
59-
root,
60-
dirname: __dirname,
61-
});
62-
63-
metroConfig.watchFolders = [workspaceRoot];
64-
65-
metroConfig.resolver.nodeModulesPaths = [
66-
path.resolve(root, 'node_modules'),
67-
path.resolve(workspaceRoot, 'node_modules'),
68-
];
69-
70-
module.exports = metroConfig;
71-
72-
```
73-
74-
8. start metro server in `example` folder with `yarn start`
75-
76-
9. Let's talk about Android now. Change `new-library/example/android/settings.gradle`:
77-
78-
```
79-
pluginManagement {
80-
def reactNativeGradlePlugin = new File(
81-
providers.exec {
82-
workingDir(rootDir)
83-
commandLine("node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })")
84-
}.standardOutput.asText.get().trim()
85-
).getParentFile().absolutePath
86-
includeBuild(reactNativeGradlePlugin)
87-
}
88-
plugins { id("com.facebook.react.settings") }
89-
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
90-
rootProject.name = 'onekeyfe.reactnativecheckbiometricauthchanged.example'
91-
include ':app'
92-
93-
def reactNativeGradlePlugin = new File(
94-
providers.exec {
95-
workingDir(rootDir)
96-
commandLine("node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })")
97-
}.standardOutput.asText.get().trim()
98-
).getParentFile().absolutePath
99-
includeBuild(reactNativeGradlePlugin)
100-
```
101-
102-
10. Add the following variables at the top of the react block in `new-library/example/android/app/build.gradle`:
103-
104-
```
105-
react {
106-
reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
107-
hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc"
108-
codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
109-
enableBundleCompression = (findProperty('android.enableBundleCompression') ?: false).toBoolean()
110-
/* Folders */
111-
// The root of your project, i.e. where "package.json" lives. Default is '../..'
112-
// root = file("../../")
113-
// ...
114-
}
7+
```shell
8+
npx create-react-native-library@latest new-lib
1159
```
11610

117-
11. Now you can build and run the Android version.
118-
119-
12. add release script in `package.json`
120-
121-
```json
122-
"release": "yarn nitrogen && yarn prepare && release-it --only-version"
11+
```shell
12+
yarn package:setup new-lib
12313
```
12414

12515

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
9+
indent_style = space
10+
indent_size = 2
11+
12+
end_of_line = lf
13+
charset = utf-8
14+
trim_trailing_whitespace = true
15+
insert_final_newline = true
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.pbxproj -text
2+
# specific for windows script files
3+
*.bat text eol=crlf
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: 🐛 Bug report
2+
description: Report a reproducible bug or regression in this library.
3+
labels: [bug]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
# Bug report
9+
10+
👋 Hi!
11+
12+
**Please fill the following carefully before opening a new issue ❗**
13+
*(Your issue may be closed if it doesn't provide the required pieces of information)*
14+
- type: checkboxes
15+
attributes:
16+
label: Before submitting a new issue
17+
description: Please perform simple checks first.
18+
options:
19+
- label: I tested using the latest version of the library, as the bug might be already fixed.
20+
required: true
21+
- label: I tested using a [supported version](https://github.com/reactwg/react-native-releases/blob/main/docs/support.md) of react native.
22+
required: true
23+
- label: I checked for possible duplicate issues, with possible answers.
24+
required: true
25+
- type: textarea
26+
id: summary
27+
attributes:
28+
label: Bug summary
29+
description: |
30+
Provide a clear and concise description of what the bug is.
31+
If needed, you can also provide other samples: error messages / stack traces, screenshots, gifs, etc.
32+
validations:
33+
required: true
34+
- type: input
35+
id: library-version
36+
attributes:
37+
label: Library version
38+
description: What version of the library are you using?
39+
placeholder: "x.x.x"
40+
validations:
41+
required: true
42+
- type: textarea
43+
id: react-native-info
44+
attributes:
45+
label: Environment info
46+
description: Run `react-native info` in your terminal and paste the results here.
47+
render: shell
48+
validations:
49+
required: true
50+
- type: textarea
51+
id: steps-to-reproduce
52+
attributes:
53+
label: Steps to reproduce
54+
description: |
55+
You must provide a clear list of steps and code to reproduce the problem.
56+
value: |
57+
1. …
58+
2. …
59+
validations:
60+
required: true
61+
- type: input
62+
id: reproducible-example
63+
attributes:
64+
label: Reproducible example repository
65+
description: Please provide a link to a repository on GitHub with a reproducible example.
66+
validations:
67+
required: true
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Feature Request 💡
4+
url: https://github.com/OneKeyHQ/app-modules/react-native-background-thread/discussions/new?category=ideas
5+
about: If you have a feature request, please create a new discussion on GitHub.
6+
- name: Discussions on GitHub 💬
7+
url: https://github.com/OneKeyHQ/app-modules/react-native-background-thread/discussions
8+
about: If this library works as promised but you need help, please ask questions there.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Setup
2+
description: Setup Node.js and install dependencies
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Setup Node.js
8+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
9+
with:
10+
node-version-file: .nvmrc
11+
12+
- name: Restore dependencies
13+
id: yarn-cache
14+
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
15+
with:
16+
path: |
17+
**/node_modules
18+
.yarn/install-state.gz
19+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
20+
restore-keys: |
21+
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
22+
${{ runner.os }}-yarn-
23+
24+
- name: Install dependencies
25+
if: steps.yarn-cache.outputs.cache-hit != 'true'
26+
run: yarn install --immutable
27+
shell: bash
28+
29+
- name: Cache dependencies
30+
if: steps.yarn-cache.outputs.cache-hit != 'true'
31+
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
32+
with:
33+
path: |
34+
**/node_modules
35+
.yarn/install-state.gz
36+
key: ${{ steps.yarn-cache.outputs.cache-primary-key }}

0 commit comments

Comments
 (0)