Interface: BaseQuestionnaireProviderProps
native/Questionnaire/types.BaseQuestionnaireProviderProps
Hierarchy
BaseQuestionnaireProviderProps
Properties
children
• Optional children: ReactNode
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 }}
Methods
onClose
▸ Optional onClose(ctx): void
Called when the user tries to close the questionnaire
Example:
onClose={navigate.goBack}
Parameters
| Name | Type |
|---|---|
ctx | CloseContext |
Returns
void
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
| Name | Type |
|---|---|
ctx | Progress |
Returns
null | void | Promise<null | void>
transform
▸ Optional transform(ctx): Questionnaire
Change the questionnaire based on the answers
Parameters
| Name | Type |
|---|---|
ctx | Progress |