# Masking sensitive content

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fuser-guides%2Frum%2Fsdk-installation%2Freact-native%2Freact-native-plugin%2Ffeatures%2Fmasking.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fuser-guides%2Frum%2Fsdk-installation%2Freact-native%2Freact-native-plugin%2Ffeatures%2Fmasking.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

### Masking Sensitive Content[​](#masking-sensitive-content "Direct link to Masking Sensitive Content")

Masking is not gated on Session Replay. It redacts sensitive content from user-interaction events whether or not you record replays, and when Session Replay is enabled the same mask also hides that content in the recording.

There are two ways to mask, and **`Masked` is recommended**. Mask the whole logical element — the field, the row, the button — rather than an inner fragment of it.

#### `Masked` (recommended)[​](#masked-recommended "Direct link to masked-recommended")

`Masked` is exported from the plugin itself and needs no Session Replay setup. Wrap anything sensitive in it — it renders a `View` and accepts the `View` props, so it can wrap a whole control or just the sensitive part of one:

```
import { Text } from 'react-native';

import { Masked } from '@coralogix/react-native-plugin';



<Masked>

  <Text>Card: {cardNumber}</Text>

</Masked>
```

Do not put `Masked` inside a `<Text>` — wrap the outermost `<Text>` instead.

#### `SessionReplay.maskView`[​](#sessionreplaymaskview "Direct link to sessionreplaymaskview")

Alternatively, pass `SessionReplay.maskView` to the `onLayout` prop of any view. It accepts a `LayoutChangeEvent` and works on both the legacy and the New Architecture (Fabric):

```
import { Text, View } from 'react-native';

import { SessionReplay } from '@coralogix/react-native-plugin';



<View onLayout={SessionReplay.maskView}>

  <Text>{cardNumber}</Text>

</View>
```

Attach it to a host component — a custom component that accepts `onLayout` but never forwards it to a real view is silently not masked. Use `Masked` for a `Switch`; `maskView` cannot flag its interactions.

#### Masked interactions[​](#masked-interactions "Direct link to Masked interactions")

A tap on masked content is still reported, with `interaction_context.target_element_inner_text` redacted to `***` and `interaction_context.is_masked_element: true`. Identity fields and tap coordinates are reported as-is, and a replay recording shows no tap marker. `is_masked_element` is read-only, so use it in `beforeSend` to drop or further redact masked interactions.

Note that `target_element` falls back to `accessibilityLabel`, which is not redacted — give masked keypad keys a shared label (`accessibilityLabel="pin-key"`) rather than the digit they enter.
