React Native In-App

Learn how to handle In-App in React Native.

In-App Notifications

In-app notifications are pop-ups that you can show to your users while they are in your application.

In-App Notification Button onClick callback

To handle the In-App Button onClick add the following code snippet:

CleverTap.addListener(CleverTap.CleverTapInAppNotificationButtonTapped, (event) => {
        _handleCleverTapEvent(CleverTap.CleverTapInAppNotificationButtonTapped, event);
    });

function _handleCleverTapEvent(eventName, event) {
    console.log('CleverTap Event called - ', eventName, event);
}

In-App Notification onDismissed callback

To handle onDismissed callback

CleverTap.addListener(CleverTap.CleverTapInAppNotificationDismissed, (event) => {
        _handleCleverTapEvent(CleverTap.CleverTapInAppNotificationDismissed, event);
    });

function _handleCleverTapEvent(eventName, event) {
    console.log('CleverTap Event called - ', eventName, event);
}

In-App Notification onShow callback

To handle onShow callback

CleverTap.addListener(CleverTap.CleverTapInAppNotificationShowed, (event) => {
        _handleCleverTapEvent(CleverTap.CleverTapInAppNotificationShowed, event);
    });

function _handleCleverTapEvent(eventName, event) {
    console.log('CleverTap Event called - ', eventName, event);
}
📘

Note

CleverTapInAppNotificationShowed on iOS requires React Native SDK v4.0.0+.

Control In-App Notifications

Suspend

Suspends and saves In-App notifications until resumeInAppNotifications method is called for the current session.

CleverTap.suspendInAppNotifications();

Discard

Suspends the display of In-App Notifications and discards the display of any new In-App notification. It also discards In-App notifications until resumeInAppNotifications method is called for the current session.

CleverTap.discardInAppNotifications();

Resume

The resumeInAppNotifications method resumes displaying In-App notifications.

If you call this method after the discardInAppNotifications() method, it resumes the In-App notifications for events raised after the call is performed.

However, if you call the resumeInAppNotifications method after the suspendInAppNotifications() method, then it displays all queued In-App notifications and also resumes In-App notifications for events raised after the call is performed.

CleverTap.resumeInAppNotifications();

Dismiss PIP In-App

The dismissPipInApp() method programmatically dismisses the currently visible PIP (Picture-in-Picture) in-app notification. It is a no-op if no PIP in-app is currently visible, and does not affect other in-app types.

CleverTap.dismissPipInApp();
CleverTap.dismissPipInApp(): void
📘

PIP In-App Information

  • Dismissing a PIP in-app frees the in-app display slot, so the next queued in-app (if any) may show immediately. To keep a screen clear of all in-apps, pair this call with suspendInAppNotifications() on screen entry and resumeInAppNotifications() on exit.
  • Available from React Native SDK v4.3.0 and above.

Did this page help you?
CleverTap Ask AI Widget (CSP-Safe)