LLAlertWidget
Pre-requisiteMake sure you initialise React Native SDK.
LLAlertWidget is a info based read only widget UI component.
import { LLAlertWidget } from '@livelike/react-native';
import { WidgetKind } from '@livelike/javascript';
export function MyWidgetContainer() {
return (
<LLAlertWidget
programId="xxxxx"
widgetId="yyyyy"
/>
);
}Hooks used by LLAlertWidget
LLAlertWidgetLLAlertWidget Props
CustomisationRefer customisation core concepts to understand different level of component customisation.
programId
programId| Type | Default |
|---|---|
| String (Required) | No Default |
This is the Id of the program in which a given widget is published
widgetId
widgetId| Type | Default |
|---|---|
| String (Required) | No Default |
onDismiss
onDismiss| Type | Default |
|---|---|
| Function | No Default |
Function that gets invoked whenever user dismisses the widget by clicking on dismiss Icon.
Pass onDismiss prop (with no op function) to make widget dismissible.
interactiveTimeout
interactiveTimeout| Type | Default |
|---|---|
| Number | No default |
Interactive timeout in epoch. Once the timeout gets elapsed, widget transition into Timed Out phase where it is in disabled state.
When setting interactiveTimeout as null, this overrides widget interactive timeout (that is set from producer suite) and widget becomes always interactive.
onInteractiveTimeout
onInteractiveTimeout| Type | Default |
|---|---|
| Function | No Default |
Function that gets invoked whenever interactive timer gets elapsed. When interactiveTimeout is set to null, onInteractiveTimeout function would never be called.
WidgetComponent
WidgetComponent| Type | Default |
|---|---|
| Component of type LLCoreWidget | LLCoreWidget |
This is the core widget component that is responsible for loading widget details and rendering other part of widget UI (passed as children).
Refer LLCoreWidget docs for more details.
WidgetComponentStyles
WidgetComponentStyles| Type | Default |
|---|---|
| StyleSheet of type LLCoreWidgetStyles | No Default, if present styles props would be applied on top of internal LLCoreWidgetStyles |
WidgetComponentStyles prop that could be used to modify styles of default rendered LLCoreWidget component.
HeaderComponent
HeaderComponent| Type | Default |
|---|---|
| Component of type LLWidgetHeader | LLWidgetHeader |
Refer LLWidgetHeader docs for more details.
Example usage:
import { LLAlertWidget, LLWidgetHeaderProps } from '@livelike/react-native';
import { WidgetKind } from '@livelike/javascript';
function MyHeaderComponent(props: LLWidgetHeaderProps){
// your custom widget header component
}
function MyWidget() {
return (
<LLAlertWidget
programId="xxxxx"
widgetId="yyyyy"
HeaderComponent={MyHeaderComponent}
/>
);
}HeaderComponentStyles
HeaderComponentStyles| Type | Default |
|---|---|
| StyleSheet of type LLWidgetHeaderStyles | No Default, if present styles props would be applied on top of internal LLWidgetHeaderStyles |
HeaderComponentStyles prop that could be used to modify styles of default rendered LLWidgetHeader component.
SponsorComponent
SponsorComponent| Type | Default |
|---|---|
| Component of type LLWidgetSponsor | LLWidgetSponsor |
Component responsible for rendering widget sponsor (based on sponsor selected in producer suite for a given widget).
Example usage:
import { LLAlertWidget, LLWidgetSponsorProps } from '@livelike/react-native';
import { WidgetKind } from '@livelike/javascript';
function MySponsorComponent(props: LLWidgetSponsorProps){
// your custom widget sponsor component
}
function MyWidget() {
return (
<LLAlertWidget
programId="xxxxx"
widgetId="yyyyy"
SponsorComponent={MySponsorComponent}
/>
);
}SponsorComponentStyles
SponsorComponentStyles| Type | Default |
|---|---|
| StyleSheet of type LLWidgetSponsorStyles | No Default, if present styles props would be applied on top of internal LLWidgetSponsorStyles |
SponsorComponentStyles prop that could be used to modify styles of default rendered LLWidgetSponsor component.
BodyComponent
BodyComponent| Type | Default |
|---|---|
| Component of type LLAlertWidgetBody | LLAlertWidgetBody |
Refer LLVoteWidgetBody in below section for more details.
BodyComponentStyles
BodyComponentStyles| Type | Default |
|---|---|
| StyleSheet of type LLAlertWidgetBodyStyles | No Default, if present styles props would be applied on top of internal LLAlertWidgetBodyStyles |
BodyComponentStyles prop that could be used to modify styles of default rendered LLAlertWidgetBody component.
LLAlertWidgetBody
This is a body component for a alert widget responsible for rendering alert text, image and links.
Hooks used by LLAlertWidgetBody
LLAlertWidgetBodyLLAlertWidgetBody Props
LLAlertWidgetBody PropswidgetId
widgetId| Type | Default |
|---|---|
| String (Required) | No Default |
onLinkPress
onLinkPress| Type | Default |
|---|---|
| ({url: string}) => void | No Default |
styles
styles| Type | Default |
|---|---|
| Stylesheet of type LLAlertWidgetBodyStyles | No Default, if present styles props would be applied on top of internal LLAlertWidgetBodyStyles. |
styles prop that could be used to modify styles of LLAlertWidgetBody component.
DetailComponent
DetailComponent| Type | Default |
|---|---|
| Component of type LLAlertWidgetDetail | LLAlertWidgetDetail |
Component responsible for rendering alert widget text (if present) and image (if present).
DetailComponentStyles
DetailComponentStyles| Type | Default |
|---|---|
| StyleSheet of type LLAlertWidgetDetailStyles | No Default, if present styles props would be applied on top of internal LLAlertWidgetDetailStyles |
DetailComponentStyles prop that could be used to modify styles of default rendered LLAlertWidgetDetail component.
LinkComponent
LinkComponent| Type | Default |
|---|---|
| Component of type LLAlertWidgetLink | LLAlertWidgetLink |
Component responsible for rendering alert widget link (if present). When user presses link, onLinkPress prop function gets invoked.
LinkComponentStyles
LinkComponentStyles| Type | Default |
|---|---|
| StyleSheet of type LLAlertWidgetLinkStyles | No Default, if present styles props would be applied on top of internal LLAlertWidgetLinkStyles |
LinkComponentStyles prop that could be used to modify styles of default rendered LLAlertWidgetLink component.
Updated about 2 months ago
