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 on In-App Button Click 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 Button onDismissed callback

To handle on Dismissed callback

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

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

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();