react-native-my-survey-sdk 3.0.5 → 3.0.7
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XeboRatingView.d.ts","sourceRoot":"","sources":["../../src/components/XeboRatingView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAWhD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGhE,UAAU,KAAK;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;CACxC;
|
|
1
|
+
{"version":3,"file":"XeboRatingView.d.ts","sourceRoot":"","sources":["../../src/components/XeboRatingView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAWhD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGhE,UAAU,KAAK;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;CACxC;AAsID,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAuI1C,CAAC"}
|
|
@@ -84,16 +84,10 @@ function FlatEmoji({ index, selected }) {
|
|
|
84
84
|
function RatingIcon({ style, index, selected, filled, color, }) {
|
|
85
85
|
const activeColor = color || '#F59E0B';
|
|
86
86
|
switch (style) {
|
|
87
|
-
case 'heart':
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
backgroundColor: filled ? activeColor : 'transparent',
|
|
92
|
-
borderWidth: filled ? 0 : 2,
|
|
93
|
-
borderColor: activeColor,
|
|
94
|
-
opacity: filled ? 1 : 0.4,
|
|
95
|
-
}}/>);
|
|
96
|
-
}
|
|
87
|
+
case 'heart':
|
|
88
|
+
return (<react_native_1.Text style={{ fontSize: 34, color: filled ? activeColor : '#E5E7EB' }}>
|
|
89
|
+
{filled ? '♥' : '♡'}
|
|
90
|
+
</react_native_1.Text>);
|
|
97
91
|
case 'circle':
|
|
98
92
|
return (<react_native_1.View style={{
|
|
99
93
|
width: 38,
|
|
@@ -130,22 +124,10 @@ function RatingIcon({ style, index, selected, filled, color, }) {
|
|
|
130
124
|
return <FlatEmoji index={index} selected={selected}/>;
|
|
131
125
|
}
|
|
132
126
|
case 'star':
|
|
133
|
-
default:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
backgroundColor: filled ? activeColor : 'transparent',
|
|
138
|
-
borderWidth: 2,
|
|
139
|
-
borderColor: filled ? activeColor : '#D1D5DB',
|
|
140
|
-
alignItems: 'center',
|
|
141
|
-
justifyContent: 'center',
|
|
142
|
-
}}>
|
|
143
|
-
{filled && (<react_native_1.View style={{
|
|
144
|
-
width: 16, height: 16, borderRadius: 8,
|
|
145
|
-
backgroundColor: '#FFF',
|
|
146
|
-
}}/>)}
|
|
147
|
-
</react_native_1.View>);
|
|
148
|
-
}
|
|
127
|
+
default:
|
|
128
|
+
return (<react_native_1.Text style={{ fontSize: 34, color: filled ? activeColor : '#E5E7EB' }}>
|
|
129
|
+
{filled ? '★' : '☆'}
|
|
130
|
+
</react_native_1.Text>);
|
|
149
131
|
}
|
|
150
132
|
}
|
|
151
133
|
const XeboRatingView = ({ question, isLastQuestion, onAnswer }) => {
|
|
@@ -201,23 +183,21 @@ const XeboRatingView = ({ question, isLastQuestion, onAnswer }) => {
|
|
|
201
183
|
{question.subtitle}
|
|
202
184
|
</react_native_1.Text>)}
|
|
203
185
|
|
|
204
|
-
{/* Rating icons
|
|
186
|
+
{/* Rating icons + labels: each icon paired with its label */}
|
|
205
187
|
<react_native_1.View style={styles.iconsRow}>
|
|
206
188
|
{Array.from({ length: totalSteps }, (_, i) => {
|
|
189
|
+
var _a, _b;
|
|
207
190
|
const isFilled = isCumulative ? selected !== null && i <= selected : i === selected;
|
|
191
|
+
const label = question.showColLabels ? (_b = (_a = question.columns) === null || _a === void 0 ? void 0 : _a[i]) === null || _b === void 0 ? void 0 : _b.text : undefined;
|
|
208
192
|
return (<react_native_1.TouchableOpacity key={i} onPress={() => handleSelect(i)} style={styles.iconButton} activeOpacity={0.7}>
|
|
209
193
|
<RatingIcon style={ratingStyle} index={i} selected={i === selected} filled={isFilled} color={ratingColor} totalSteps={totalSteps}/>
|
|
194
|
+
{!!label && (<react_native_1.Text style={[styles.colLabel, { color: theme.textColor, fontFamily: theme.fontFamily }]} numberOfLines={1}>
|
|
195
|
+
{label}
|
|
196
|
+
</react_native_1.Text>)}
|
|
210
197
|
</react_native_1.TouchableOpacity>);
|
|
211
198
|
})}
|
|
212
199
|
</react_native_1.View>
|
|
213
200
|
|
|
214
|
-
{/* Column labels */}
|
|
215
|
-
{question.showColLabels && question.columns && (<react_native_1.View style={styles.colLabels}>
|
|
216
|
-
{question.columns.map((col) => (<react_native_1.Text key={col.id} style={[styles.colLabel, { color: theme.textColor, fontFamily: theme.fontFamily }]} numberOfLines={1}>
|
|
217
|
-
{col.text}
|
|
218
|
-
</react_native_1.Text>))}
|
|
219
|
-
</react_native_1.View>)}
|
|
220
|
-
|
|
221
201
|
{/* Follow-up after rating */}
|
|
222
202
|
{selected !== null && !!question.followUpQuestion && (<react_native_1.View style={[styles.followUpCard, { borderRadius: theme.cornerRadius }]}>
|
|
223
203
|
<react_native_1.Text style={[styles.followUpTitle, { color: theme.textColor, fontFamily: theme.fontFamily }]}>
|
|
@@ -241,21 +221,23 @@ const XeboRatingView = ({ question, isLastQuestion, onAnswer }) => {
|
|
|
241
221
|
exports.XeboRatingView = XeboRatingView;
|
|
242
222
|
const styles = react_native_1.StyleSheet.create({
|
|
243
223
|
outer: {
|
|
224
|
+
flex: 1,
|
|
244
225
|
paddingHorizontal: 20,
|
|
245
226
|
paddingBottom: 24,
|
|
227
|
+
justifyContent: 'space-between',
|
|
246
228
|
},
|
|
247
229
|
scroll: { maxHeight: 320 },
|
|
248
230
|
scrollContent: { paddingTop: 16, paddingBottom: 8 },
|
|
249
231
|
title: { fontSize: 18, fontWeight: '700', marginBottom: 16 },
|
|
250
232
|
subtitle: { fontSize: 14, opacity: 0.6, marginBottom: 16 },
|
|
251
|
-
iconsRow: { flexDirection: 'row', marginTop: 4, marginBottom: 20,
|
|
252
|
-
iconButton: { alignItems: 'center', justifyContent: '
|
|
233
|
+
iconsRow: { flexDirection: 'row', marginTop: 4, marginBottom: 20, justifyContent: 'space-between' },
|
|
234
|
+
iconButton: { flex: 1, alignItems: 'center', justifyContent: 'flex-start', paddingVertical: 4 },
|
|
253
235
|
colLabels: {
|
|
254
236
|
flexDirection: 'row',
|
|
255
237
|
justifyContent: 'space-between',
|
|
256
238
|
marginBottom: 16,
|
|
257
239
|
},
|
|
258
|
-
colLabel: { fontSize: 11, opacity: 0.6, textAlign: 'center',
|
|
240
|
+
colLabel: { fontSize: 11, opacity: 0.6, textAlign: 'center', marginTop: 6 },
|
|
259
241
|
followUpCard: {
|
|
260
242
|
borderWidth: 1.5,
|
|
261
243
|
borderColor: '#E5E7EB',
|
|
@@ -270,6 +252,6 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
270
252
|
minHeight: 80,
|
|
271
253
|
},
|
|
272
254
|
errorText: { color: '#EF4444', fontSize: 13, marginBottom: 8 },
|
|
273
|
-
button: { paddingVertical: 14, alignItems: 'center', marginTop: 8 },
|
|
255
|
+
button: { paddingVertical: 14, alignItems: 'center', marginTop: 16, marginBottom: 8 },
|
|
274
256
|
buttonText: { color: '#FFFFFF', fontSize: 16, fontWeight: '600' },
|
|
275
257
|
});
|