react-native-my-survey-sdk 2.2.1 → 2.2.2
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
|
@@ -149,28 +149,28 @@ export const XeboSurveyModal: React.FC = () => {
|
|
|
149
149
|
const lastRealIndex = questions.findIndex(q => q.id === 'thank_you_auto') - 1;
|
|
150
150
|
const isLast = questionIndex === lastRealIndex;
|
|
151
151
|
|
|
152
|
-
// key
|
|
152
|
+
// key must be passed directly (not via spread) — forces unmount/remount on question change,
|
|
153
153
|
// resetting all component state (selected score, text, etc.)
|
|
154
|
-
const commonProps = {
|
|
154
|
+
const commonProps = { question, isLastQuestion: isLast, onAnswer: handleAnswer };
|
|
155
155
|
|
|
156
156
|
switch (question.type) {
|
|
157
157
|
case XeboQuestionType.singleChoice:
|
|
158
|
-
return <XeboSingleChoiceView {...commonProps} />;
|
|
158
|
+
return <XeboSingleChoiceView key={question.id} {...commonProps} />;
|
|
159
159
|
case XeboQuestionType.multipleChoice:
|
|
160
|
-
return <XeboMultipleChoiceView {...commonProps} />;
|
|
160
|
+
return <XeboMultipleChoiceView key={question.id} {...commonProps} />;
|
|
161
161
|
case XeboQuestionType.dropdown:
|
|
162
|
-
return <XeboDropdownView {...commonProps} />;
|
|
162
|
+
return <XeboDropdownView key={question.id} {...commonProps} />;
|
|
163
163
|
case XeboQuestionType.singleTextBox:
|
|
164
164
|
case XeboQuestionType.multipleTextBox:
|
|
165
|
-
return <XeboTextBoxView {...commonProps} />;
|
|
165
|
+
return <XeboTextBoxView key={question.id} {...commonProps} />;
|
|
166
166
|
case XeboQuestionType.nps:
|
|
167
|
-
return <XeboNPSView {...commonProps} />;
|
|
167
|
+
return <XeboNPSView key={question.id} {...commonProps} />;
|
|
168
168
|
case XeboQuestionType.multiNps:
|
|
169
|
-
return <XeboMultiNPSView {...commonProps} />;
|
|
169
|
+
return <XeboMultiNPSView key={question.id} {...commonProps} />;
|
|
170
170
|
case XeboQuestionType.rating:
|
|
171
|
-
return <XeboRatingView {...commonProps} />;
|
|
171
|
+
return <XeboRatingView key={question.id} {...commonProps} />;
|
|
172
172
|
case XeboQuestionType.multiRating:
|
|
173
|
-
return <XeboMultiRatingView {...commonProps} />;
|
|
173
|
+
return <XeboMultiRatingView key={question.id} {...commonProps} />;
|
|
174
174
|
default:
|
|
175
175
|
return null;
|
|
176
176
|
}
|