LLQuizWidget
Pre-requisite
Make sure you initialise React Native SDK.
LLQuizWidget
LLQuizWidget
is a quiz based widget UI component. This widget UI supports two kinds of widget:
WidgetKind.TEXT_QUIZ
WidgetKind.IMAGE_QUIZ
import { LLQuizWidget } from '@livelike/react-native';
import { WidgetKind } from '@livelike/javascript';
export function MyWidgetContainer() {
return (
<LLQuizWidget
programId="xxxxx"
widgetId="yyyyy"
widgetKind={WidgetKind.IMAGE_QUIZ}
/>
);
}
Hooks used by LLQuizWidget
LLQuizWidget
LLQuizWidget Props
Customisation
Refer 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 |
widgetKind
widgetKind
Type | Default |
---|---|
WidgetKind (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 { LLQuizWidget, LLWidgetHeaderProps } from '@livelike/react-native';
import { WidgetKind } from '@livelike/javascript';
function MyHeaderComponent(props: LLWidgetHeaderProps){
// your custom widget header component
}
function MyWidget() {
return (
<LLQuizWidget
programId="xxxxx"
widgetId="yyyyy"
widgetKind={WidgetKind.IMAGE_QUIZ}
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.
FooterComponent
FooterComponent
Type | Default |
---|---|
Component of type LLWidgetFooter | LLWidgetFooter |
Refer LLWidgetFooter docs for more details.
Example usage:
import { LLQuizWidget, LLWidgetFooterProps } from '@livelike/react-native';
import { WidgetKind } from '@livelike/javascript';
function MyFooterComponent(props: LLWidgetFooterProps){
// your custom widget footer component
}
function MyWidget() {
return (
<LLQuizWidget
programId="xxxxx"
widgetId="yyyyy"
widgetKind={WidgetKind.IMAGE_QUIZ}
FooterComponent={MyFooterComponent}
/>
);
}
FooterComponentStyles
FooterComponentStyles
Type | Default |
---|---|
StyleSheet of type LLWidgetFooterStyles | No 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
BodyComponent
Type | Default |
---|---|
Component of type LLQuizWidgetBody | LLQuizWidgetBody |
Refer LLQuizWidgetBody in below section for more details.
BodyComponentStyles
BodyComponentStyles
Type | Default |
---|---|
StyleSheet of type LLQuizWidgetBodyStyles | No Default, if present styles props would be applied on top of internal LLQuizWidgetBodyStyles |
BodyComponentStyles
prop that could be used to modify styles of default rendered LLQuizWidgetBody
component.
LLQuizWidgetBody
This is a body component for a quiz widget responsible for rendering quiz choice details and its interaction.
Hooks used by LLQuizWidgetBody
LLQuizWidgetBody
LLQuizWidgetBody
Props
LLQuizWidgetBody
PropsCustomisation
Refer customisation core concepts to understand different level of component customisation.
widgetId
widgetId
Type | Default |
---|---|
String (Required) | No Default |
styles
styles
Type | Default |
---|---|
Stylesheet of type LLVoteWidgetBodyStyles | No 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.
ChoiceOptionComponent
ChoiceOptionComponent
Type | Default |
---|---|
Component of type LLWidgetChoiceOption | LLWidgetChoiceOption |
Refer LLWidgetChoiceOptionin below section for more details.
ChoiceOptionComponentStyles
ChoiceOptionComponentStyles
Type | Default |
---|---|
StyleSheet of type LLWidgetOptionStyles | No Default, if present styles props would be applied on top of internal LLWidgetOptionStyles |
ChoiceOptionComponentStyles
prop that could be used to modify styles of default rendered LLWidgetChoiceOption
component.
LLWidgetChoiceOption
LLWidgetChoiceOption
is a container component that renders quiz widget choice option using LLWidgetOption as its presentational component. It derives all the choice details and interaction handler needed by LLWidgetOption
component.
Hooks used by LLWidgetChoiceOption
LLWidgetChoiceOption
LLWidgetChoiceOption Props
Customisation
Refer customisation core concepts to understand different level of component customisation.
widgetId
widgetId
Type | Default |
---|---|
String (Required) | No Default |
optionIndex
optionIndex
Type | Default |
---|---|
Number (Required) | No Default |
Index of the widget option
selectedOptionIndex
selectedOptionIndex
Type | Default |
---|---|
Number (Required) | -1 when no option is selected |
Index of the selected widget option
onOptionChange
onOptionChange
Type | Default |
---|---|
(optionIndex: number) => void; | No Default |
Function that gets invoked with option index whenever vote option is selected.
OptionComponent
OptionComponent
Type | Default |
---|---|
Component of type LLWidgetOption | LLWidgetOption |
Presentational component for option component.
OptionComponentStyles
OptionComponentStyles
Type | Default |
---|---|
StyleSheet of type LLWidgetOptionStyles | No Default, if present styles props would be applied on top of internal LLWidgetOptionStyles |
OptionComponentStyles
prop that could be used to modify styles of default rendered LLWidgetOption
component.
Updated about 1 year ago