fix(polls) Update limits (#11748)

This commit is contained in:
Mihaela Dumitru 2022-06-27 09:20:49 +03:00 committed by GitHub
parent d5146aaf2e
commit 7b538fc3e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -7,7 +7,7 @@ import { Button } from 'react-native-paper';
import { Icon, IconClose } from '../../../base/icons';
import BaseTheme from '../../../base/ui/components/BaseTheme.native';
import { BUTTON_MODES } from '../../../chat/constants';
import { CHAR_LIMIT } from '../../constants';
import { ANSWERS_LIMIT, CHAR_LIMIT } from '../../constants';
import AbstractPollCreate from '../AbstractPollCreate';
import type { AbstractProps } from '../AbstractPollCreate';
@ -151,6 +151,7 @@ const PollCreate = (props: AbstractProps) => {
<View style = { chatStyles.pollCreateButtonsContainer }>
<Button
color = { BaseTheme.palette.action02 }
disabled = { answers.length >= ANSWERS_LIMIT }
mode = { BUTTON_MODES.CONTAINED }
onPress = { () => {
// adding and answer

View File

@ -4,7 +4,7 @@ import React, { useCallback, useEffect, useRef, useState } from 'react';
import { Icon, IconMenu } from '../../../base/icons';
import { Tooltip } from '../../../base/tooltip';
import { CHAR_LIMIT } from '../../constants';
import { ANSWERS_LIMIT, CHAR_LIMIT } from '../../constants';
import AbstractPollCreate from '../AbstractPollCreate';
import type { AbstractProps } from '../AbstractPollCreate';
@ -237,6 +237,7 @@ const PollCreate = (props: AbstractProps) => {
<button
aria-label = { 'Add option' }
className = 'poll-button poll-button-secondary'
disabled = { answers.length >= ANSWERS_LIMIT }
onClick = { () => {
addAnswer();
requestFocus(answers.length);

View File

@ -4,4 +4,5 @@ export const COMMAND_NEW_POLL = 'new-poll';
export const COMMAND_ANSWER_POLL = 'answer-poll';
export const COMMAND_OLD_POLLS = 'old-polls';
export const CHAR_LIMIT = 1000;
export const CHAR_LIMIT = 500;
export const ANSWERS_LIMIT = 255;