Skip to content

Commit 02cf6be

Browse files
Added README.md for react-native-session-replay package
1 parent 8f66ad7 commit 02cf6be

File tree

1 file changed

+52
-1
lines changed
  • packages/react-native-session-replay

1 file changed

+52
-1
lines changed
Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,54 @@
11
# Session Replay for React Native
22

3-
Session Replay for React Native is not available yet.
3+
Mobile Session Replay expands visibility into your mobile applications by visually replaying each user interaction, such as taps, swipes, and scrolls. Visually replaying user interactions on your applications makes it easier to reproduce crashes and errors, as well as understand the user journey for making UI improvements.
4+
5+
## Setup
6+
7+
**Note:** Make sure you’ve setup and initialized the [Datadog React Native SDK][1] with views instrumentation enabled.
8+
9+
To install with NPM, run:
10+
11+
```sh
12+
npm install @datadog/mobile-react-native-session-replay
13+
```
14+
15+
To install with Yarn, run:
16+
17+
```sh
18+
yarn add @datadog/mobile-react-native-session-replay
19+
```
20+
21+
## Enable Session Replay
22+
23+
To enable Session Replay, import and call the `enable` method with your configuration. Below is an example setup:
24+
25+
```js
26+
import { SessionReplay } from "@datadog/mobile-react-native-session-replay";
27+
28+
SessionReplay.enable({
29+
replaySampleRate: sampleRate // The percentage of sampled replays, in the range 0.0 - 100.0 (Default: 100.0).
30+
textAndInputPrivacyLevel: TextAndInputPrivacyLevel.MASK_ALL, // Defines the way text and input (e.g text fields, checkboxes) should be masked (Default: `MASK_ALL`).
31+
imagePrivacyLevel: ImagePrivacyLevel.MASK_ALL, // Defines the way images should be masked (Default: `MASK_ALL`).
32+
touchPrivacyLevel: TouchPrivacyLevel.HIDE // Defines the way user touches (e.g tap) should be masked (Default: `HIDE`).
33+
});
34+
```
35+
36+
**Note:**: All configuration properties are optional and should be adjusted based on your application's needs.
37+
38+
## Start or stop the recording manually
39+
40+
By default, Session Replay starts recording automatically. However, if you prefer to manually start recording at a specific point in your application, you can use the optional `startRecordingImmediately` parameter as shown below, and later call `SessionReplay.startRecording()`. You can also use `SessionReplay.stopRecording()` to stop the recording anytime.
41+
42+
```js
43+
import { SessionReplay } from "@datadog/mobile-react-native-session-replay";
44+
45+
SessionReplay.enable({
46+
replaySampleRate: sampleRate,
47+
startRecordingImmediately: false
48+
});
49+
// Do something
50+
SessionReplay.startRecording();
51+
SessionReplay.stopRecording();
52+
```
53+
54+
[1]: https://www.npmjs.com/package/@datadog/mobile-react-native

0 commit comments

Comments
 (0)