Skip to content

Commit

Permalink
fix: [Composer] the input box displays one row by default
Browse files Browse the repository at this point in the history
  • Loading branch information
akai committed Jan 22, 2021
1 parent 07eeaa3 commit 2d6d636
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/components/Composer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import clsx from 'clsx';
import { IconButtonProps } from '../IconButton';
import { Input } from '../Input';
import { Recorder, RecorderProps } from '../Recorder';
import { Toolbar } from '../Toolbar';
import { Toolbar, ToolbarItemProps } from '../Toolbar';
import { ClickOutside } from '../ClickOutside';
import { Popover } from '../Popover';
import { SendConfirm } from '../SendConfirm';
Expand All @@ -13,7 +13,6 @@ import { Action } from './Action';
import riseInput from './riseInput';
import parseDataTransfer from '../../utils/parseDataTransfer';
import toggleClass from '../../utils/toggleClass';
import { ToolbarItemProps } from '../Toolbar';

const NO_HOME_BAR = 'S--noHomeBar';

Expand Down Expand Up @@ -238,12 +237,11 @@ export const Composer = React.forwardRef<ComposerHandle, ComposerProps>((props,
const inputTypeIcon = isInputText ? 'mic' : 'keyboard';
const hasToolbar = toolbar.length > 0;

const renderInput = (minRows: number) => (
const renderInput = () => (
<div className={clsx({ 'S--invisible': !isInputText })}>
<Input
className="Composer-input"
value={text}
minRows={minRows}
rows={1}
autoSize
ref={inputRef}
Expand Down Expand Up @@ -284,7 +282,7 @@ export const Composer = React.forwardRef<ComposerHandle, ComposerProps>((props,
{accessoryContent}
</Popover>
)}
<div className="Composer-inputWrap">{renderInput(3)}</div>
<div className="Composer-inputWrap">{renderInput()}</div>
<Action
className="Composer-sendBtn"
icon="paper-plane"
Expand All @@ -310,7 +308,7 @@ export const Composer = React.forwardRef<ComposerHandle, ComposerProps>((props,
/>
)}
<div className="Composer-inputWrap">
{renderInput(1)}
{renderInput()}
{!isInputText && <Recorder {...recorder} />}
</div>
{!text && rightAction && <Action {...rightAction} />}
Expand Down

0 comments on commit 2d6d636

Please sign in to comment.