renderQuestionByType()

in js/rating/RatingQuestion.js [68:115]


  renderQuestionByType(type) {
    const { question, rating, onChange } = this.props;

    if (type === "written") {
      const { placeholder, maxLength } = question.written;
      return (
        <WrittenResponse
          placeholder={placeholder}
          maxLength={maxLength}
          onChange={onChange}
        />
      );
    } else if (type === "feedback") {
      return (
        <WrittenResponse placeholder={question.text} onChange={onChange} />
      );
    } else if (type === "radios") {
      return (
        <RadioButtons
          options={question.radios}
          selectedIndex={rating}
          onChange={onChange}
        />
      );
    } else if (type === "rating") {
      return (
        <View style={{ marginTop: 15 }}>
          <StarRating
            labels={question.rating}
            rating={rating}
            onChange={onChange}
          />
        </View>
      );
    } else if (type === "ratings") {
      const { rows, labels } = question.ratings;
      return (
        <StarRatings
          rows={rows}
          labels={labels}
          rating={rating}
          onChange={onChange}
        />
      );
    } else {
      return null;
    }
  }