Answers and personalization
Capture answers, validate question screens, save variables, and personalize later screens.
Question inputs#
| Format | Input | Value received |
|---|---|---|
text | Text field. Set fieldStyle to box, filled, underline, pill, or code (one box per character) | String as entered |
number | Numeric field and keypad, with the same fieldStyle options except code | String of digits |
wheel | Scrolling (or a horizontal measuring tape with style: "ruler") numeric wheel | Number string in the base unit |
date | Date wheels | ISO date string |
country | Searchable country picker | English country name |
| Single choice | Tap one option | Selected option label |
| Multiple choice | Select several options | Comma-separated answer and selected values array |
| Interactive canvas | Tap hotspots on an image or blank canvas | Comma-separated labels and selected hotspot IDs |
| Photo input | Choose or take a photo; optional app-owned AI analysis | Photo reference plus selected photo details in callbacks |
Interactive canvas#
Use an interactive canvas when people should tap locations or objects on a photo, map, diagram, or other image. In Studio, choose the Interactive canvas answer format, then upload a raster image or select one from Media. Add hotspots and position them by dragging on the preview or entering X/Y percentages.
| Setting | Values | What it changes |
|---|---|---|
| Canvas width | Automatic, up to 300 px | Centered and capped to match the Studio phone preview. |
| Canvas height | 120–600 px | Height of the tappable image area; the native viewport caps display height at 420 px. |
| Corner radius | 0–40 px | Rounds the canvas and clips its background image to match. |
| Hotspot shape | Circle, Rounded, Chip | Circle and Rounded show a marker with its label above; Chip places the label inside the button. |
| Hotspot size | Small, Medium, Large | Changes the tap target size. |
| Max selections | 1 to the number of hotspots | Limits how many hotspots a person may select. |
| Hotspot position | X and Y from 0–100% | Places each hotspot relative to the canvas. |
The background is optional. Use PNG, JPEG, WebP, or GIF; SVGs and videos are not supported. A blank canvas is useful for placing hotspots over an abstract layout or leaving room for a simple diagram image.
{
"kind": "Question",
"answerType": "positionPicker",
"positionPicker": {
"background": "https://cdn.example.com/map.jpg",
"height": 320,
"cornerRadius": 18,
"hotspotShape": "chip",
"hotspotSize": "medium",
"maxSelections": 2,
"positions": [
{ "id": "park", "label": "Park", "x": 35, "y": 42 },
{ "id": "cafe", "label": "Coffee shop", "x": 72, "y": 68 }
]
}
}onAnswer receives the selected labels as a comma-separated answer and the stable hotspot IDs in its values array. Use those IDs for branching so changing the visible label does not break the branch.
Photo input and AI analysis#
Choose Photo input on a Question screen for a profile picture, progress photo, or another image the person chooses. In Studio, enable Camera, Library, or both. The React Native SDK draws the photo step, while your app supplies native picker access through onPhotoRequest; the app can keep the image local or upload it to storage you control.
Set the button's action to Analyze photo, then continue. When the person taps it, the app analyzes the photo, waits for the result, and moves on so the next screen can show it. If analysis fails, they see the error and can continue without it. onPhotoAnalyze calls your app, which can send the image to your own backend and return a short result, or { summary, scores } to fill score bars and rings: each score becomes a {score_<name>} variable. The SDK never calls an AI provider or stores provider keys. The person can continue without analysis.
<Onboarding
{...onboardingProps}
onPhotoRequest={async (screen, source) => {
const asset = await pickPhotoWithYourNativePicker(source);
if (!asset) return null; // cancelled
const reference = await uploadPhotoIfNeeded(asset.uri);
return { uri: asset.uri, reference };
}}
onPhotoAnalyze={async (screen, photo) => {
return analyzePhotoWithYourBackend(photo.reference ?? photo.uri);
}}
onComplete={(answers, { variables, photos }) => {
saveOnboarding({ answers, variables, photos });
}}
/>Picker return value: the recommended shape is { uri: asset.uri, reference }. Return null only when the person cancels. The SDK also accepts a URI string or the standard Expo ImagePicker { canceled, assets } result, and normalizes absolute file paths to file:// URIs. It needs a readable URI to show the chosen image and “Photo added” confirmation before Continue. If upload succeeds, keep the local asset.uri for the immediate preview and put the durable HTTPS URL in reference for later screens. If the local image cannot be loaded and a reference exists, the SDK tries the reference URL; if neither loads, it shows an integration error.
The picker and upload helpers above belong to your app. Ask for camera/library permission only when needed, explain why the image is collected, and apply your own retention and deletion rules. Local photo URIs are held in memory for this run and excluded from the SDK's resume storage. onComplete receives selected photo details separately in photos, keyed by question screen ID.
Set the photo question's variable to a stable name, such as profile_photo. The answer is a typed photo reference. On a later screen, choose that variable under the image's Personalized photo setting. Set photoInput.analysisVariable in Studio to save AI text as a separate reusable variable.
{
"kind": "Question",
"answerType": "photo",
"variable": "profile_photo",
"photoInput": {
"sources": ["camera", "library"],
"analysis": true,
"analysisVariable": "photo_summary"
}
}Analysis is opt-in per screen and per person. For sensitive images, keep inference on your backend, avoid putting raw image data in text answers, and do not use analysis as a medical diagnosis.
Save and recall variables#
Set a question’s variable field to save the response by name. Reuse it later in titles, subtitles, buttons, loader steps, or checklist text as {name}. Add a fallback with {name|friend}.
Built-in tokens include {app_name}, {first_name}, {today}, and {weekday}. Variables are delivered to onAnswer and onComplete for your app to store or use.
onComplete={(answers, { variables }) => {
saveProfile({ answers, variables });
}}Branch the flow#
Use showIf to display a screen only when an earlier question matches one or more chosen answers. Screens that do not match are skipped, and Back follows the path the person actually saw.
{
"id": "weight-goal",
"kind": "Question",
"showIf": { "screen": "goal", "anyOf": ["Lose weight"] },
"title": "What is your goal weight?",
"subtitle": "We will use this to personalize your plan.",
"button": "Continue",
"accent": "#eef0e6"
}