import { useStyles } from '../styles';
import { View } from 'react-native';
import { MAX_POLL_QUESTION_LENGTH } from '../../../../../core/constants';
import { Typography } from '../../../../../core/components/Typography/Typography';
import { usePollPostComposerContext } from '../PollPostComposer';
import { replaceTriggerValues } from 'react-native-controlled-mentions';
import FormLabel from '../../../../elements/FormLabel';
import { ElementID, PageID } from '../../../../enums';
export function PollQuestion({
  renderInput
}) {
  const {
    styles,
    theme
  } = useStyles();
  const {
    pollQuestion
  } = usePollPostComposerContext();
  const questionLength = replaceTriggerValues(pollQuestion, ({
    name
  }) => `@${name}`).length;
  return /*#__PURE__*/React.createElement(View, {
    style: styles.fieldContainer
  }, /*#__PURE__*/React.createElement(View, {
    style: [styles.inputContainer, questionLength > MAX_POLL_QUESTION_LENGTH && styles.inputContainerError]
  }, /*#__PURE__*/React.createElement(View, {
    style: styles.rowContainer
  }, /*#__PURE__*/React.createElement(FormLabel, {
    style: styles.base,
    pageId: PageID.poll_post_composer_page,
    elementId: ElementID.poll_question_title
  }), /*#__PURE__*/React.createElement(Typography.Caption, null, questionLength, "/", MAX_POLL_QUESTION_LENGTH)), renderInput({
    multiline: true,
    style: styles.pollQuestionInput,
    placeholder: "What's your poll question?",
    placeholderTextColor: theme.colors.baseShade3
  })), questionLength > MAX_POLL_QUESTION_LENGTH && /*#__PURE__*/React.createElement(Typography.Caption, {
    style: styles.errorText
  }, "Poll question cannot exceed ", MAX_POLL_QUESTION_LENGTH, " characters."));
}
//# sourceMappingURL=PollQuestion.js.map