You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+11-41Lines changed: 11 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,48 +2,13 @@
2
2
3
3
There is some setup that needs to be done to modernise the react-native runtime.
4
4
5
-
1. Turn on [exports map support](https://reactnative.dev/blog/2023/06/21/package-exports-support)
6
-
7
-
```js
8
-
// metro.config.js
9
-
module.exports= {
10
-
resolver: {
11
-
unstable_enablePackageExports:true,
12
-
}
13
-
}
14
-
```
15
-
16
-
2. Shimming globals
5
+
1. Shimming globals
17
6
18
7
Some standard JS APIs aren't available in React Native, these need to be polyfilled, hopefully [not forever](https://github.com/facebook/hermes/discussions/1072).
19
8
20
-
```js
21
-
// globals.js - this should be imported at the top of your App.js file
See [./globals.js](./globals.js) for the changes you need to make.
45
10
46
-
3. Enable modern JS features
11
+
2. Enable modern JS features
47
12
48
13
- libp2p uses [ES2022 private properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_properties) in some places, so enable transpiling them for use with React Native. At the time of writing [loose mode](https://2ality.com/2015/12/babel6-loose-mode.html) is also required.
49
14
@@ -61,6 +26,12 @@ module.exports = {
61
26
}
62
27
```
63
28
29
+
3. Add support for missing Node.js APIs
30
+
31
+
Some dependencies use Node.js APIs so these need to be added to the module resolver.
32
+
33
+
See [./babel-config.js](./babel-config.js) for the changes you need to make.
34
+
64
35
## Running
65
36
66
37
### Prerequisites
@@ -94,15 +65,14 @@ $ npx expo run:ios --device
94
65
95
66
## Notes
96
67
97
-
- By default this demo uses pure-js crypto - it's not efficient enough to run on an actual device, `crypto-browserify` should be replaced with `react-native-quick-crypto` in `babel.config.js` for native builds
98
-
-`@libp2p/webrtc` can also only run on a device since it needs native code
68
+
-`@libp2p/webrtc` can only run on a device since it needs native code
0 commit comments