MessageRenderer component.
Configuration
Enable in-app messages when you initialize the SDK:Enable or disable in-app message rendering in your app. Set to
false if you
want to fully suppress all in-app messages.When
true, the SDK automatically fetches pending messages for the identified
user, evaluates trigger conditions, and calls your render callback when a
message is ready to display.How often (in seconds) the SDK polls for new messages. Lower values give more
timely delivery; higher values reduce network activity.
React Native Integration
To render messages, register a callback with the SDK so it can hand off a message object to your component tree whenever one is ready to display.Basic Setup
Automatic Display
WhenautoDisplayMessages is true, the SDK handles the full delivery pipeline for you:
Fetch pending messages
After
identify() is called, the SDK automatically retrieves any pending
messages for that user from the Tappd API.Evaluate trigger conditions
Each message is evaluated against its configured trigger (immediate, timed
delay, or event-based) and expiration date.
Invoke your render callback
When a message is ready to display, the SDK calls the function you
registered with
setMessageRenderCallback(), passing the message object.Track interactions automatically
The SDK automatically tracks
message.viewed, message.clicked, and
message.dismissed events as the user interacts with the message.Manual Control
If you prefer to control when messages are fetched and displayed, you can bypass automatic display and call these methods directly.- Fetch messages
- Display a specific message
- Display all pending messages
- Dismiss a message
Message Types
Banner
Banner
Popup
Popup
Popups are centered modal dialogs built on React Native’s
Modal component,
ideal for drawing focused attention.- Size: ~90% of screen width (max 500 px)
- Overlay: Optional semi-transparent background
- Animation: Fade or scale
- Use cases: Important alerts, confirmations, calls to action
Modal
Modal
Modals are larger centered dialogs with more room for rich content such as
multi-step flows or detailed information.
- Size: ~85% of screen width (max 600 px)
- Overlay: Optional semi-transparent background
- Animation: Fade or scale
- Use cases: Detailed content, forms, multi-step flows
Message Blocks
Messages are composed of one or more content blocks, each rendered as a native React Native component.Image Block
Image Block
Renders images using React Native’s
Image component.| Property | Description |
|---|---|
url | Image URL |
alt | Alt text for accessibility |
width | Image width |
height | Image height |
alignment | left, center, right, or full |
Text Block
Text Block
Renders text content using React Native’s
Text component.| Property | Description |
|---|---|
content | Text content to display |
fontSize | sm, base, lg, xl, 2xl, or a custom size |
fontWeight | normal or bold |
color | Text color (hex, rgb, or named color) |
alignment | left, center, right, or justify |
Button Block
Button Block
HTML Block
HTML Block
Renders arbitrary HTML content using
react-native-render-html.| Property | Description |
|---|---|
content | Full HTML string to render |
react-native-render-html is bundled inside the Tappd Mobile SDK. You do
not need to install it separately in your project.Event Tracking
The SDK tracks all standard message interactions automatically:| Event | Triggered when |
|---|---|
message.viewed | The message is displayed to the user |
message.clicked | A button inside the message is tapped |
message.dismissed | The user dismisses the message |
trackMessageEvent() directly:
Integration with React Navigation
PlaceMessageRenderer at the root of your navigation tree so messages appear above all screens, regardless of which route is currently active:
Complete Example
API Reference
| Method | Returns | Description |
|---|---|---|
setMessageRenderCallback(callback) | void | Registers the function the SDK calls when a message is ready to display. |
getInAppMessages() | Promise<InAppMessage[]> | Fetches all pending in-app messages for the current user. |
displayInAppMessage(message) | Promise<void> | Displays a specific message by calling the registered render callback. |
displayPendingMessages() | Promise<void> | Fetches and displays all messages that are ready to show. |
dismissMessage(messageId) | Promise<void> | Dismisses a message and tracks the message.dismissed event. |
trackMessageEvent(messageId, eventType, metadata?) | Promise<void> | Manually tracks a message interaction with optional metadata. |
Troubleshooting
Messages not displaying
Messages not displaying
Work through this checklist if messages aren’t appearing in your app:
- Confirm
enableInAppMessagesis set totruein your SDK config. - Verify you have called
setMessageRenderCallback()in your root component. - Make sure
identify()has been called — messages are user-specific. - Enable
debug: truein the SDK config and check the console for errors. - Confirm the messages are published in your Tappd dashboard.
- Check that any configured trigger conditions are met.
Messages displaying too frequently
Messages displaying too frequently
If the same message keeps reappearing:
- Increase
messagePollingIntervalto poll less aggressively. - Check the expiration settings on the message in the dashboard.
- Ensure
dismissMessage()is being called correctly when a message is dismissed so the SDK records the dismissal.
Styling issues
Styling issues
If message styles look wrong or conflict with your app:
- Check for
StyleSheetconflicts between your app styles and theMessageRenderercomponent. - Ensure
MessageRendereris rendered at the correct level in the component tree (ideally at the root, above your navigation structure). - Test on both iOS and Android — some styles, such as shadows and font rendering, differ between platforms.