Masking sensitive content
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 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
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
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.