For the complete documentation index, see llms.txt. This page is also available as Markdown.

In-App Message Event Listener

This feature is supported in React Native SDK version 3.15.0 and above.

Interfaces

HackleInAppMessageListener

interface HackleInAppMessageListener {
  beforeInAppMessageOpen?(inAppMessage: HackleInAppMessage): void;
  afterInAppMessageOpen?(inAppMessage: HackleInAppMessage): void;
  beforeInAppMessageClose?(inAppMessage: HackleInAppMessage): void;
  afterInAppMessageClose?(inAppMessage: HackleInAppMessage): void;
  onInAppMessageClick?(
    inAppMessage: HackleInAppMessage,
    view: HackleInAppMessageView,
    action: HackleInAppMessageAction
  ): boolean;
}

onInAppMessageClick

You can control the behavior of the in-app message through the boolean value returned by the onInAppMessageClick method.

  • Returning true overrides the original action of the in-app message.

    • For example, if the original click action was Do not show for a day, that action will not execute.

  • Returning false allows the original action of the in-app message to proceed.

HackleInAppMessage

  • Returns the key of the in-app message.

HackleInAppMessageView

  • You can close the in-app message directly within the listener function by calling close().

HackleInAppMessageAction

property
description

close?.hideDurationMillis

If the action hides the message for a specific period, returns that duration in milliseconds.

link?.url

Returns the link if one is included. e.g) https://hackle.io

link?.shouldCloseAfterLink

Returns true if the close-after-link option is ON.

Usage Example

Registering a Listener

Removing a Listener

  • Pass null to setInAppMessageListener() to remove the registered listener.

Last updated