|
2 | 2 | title: Use Chat SDK with React Native
|
3 | 3 | titleSuffix: An Azure Communication Services quickstart
|
4 | 4 | description: This article describes how to use the Azure Communication Services Chat SDK with React Native.
|
5 |
| -author: ashwinder |
6 |
| -ms.author: askaur |
| 5 | +author: awang119 |
| 6 | +ms.author: anniewang |
7 | 7 | ms.date: 11/30/2021
|
8 | 8 | ms.topic: quickstart
|
9 | 9 | ms.service: azure-communication-services
|
@@ -44,20 +44,23 @@ After you [initialize your React Native project](https://reactnative.dev/docs/en
|
44 | 44 | npm install react-native-url-polyfill --save-dev
|
45 | 45 | ```
|
46 | 46 |
|
47 |
| -1. Update _metro.config.js_ to use React Native-compatible Node Core modules: |
| 47 | +1. Create or update the _metro.config.js_ file in the same directory as your _app.js_ file to configure React Native-compatible Node Core modules. If the file doesn’t exist, create a new one with the following content: |
48 | 48 |
|
49 | 49 | ```javascript
|
50 |
| - module.exports = { |
51 |
| - // ... |
52 |
| - resolver: { |
53 |
| - extraNodeModules: { |
54 |
| - ...require('stream-browserify'), |
55 |
| - ...require('node-libs-react-native'), |
56 |
| - net: require.resolve('node-libs-react-native/mock/net'), |
57 |
| - tls: require.resolve('node-libs-react-native/mock/tls') |
58 |
| - } |
| 50 | + // metro.config.js |
| 51 | + |
| 52 | + const { getDefaultConfig } = require('expo/metro-config'); |
| 53 | + |
| 54 | + const config = getDefaultConfig(__dirname); |
| 55 | + |
| 56 | + config.resolver.extraNodeModules = { |
| 57 | + ...require('node-libs-react-native'), |
| 58 | + stream: require.resolve('stream-browserify'), |
| 59 | + net: require.resolve('node-libs-react-native/mock/net'), |
| 60 | + tls: require.resolve('node-libs-react-native/mock/tls'), |
59 | 61 | };
|
60 |
| - } |
| 62 | + |
| 63 | + module.exports = config; |
61 | 64 | ```
|
62 | 65 |
|
63 | 66 | 1. Add the following `import` commands at the top of your entry point file:
|
|
0 commit comments