@takeoffmedia/react-native-redfast
v0.3.3
Published
redfast implementation to React Native
Downloads
250
Readme
Redfast React Native SDK
The Redfast React Native SDK enables monitoring content consumption and displaying Redfast-configured prompts within your iOS and Android apps. The SDK automatically manages modal prompts (text and banners) and handles related user-triggered events. Inline prompts are available via helper functions that include the necessary metadata for rendering in specific areas of your app.
Installation
Install the SDK using yarn:
yarn add @takeoffmedia/react-native-redfastIntegration with Redfast SDK
initializeSdk
This method initializes the SDK and requires two parameters:
appId: Your unique application ID, available in the Redfast dashboard under the Config section.userId: A unique identifier for the user, also found in the Config section of the dashboard.
Example:
initializeSdk({appId: '123', userId: '456'});getPrompts
Once the SDK is successfully initialized, you can call this method to retrieve the available prompts. This method returns the paths for both Android and iOS platforms.
Example:
const paths = getPrompts();callMethodAtIndex
This method allows you to call a specific prompt based on its index and type of event. It requires the following parameters:
promptId: The unique ID of the prompt.TypeEvent: The type of event to trigger. Currently, the supported event types are:TextInlineBanner
Example:
import { TypeEvent } from '@takeoffmedia/react-native-redfast'
callMethodAtIndex(promptId, TypeEvent.Text);Usage by API rest service
Import and use the main component ContainerRedfast in your app like this:
import { ContainerRedfast, PathType } from '@takeoffmedia/react-native-redfast';
const App = () => {
const APPID = 'your-app-id-from-redfast';
const userId = 'your-user-id';
const valueSendTs = new Date().getTime();
return (
<ContainerRedfast
appId={APPID}
userId={userId}
pathType={PathType.Banner}
valueSendTs={valueSendTs}
/>
);
};
export default App;Properties
| Property | Description | Required |
|-----------------|-----------------------------------------------------------------------------------------------|----------|
| appId | You can find this property in the Redfast dashboard under the config section. | ✅ |
| userId | The unique identifier for the user. | ✅ |
| pathType | Defines the type of prompt. Currently supports TEXT and BANNER. | ✅ |
| valueSendTs | A timestamp value (e.g., new Date().getTime()) indicating the time of initialization. | ✅ |
Example
import React from 'react';
import { ContainerRedfast, PathType } from '@takeoffmedia/react-native-redfast';
const App = () => {
return (
<ContainerRedfast
appId="1234567890"
userId="user123"
pathType={PathType.Text}
valueSendTs={new Date().getTime()}
/>
);
};
export default App;Supported Prompt Types
- Text: Displays text prompts within the app.
- Banners: Shows banner-style prompts.
For more information, visit the Redfast documentation or contact the support team.
