From 8f66ad73f01b21e075ac094f353c01016d411690 Mon Sep 17 00:00:00 2001 From: Marco Saia Date: Thu, 9 Jan 2025 11:15:56 +0100 Subject: [PATCH 1/2] Change react-native-session-replay access to 'public' --- packages/react-native-session-replay/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native-session-replay/package.json b/packages/react-native-session-replay/package.json index eb7052faf..4741f2126 100644 --- a/packages/react-native-session-replay/package.json +++ b/packages/react-native-session-replay/package.json @@ -35,7 +35,7 @@ "source": "src", "module": "lib/module/index", "publishConfig": { - "access": "restricted" + "access": "public" }, "scripts": { "test": "jest", From 02cf6be23e4e0fb696f27005c16ba9a9565cc17e Mon Sep 17 00:00:00 2001 From: Marco Saia Date: Thu, 9 Jan 2025 11:16:58 +0100 Subject: [PATCH 2/2] Added README.md for react-native-session-replay package --- .../react-native-session-replay/README.md | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/packages/react-native-session-replay/README.md b/packages/react-native-session-replay/README.md index 12c771d63..2cef76ac9 100644 --- a/packages/react-native-session-replay/README.md +++ b/packages/react-native-session-replay/README.md @@ -1,3 +1,54 @@ # Session Replay for React Native -Session Replay for React Native is not available yet. +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. + +## Setup + +**Note:** Make sure you’ve setup and initialized the [Datadog React Native SDK][1] with views instrumentation enabled. + +To install with NPM, run: + +```sh +npm install @datadog/mobile-react-native-session-replay +``` + +To install with Yarn, run: + +```sh +yarn add @datadog/mobile-react-native-session-replay +``` + +## Enable Session Replay + +To enable Session Replay, import and call the `enable` method with your configuration. Below is an example setup: + +```js +import { SessionReplay } from "@datadog/mobile-react-native-session-replay"; + +SessionReplay.enable({ + replaySampleRate: sampleRate // The percentage of sampled replays, in the range 0.0 - 100.0 (Default: 100.0). + textAndInputPrivacyLevel: TextAndInputPrivacyLevel.MASK_ALL, // Defines the way text and input (e.g text fields, checkboxes) should be masked (Default: `MASK_ALL`). + imagePrivacyLevel: ImagePrivacyLevel.MASK_ALL, // Defines the way images should be masked (Default: `MASK_ALL`). + touchPrivacyLevel: TouchPrivacyLevel.HIDE // Defines the way user touches (e.g tap) should be masked (Default: `HIDE`). +}); +``` + +**Note:**: All configuration properties are optional and should be adjusted based on your application's needs. + +## Start or stop the recording manually + +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. + +```js +import { SessionReplay } from "@datadog/mobile-react-native-session-replay"; + +SessionReplay.enable({ + replaySampleRate: sampleRate, + startRecordingImmediately: false +}); +// Do something +SessionReplay.startRecording(); +SessionReplay.stopRecording(); +``` + +[1]: https://www.npmjs.com/package/@datadog/mobile-react-native \ No newline at end of file