Skip to content

Commit abaa96b

Browse files
authored
Merge pull request #127492 from jimchou-dev/patch-6
Update react-native.md
2 parents 5a9adc6 + 1363de4 commit abaa96b

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

articles/communication-services/quickstarts/chat/react-native.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
title: Use Chat SDK with React Native
33
titleSuffix: An Azure Communication Services quickstart
44
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
77
ms.date: 11/30/2021
88
ms.topic: quickstart
99
ms.service: azure-communication-services
@@ -44,20 +44,23 @@ After you [initialize your React Native project](https://reactnative.dev/docs/en
4444
npm install react-native-url-polyfill --save-dev
4545
```
4646

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:
4848

4949
```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'),
5961
};
60-
}
62+
63+
module.exports = config;
6164
```
6265

6366
1. Add the following `import` commands at the top of your entry point file:

0 commit comments

Comments
 (0)