Skip to main content

Interface: QuestionnaireProviderProps

native/Questionnaire/types.QuestionnaireProviderProps

Hierarchy

Properties

children

Optional children: ReactNode

Inherited from

BaseQuestionnaireProviderProps.children


customComponents

Optional customComponents: QuestionnaireComponents

Map of custom components that will replace or add existing composers

Examples:

Add component for custom reply type

customComponents={{ Smiley }}

Replace component for Text reply type

customComponents={{ Text }}

Inherited from

BaseQuestionnaireProviderProps.customComponents


questionnaire

questionnaire: Questionnaire

Methods

onClose

Optional onClose(ctx): void

Called when the user tries to close the questionnaire

Example:

onClose={navigate.goBack}

Parameters

NameType
ctxCloseContext

Returns

void

Inherited from

BaseQuestionnaireProviderProps.onClose


onSubmit

Optional onSubmit(ctx): null | void | Promise<null | void>

Called before submitting questionnaire, this allows you to enable/disable saving the response

Examples:

Don't save the response

onSubmit={console.log()}

Verify the answers before saving

onSubmit={async ({ answers }) => {
const ok = await postJSON('/verify', { answers })
if (ok.valid) {
await submitResponse({ answers })
}
navigation.goBack()
}}

Parameters

NameType
ctxProgress

Returns

null | void | Promise<null | void>

Inherited from

BaseQuestionnaireProviderProps.onSubmit


transform

Optional transform(ctx): Questionnaire

Change the questionnaire based on the answers

Parameters

NameType
ctxProgress

Returns

Questionnaire

Inherited from

BaseQuestionnaireProviderProps.transform