Skip to content

Commit b610c83

Browse files
authored
fix: message composer placeholder breaking lines (#5772)
1 parent 6982fd2 commit b610c83

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

app/containers/MessageComposer/components/ComposerInput.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@ import { useSubscription, useAutoSaveDraft } from '../hooks';
1212
import sharedStyles from '../../../views/Styles';
1313
import { useTheme } from '../../../theme';
1414
import { userTyping } from '../../../actions/room';
15-
import { getRoomTitle, parseJson } from '../../../lib/methods/helpers';
16-
import { MAX_HEIGHT, MIN_HEIGHT, NO_CANNED_RESPONSES, MARKDOWN_STYLES } from '../constants';
15+
import { getRoomTitle, isTablet, parseJson } from '../../../lib/methods/helpers';
16+
import {
17+
MAX_HEIGHT,
18+
MIN_HEIGHT,
19+
NO_CANNED_RESPONSES,
20+
MARKDOWN_STYLES,
21+
COMPOSER_INPUT_PLACEHOLDER_MAX_LENGTH
22+
} from '../constants';
1723
import database from '../../../lib/database';
1824
import Navigation from '../../../lib/navigation/appNavigation';
1925
import { emitter } from '../../../lib/methods/helpers/emitter';
@@ -44,6 +50,9 @@ export const ComposerInput = memo(
4450
let placeholder = tmid ? I18n.t('Add_thread_reply') : '';
4551
if (subscription && !tmid) {
4652
placeholder = I18n.t('Message_roomname', { roomName: (subscription.t === 'd' ? '@' : '#') + getRoomTitle(subscription) });
53+
if (!isTablet && placeholder.length > COMPOSER_INPUT_PLACEHOLDER_MAX_LENGTH) {
54+
placeholder = `${placeholder.slice(0, COMPOSER_INPUT_PLACEHOLDER_MAX_LENGTH)}...`;
55+
}
4756
}
4857
const route = useRoute<RouteProp<ChatsStackParamList, 'RoomView'>>();
4958
const usedCannedResponse = route.params?.usedCannedResponse;

app/containers/MessageComposer/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ export const MARKDOWN_STYLES: Record<TMarkdownStyle, string> = {
3535
code: '`',
3636
'code-block': '```'
3737
};
38+
39+
export const COMPOSER_INPUT_PLACEHOLDER_MAX_LENGTH = 30;

0 commit comments

Comments
 (0)