react-native-my-survey-sdk 2.2.0 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-my-survey-sdk",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "Xebo survey collection SDK for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -149,26 +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 must be passed directly (not via spread) — forces unmount/remount on question change,
153
+ // resetting all component state (selected score, text, etc.)
152
154
  const commonProps = { question, isLastQuestion: isLast, onAnswer: handleAnswer };
153
155
 
154
156
  switch (question.type) {
155
157
  case XeboQuestionType.singleChoice:
156
- return <XeboSingleChoiceView {...commonProps} />;
158
+ return <XeboSingleChoiceView key={question.id} {...commonProps} />;
157
159
  case XeboQuestionType.multipleChoice:
158
- return <XeboMultipleChoiceView {...commonProps} />;
160
+ return <XeboMultipleChoiceView key={question.id} {...commonProps} />;
159
161
  case XeboQuestionType.dropdown:
160
- return <XeboDropdownView {...commonProps} />;
162
+ return <XeboDropdownView key={question.id} {...commonProps} />;
161
163
  case XeboQuestionType.singleTextBox:
162
164
  case XeboQuestionType.multipleTextBox:
163
- return <XeboTextBoxView {...commonProps} />;
165
+ return <XeboTextBoxView key={question.id} {...commonProps} />;
164
166
  case XeboQuestionType.nps:
165
- return <XeboNPSView {...commonProps} />;
167
+ return <XeboNPSView key={question.id} {...commonProps} />;
166
168
  case XeboQuestionType.multiNps:
167
- return <XeboMultiNPSView {...commonProps} />;
169
+ return <XeboMultiNPSView key={question.id} {...commonProps} />;
168
170
  case XeboQuestionType.rating:
169
- return <XeboRatingView {...commonProps} />;
171
+ return <XeboRatingView key={question.id} {...commonProps} />;
170
172
  case XeboQuestionType.multiRating:
171
- return <XeboMultiRatingView {...commonProps} />;
173
+ return <XeboMultiRatingView key={question.id} {...commonProps} />;
172
174
  default:
173
175
  return null;
174
176
  }