New in CUX: Mobile Analytics. Analyze real user behavior inside your app. Learn More

Control React Native collection and mask content

Control React Native collection and mask content

Browse topics

On this page

Decide when your React Native app can collect analytics and hide sensitive screen content before capture. Collection controls and screenshot controls serve different purposes.

Package covered: @cuxio/react-native-sdk 1.0.22.

Initialize in a waiting state

Use needConfirmToStart: true in your single SDK initialization. Resume collection after your app obtains the required consent. Do not initialize again when consent changes.

Control data collection

After your app obtains consent:

CUX.resumeCollectingData();

When consent is withdrawn:

CUX.stopCollectingData();

Do not use CUX.reset() as proof that user identity was cleared. Verify account-switch behavior with your integration.

Hide sensitive content

Wrap a sensitive region in CUXMask:

import { Text } from 'react-native';
import { CUXMask } from '@cuxio/react-native-sdk';

<CUXMask>
  <Text>{accountBalance}</Text>
</CUXMask>

accountBalance is your app's displayed value. Check the resulting screenshots on both Android and iOS, including reused components and changing layouts.

You can call CUX.pauseScreenshots() when entering a sensitive flow and CUX.resumeScreenshots() after leaving it. These controls are separate from collection and do not filter event/user-property values. Do not rely on compatibility getters such as isScreenshotsPaused() as runtime proof: the covered JavaScript implementation returns a fixed value.

Verify collection and masking

Use synthetic data on Android and iOS. Check behavior before consent, after consent and after withdrawal. Inspect screenshots after scrolling, navigation and layout changes, including reused list components.

Review screen names, identifiers and event parameters separately. A visual mask does not remove those values. See Mobile masking and privacy for the shared checklist.

If sensitive content appears, stop collection for the affected test, correct the configuration and repeat the journey. Follow React Native troubleshooting if the mask still does not apply.