react-native-my-survey-sdk 2.2.14 → 2.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -63,10 +63,12 @@ function computeSheetHeight(question: XeboQuestion | null, screen: ModalScreen):
|
|
|
63
63
|
const fieldCount = question.options?.length ?? 1;
|
|
64
64
|
return Math.min(SCREEN_HEIGHT * 0.72, SCREEN_HEIGHT * (0.30 + fieldCount * 0.12));
|
|
65
65
|
}
|
|
66
|
+
case XeboQuestionType.dropdown:
|
|
67
|
+
// Must always fit: title + trigger + 200px open list + button + padding + header overhead
|
|
68
|
+
// Minimum ~0.62 regardless of whether options are parsed yet
|
|
69
|
+
return SCREEN_HEIGHT * 0.62;
|
|
66
70
|
case XeboQuestionType.singleChoice:
|
|
67
|
-
case XeboQuestionType.multipleChoice:
|
|
68
|
-
case XeboQuestionType.dropdown: {
|
|
69
|
-
// each option row ≈ 58dp; base includes title + button; 0.085 per option is accurate
|
|
71
|
+
case XeboQuestionType.multipleChoice: {
|
|
70
72
|
const optCount = question.options?.length ?? 0;
|
|
71
73
|
return Math.min(SCREEN_HEIGHT * 0.80, SCREEN_HEIGHT * (0.28 + optCount * 0.085));
|
|
72
74
|
}
|
|
@@ -289,33 +291,8 @@ export const XeboSurveyModal: React.FC = () => {
|
|
|
289
291
|
<View style={styles.handle} />
|
|
290
292
|
</View>
|
|
291
293
|
|
|
292
|
-
{/* Header row:
|
|
294
|
+
{/* Header row: Skip / X close */}
|
|
293
295
|
<View style={styles.headerRow}>
|
|
294
|
-
<View style={styles.progressArea}>
|
|
295
|
-
{screen === 'question' && survey && (() => {
|
|
296
|
-
const realQs = survey.questions.filter((q: XeboQuestion) => q.id !== 'thank_you_auto');
|
|
297
|
-
const total = realQs.length;
|
|
298
|
-
if (total === 0) return null;
|
|
299
|
-
return (
|
|
300
|
-
<View style={styles.progressContainer}>
|
|
301
|
-
<View style={[styles.progressTrack, { backgroundColor: '#E5E7EB' }]}>
|
|
302
|
-
<View
|
|
303
|
-
style={[
|
|
304
|
-
styles.progressFill,
|
|
305
|
-
{
|
|
306
|
-
backgroundColor: theme.primaryColor,
|
|
307
|
-
width: `${((questionIndex + 1) / total) * 100}%` as any,
|
|
308
|
-
},
|
|
309
|
-
]}
|
|
310
|
-
/>
|
|
311
|
-
</View>
|
|
312
|
-
<Text style={[styles.progressText, { color: theme.textColor }]}>
|
|
313
|
-
{questionIndex + 1} / {total}
|
|
314
|
-
</Text>
|
|
315
|
-
</View>
|
|
316
|
-
);
|
|
317
|
-
})()}
|
|
318
|
-
</View>
|
|
319
296
|
{screen === 'thankYou' ? (
|
|
320
297
|
<TouchableOpacity onPress={handleSkip} style={styles.closeButton} activeOpacity={0.7}>
|
|
321
298
|
<Text style={[styles.closeText, { color: theme.textColor }]}>✕</Text>
|
|
@@ -367,34 +344,9 @@ const styles = StyleSheet.create({
|
|
|
367
344
|
},
|
|
368
345
|
headerRow: {
|
|
369
346
|
flexDirection: 'row',
|
|
370
|
-
|
|
347
|
+
justifyContent: 'flex-end',
|
|
371
348
|
paddingHorizontal: 16,
|
|
372
349
|
paddingBottom: 4,
|
|
373
|
-
minHeight: 36,
|
|
374
|
-
},
|
|
375
|
-
progressArea: {
|
|
376
|
-
flex: 1,
|
|
377
|
-
},
|
|
378
|
-
progressContainer: {
|
|
379
|
-
flexDirection: 'row',
|
|
380
|
-
alignItems: 'center',
|
|
381
|
-
gap: 8,
|
|
382
|
-
},
|
|
383
|
-
progressTrack: {
|
|
384
|
-
flex: 1,
|
|
385
|
-
height: 4,
|
|
386
|
-
borderRadius: 2,
|
|
387
|
-
overflow: 'hidden',
|
|
388
|
-
},
|
|
389
|
-
progressFill: {
|
|
390
|
-
height: 4,
|
|
391
|
-
borderRadius: 2,
|
|
392
|
-
},
|
|
393
|
-
progressText: {
|
|
394
|
-
fontSize: 12,
|
|
395
|
-
opacity: 0.6,
|
|
396
|
-
minWidth: 36,
|
|
397
|
-
textAlign: 'right',
|
|
398
350
|
},
|
|
399
351
|
skipButton: {
|
|
400
352
|
paddingHorizontal: 12,
|
|
@@ -118,15 +118,19 @@ export function parseSurvey(data: APISurveyResponse['data']): XeboSurvey {
|
|
|
118
118
|
console.log('[Xebo] Dropdown options.row:', JSON.stringify(q.options?.row));
|
|
119
119
|
console.log('[Xebo] Full dropdown q.options:', JSON.stringify(q.options));
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
const rawOptions = q.options as any;
|
|
122
|
+
const rowSource: any[] = Array.isArray(rawOptions)
|
|
123
|
+
? rawOptions
|
|
124
|
+
: (rawOptions?.row ?? rawOptions?.items ?? rawOptions?.choices ?? []);
|
|
125
|
+
const rows: XeboChoice[] = rowSource.map((r: any) => ({
|
|
126
|
+
id: r.uuid ?? r.id,
|
|
127
|
+
text: stripHTML(r.text ?? r.label ?? r.value ?? ''),
|
|
128
|
+
value: r.uuid ?? r.id,
|
|
125
129
|
}));
|
|
126
|
-
const cols: XeboChoice[] = (
|
|
127
|
-
id: c.uuid,
|
|
128
|
-
text: stripHTML(c.text),
|
|
129
|
-
value: c.uuid,
|
|
130
|
+
const cols: XeboChoice[] = (rawOptions?.col ?? rawOptions?.columns ?? []).map((c: any) => ({
|
|
131
|
+
id: c.uuid ?? c.id,
|
|
132
|
+
text: stripHTML(c.text ?? c.label ?? ''),
|
|
133
|
+
value: c.uuid ?? c.id,
|
|
130
134
|
}));
|
|
131
135
|
|
|
132
136
|
// Build conditional follow-ups for NPS Pro
|