LLPollWidget

🚧

Pre-requisite

Make sure you initialise React Native SDK.

LLPollWidget

LLPollWidget is a poll based widget UI component. This widget UI supports two kinds of widget:

  1. WidgetKind.TEXT_POLL
  2. WidgetKind.IMAGE_POLL

📘

Snack expo playground

Refer LLPollWidget snack to play around with the widget

import { LLPollWidget } from '@livelike/react-native';
import { WidgetKind } from '@livelike/javascript';

export function MyWidgetContainer() {
  return (
    <LLPollWidget
      programId="xxxxx"
      widgetId="yyyyy"
      widgetKind={WidgetKind.TEXT_POLL}
    />
  );
}

Hooks used by LLPollWidget

Component Hierarchy

LLPollWidget Props

📘

Customisation

Refer customisation core concepts to understand different level of component customisation.

programId

TypeDefault
String (Required)No Default

This is the Id of the program in which a given widget is published

widgetId

TypeDefault
String (Required)No Default

widgetKind

TypeDefault
WidgetKind (Required)No Default

onDismiss

TypeDefault
FunctionNo 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

TypeDefault
NumberNo 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

TypeDefault
FunctionNo Default

Function that gets invoked whenever interactive timer gets elapsed. When interactiveTimeout is set to null, onInteractiveTimeout function would never be called.

WidgetComponent

TypeDefault
Component of type LLCoreWidgetLLCoreWidget

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

TypeDefault
StyleSheet of type LLCoreWidgetStylesNo 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

TypeDefault
Component of type LLWidgetHeaderLLWidgetHeader

Refer LLWidgetHeader docs for more details.

Example usage:
import { LLPollWidget, LLWidgetHeaderProps } from '@livelike/react-native';
import { WidgetKind } from '@livelike/javascript';

function MyHeaderComponent(props: LLWidgetHeaderProps){
  // your custom widget header component
}

function MyWidget() {
  return (
    <LLPollWidget
      programId="xxxxx"
      widgetId="yyyyy"
      widgetKind={WidgetKind.TEXT_POLL}
      HeaderComponent={MyHeaderComponent}
    />
  );
}

HeaderComponentStyles

TypeDefault
StyleSheet of type LLWidgetHeaderStylesNo 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.

FooterComponent

TypeDefault
Component of type LLWidgetFooterLLWidgetFooter

Refer LLWidgetFooter docs for more details.

Example usage:
import { LLPollWidget, LLWidgetFooterProps } from '@livelike/react-native';
import { WidgetKind } from '@livelike/javascript';

function MyFooterComponent(props: LLWidgetFooterProps){
  // your custom widget footer component
}

function MyWidget() {
  return (
    <LLPollWidget
      programId="xxxxx"
      widgetId="yyyyy"
      widgetKind={WidgetKind.TEXT_POLL}
      FooterComponent={MyFooterComponent}
    />
  );
}

FooterComponentStyles

TypeDefault
StyleSheet of type LLWidgetFooterStylesNo Default, if present styles props would be applied on top of internal LLWidgetFooterStyles

FooterComponentStyles prop that could be used to modify styles of default rendered LLWidgetHeader component.

BodyComponent

TypeDefault
Component of type LLVoteWidgetBodyLLVoteWidgetBody

Refer LLVoteWidgetBody in below section for more details.

BodyComponentStyles

TypeDefault
StyleSheet of type LLVoteWidgetBodyStylesNo Default, if present styles props would be applied on top of internal LLVoteWidgetBodyStyles

BodyComponentStyles prop that could be used to modify styles of default rendered LLVoteWidgetBody component.


LLVoteWidgetBody

This is a body component for a vote option based widget responsible for rendering all the option details and its interaction.

Hooks used by LLVoteWidgetBody

LLVoteWidgetBody Props

widgetId

TypeDefault
String (Required)No Default

styles

TypeDefault
Stylesheet of type LLVoteWidgetBodyStylesNo Default, if present styles props would be applied on top of internal LLVoteWidgetBodyStyles.

styles prop that could be used to modify styles of LLVoteWidgetBody component.

VoteOptionComponent

TypeDefault
Component of type LLWidgetVoteOptionLLWidgetVoteOption

Refer LLWidgetVoteOption docs for more details.

VoteOptionComponentStyles

TypeDefault
StyleSheet of type LLWidgetOptionStylesNo Default, if present styles props would be applied on top of internal LLWidgetOptionStyles

VoteOptionComponentStyles prop that could be used to modify styles of default rendered LLWidgetVoteOption component.