function _renderSurveyQtns(image) {
  const SurveyQuestions = image.Questions;

  const renderItem = ({ item: qtn, index }) => {
    let selansid = '',
      selanswer = '',
      selimg = '',
      selimg2 = '',
      showImageTag = false,
      showImageTag2 = false;
    let id_key = qtn.AIQuestionId + '_AnswerId' + image.QuestionImageId;
    let ans_key = qtn.AIQuestionId + '_Answer' + image.QuestionImageId;
    let multi_key = qtn.AIQuestionId + '_MultiOption' + image.QuestionImageId;
    let date_key = qtn.AIQuestionId + '_Date' + image.QuestionImageId;
    let img_key = qtn.AIQuestionId + '_ImagePath1' + image.QuestionImageId;
    let imgname_key = qtn.AIQuestionId + '_ImageName1' + image.QuestionImageId;
    let img_key2 = qtn.AIQuestionId + '_ImagePath2' + image.QuestionImageId;
    let imgname_key2 = qtn.AIQuestionId + '_ImageName2' + image.QuestionImageId;
    let rating_key = qtn.AIQuestionId + '_Rating' + image.QuestionImageId;
    let voiceClip_key = qtn.AIQuestionId + '_VoiceClip' + image.QuestionImageId;
    let list_mcdata = [];

    if (qtn.QuestionType == 'Single choice list') {
      selansid = QuestionsData[id_key] != null ? QuestionsData[id_key] : '';
      selanswer = QuestionsData[ans_key] != null ? QuestionsData[ans_key] : '';
    } else if (qtn.QuestionType == 'Multi choice list') {
      if (qtn.Answers != null) {
        for (var i = 0; i < qtn.Answers.length; i++) {
          let obj = {
            AIAnswerId: parseInt(qtn.Answers[i].AIAnswerId),
            AIAnswerName: qtn.Answers[i].AIAnswerName,
          };
          list_mcdata.push(obj);
        }
      }
      selansid = QuestionsData[multi_key] != null && QuestionsData[multi_key] != '' ? QuestionsData[multi_key].split(',') : [];
      if (selansid != null && selansid.length > 0) {
        let arr = [];
        for (var i = 0; i < selansid.length; i++) {
          arr.push(parseInt(selansid[i]));
        }
        selansid = arr;
      }
    } else if (qtn.QuestionType == 'Number' || qtn.QuestionType == 'Text' || qtn.QuestionType == 'Decimal' || qtn.QuestionType == 'Date') {
      selansid = QuestionsData[ans_key];
      selanswer = (qtn.QuestionType == 'Date') ? QuestionsData[date_key] || moment().format('MM/DD/YYYY') : '';
      showImageTag = (qtn.QuestionImageAllow == true || qtn.QuestionImageAllow == 'true' || qtn.QuestionImageAllow == 1);
      showImageTag2 = false;
    } else if (qtn.QuestionType == 'Rating') {
      selanswer = QuestionsData[ans_key] ? QuestionsData[ans_key] : '';
    } else if (qtn.QuestionType == 'Audio') {
      selansid = QuestionsData[ans_key] ? QuestionsData[ans_key] : '';
      selanswer = QuestionsData[voiceClip_key] ? QuestionsData[voiceClip_key].filename  ||'' : '';
    }

    if (qtn.QuestionType == 'Single choice list' || qtn.QuestionType == 'Multi choice list') {
      if (qtn.Answers && qtn.Answers.length > 0) {
        for (var i = 0; i < qtn.Answers.length; i++) {
          let ansss = qtn.Answers[i];
          let isandImgAl = ansss.ImageAllow1 == true || ansss.ImageAllow1 == 'true' || ansss.ImageAllow1 == 1;
          let isandImgAl2 = ansss.ImageAllow2 == true || ansss.ImageAllow2 == 'true' || ansss.ImageAllow2 == 1;

          if (qtn.QuestionType == 'Single choice list' && isandImgAl && ansss.AIAnswerId == selansid) {
            showImageTag = true;
          } else if (qtn.QuestionType == 'Multi choice list' && isandImgAl && selansid.indexOf(ansss.AIAnswerId) >= 0) {
            showImageTag = true;
          }

          if (qtn.QuestionType == 'Single choice list' && isandImgAl2 && ansss.AIAnswerId == selansid) {
            showImageTag2 = true;
          } else if (qtn.QuestionType == 'Multi choice list' && isandImgAl2 && selansid.indexOf(ansss.AIAnswerId) >= 0) {
            showImageTag2 = true;
          }
        }
      }
    }

let isDisabled = qtn.isDisabled != null ? qtn.isDisabled : false;

if (isDisabled == true) {
      return <View key={index} />;
    } else {
      return (
        <View style={[customStyle.sform_group2]} key={index}>
          <Text style={[customStyle.sform_label3]}>{qtn.AIQuestionName}</Text>
          {qtn.QuestionType == 'Single choice list' && qtn.Answers && render_Picker('AIAnswerName', 'AIAnswerId', onselectionChange, { value: selanswer, qtn, image })}
          {qtn.QuestionType == 'Multi choice list' && qtn.Answers && (
            <MultiSelect
              items={list_mcdata}
              uniqueKey="AIAnswerId"
              onSelectedItemsChange={(selectedItems) => {
                console.log('onSelectedItemsChange');
                setMultiSelectValue(selectedItems, qtn, image);
              }}
              selectedItems={selansid}
              selectText="Pick Items"
              searchInputPlaceholderText="Search Items..."
              tagRemoveIconColor={PrimaryTheme.$primary_color}
              tagBorderColor={PrimaryTheme.$primary_color}
              tagTextColor={PrimaryTheme.$primary_color}
              selectedItemTextColor={PrimaryTheme.$primary_color}
              selectedItemIconColor={PrimaryTheme.$primary_color}
              tagContainerStyle={{ height: 30, width: '100%', paddingVertical: 5 }}
              styleTextTag={{ fontSize: 14 }}
              itemTextColor={PrimaryTheme.$text_color}
              displayKey="AIAnswerName"
              searchInputStyle={{ color: '#CCC' }}
              submitButtonColor={PrimaryTheme.$primary_color}
              submitButtonText="Submit"
            />
          )}
          {(qtn.QuestionType == 'Number' || qtn.QuestionType == 'Decimal' || qtn.QuestionType == 'Text') && (
            <TextInput
              style={[customStyle.surveyQtn_InputStyle]}
              placeholder=""
              placeholderTextColor={PageTheme.$placeholder_color}
              keyboardType={qtn.QuestionType == 'Decimal' ? 'decimal-pad' : qtn.QuestionType == 'Text' ? 'default' : 'number-pad'}
              value={selansid}
              onChangeText={(val) => {
                setTextValue(val, qtn, image);
              }}
              autoComplete="off"
            />
          )}
          {qtn.QuestionType == 'Date' && (
            <View style={customStyle.surveyQtn_datePicker_con}>
              <Text style={customStyle.surveyQtn_datePicker_text}>{selansid != '' ? selansid : 'MM/YYYY'}</Text>
              <TouchableOpacity
                style={[customStyle.surveyQtn_datePicker]}
                onPress={() => {
                  setDateValue(selanswer);
                  showQtnDatePicker(qtn, true);
                }}>
                <Fontisto size={20} color={PageTheme.$accent_color} name="date" />
              </TouchableOpacity>
            </View>
          )}
          {qtn.QuestionType == 'Rating' && (
            <View style={customStyle.surveyQtn_datePicker_con}>
              <Text style={customStyle.surveyQtn_datePicker_text}>{selanswer}</Text>
              <TouchableOpacity
                style={[customStyle.surveyQtnRatingIcon]}
                onPress={() => {
                  setRatingQtn(qtn);
                  setShowRating(true);
                }}>
                <MaterialCommunityIcons size={25} color={PageTheme.$accent_color} name="drag" />
              </TouchableOpacity>
            </View>
          )}
          {qtn.QuestionType == 'Audio' && (
            <View style={customStyle.surveyQtn_datePicker_con}>
              <Text style={customStyle.surveyQtn_datePicker_text}>{selanswer}</Text>
              <TouchableOpacity
                style={[customStyle.surveyQtnRatingIcon]}
                onPress={() => {
                  show_recorder(qtn);
                }}>
                <FontAwesome size={25} color={PageTheme.$accent_color} name="microphone" />
              </TouchableOpacity>
            </View>
          )}
        </View>
      );
    }
  };

return (
    <FlatList
      data={SurveyQuestions}
      renderItem={renderItem}
      keyExtractor={(item, index) => index.toString()}
      contentContainerStyle={customStyle.SVn_GroupViewList}
    />
  );
}