Skip to content

Commit 35c9485

Browse files
committed
fix: styles for message input auto complete input
1 parent a9df83e commit 35c9485

File tree

4 files changed

+16
-32
lines changed

4 files changed

+16
-32
lines changed

package/src/components/AutoCompleteInput/AutoCompleteInput.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ const AutoCompleteInputWithContext = (props: AutoCompleteInputPropsWithContext)
142142
{
143143
color: black,
144144
maxHeight: (textHeight || 17) * numberOfLines,
145+
paddingHorizontal: command ? 4 : 16,
145146
textAlign: I18nManager.isRTL ? 'right' : 'left',
146147
},
147148
inputBox,
@@ -205,8 +206,7 @@ const styles = StyleSheet.create({
205206
flex: 1,
206207
fontSize: 16,
207208
includeFontPadding: false, // for android vertical text centering
208-
padding: 0, // removal of default text input padding on android
209-
paddingTop: 0, // removal of iOS top padding for weird centering
209+
paddingVertical: 12,
210210
textAlignVertical: 'center', // for android vertical text centering
211211
},
212212
});

package/src/components/MessageInput/AttachmentUploadPreviewList.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ const UnMemoizedAttachmentUploadListPreview = (
185185
}
186186

187187
return (
188-
<View style={[wrapper]}>
188+
<View style={[styles.wrapper, wrapper]}>
189189
{imageUploads.length ? (
190190
<FlatList
191191
data={imageUploads}
@@ -264,10 +264,13 @@ export const AttachmentUploadPreviewList = (props: AttachmentUploadPreviewListPr
264264
const styles = StyleSheet.create({
265265
attachmentSeparator: {
266266
borderBottomWidth: 1,
267-
marginBottom: 10,
267+
marginVertical: 8,
268+
},
269+
filesFlatList: { maxHeight: FILE_PREVIEW_HEIGHT * 2.5 + 16 },
270+
imagesFlatList: {},
271+
wrapper: {
272+
paddingTop: 12,
268273
},
269-
filesFlatList: { marginBottom: 12, maxHeight: FILE_PREVIEW_HEIGHT * 2.5 + 16 },
270-
imagesFlatList: { paddingBottom: 12 },
271274
});
272275

273276
AttachmentUploadPreviewList.displayName =

package/src/components/MessageInput/MessageInput.tsx

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
import React, { useCallback, useEffect, useMemo, useState } from 'react';
2-
import {
3-
Modal,
4-
Pressable,
5-
SafeAreaView,
6-
StyleSheet,
7-
TextInput,
8-
TextInputProps,
9-
View,
10-
} from 'react-native';
2+
import { Modal, SafeAreaView, StyleSheet, TextInput, TextInputProps, View } from 'react-native';
113

124
import {
135
Gesture,
@@ -60,7 +52,6 @@ import {
6052
useTranslationContext,
6153
} from '../../contexts/translationContext/TranslationContext';
6254

63-
import { useStableCallback } from '../../hooks/useStableCallback';
6455
import { useStateStore } from '../../hooks/useStateStore';
6556
import {
6657
isAudioRecorderAvailable,
@@ -79,8 +70,6 @@ const styles = StyleSheet.create({
7970
autoCompleteInputContainer: {
8071
alignItems: 'center',
8172
flexDirection: 'row',
82-
paddingLeft: 16,
83-
paddingRight: 16,
8473
},
8574
composerContainer: {
8675
alignItems: 'center',
@@ -101,7 +90,7 @@ const styles = StyleSheet.create({
10190
optionsContainer: {
10291
flexDirection: 'row',
10392
},
104-
replyContainer: { paddingBottom: 12, paddingHorizontal: 8 },
93+
replyContainer: { paddingBottom: 0, paddingHorizontal: 8, paddingTop: 8 },
10594
sendButtonContainer: {},
10695
suggestionsListContainer: {
10796
position: 'absolute',
@@ -441,10 +430,6 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
441430
const shouldDisplayStopAIGeneration =
442431
[AIStates.Thinking, AIStates.Generating].includes(aiState) && !!StopMessageStreamingButton;
443432

444-
const onFocusHandler = useStableCallback(() => {
445-
inputBoxRef.current?.focus();
446-
});
447-
448433
return (
449434
<>
450435
<View
@@ -502,13 +487,11 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
502487
<View style={[styles.optionsContainer, optionsContainer]}>
503488
{InputButtons && <InputButtons />}
504489
</View>
505-
<Pressable
506-
onPress={onFocusHandler}
490+
<View
507491
style={[
508492
styles.inputBoxContainer,
509493
{
510494
borderColor: grey_whisper,
511-
paddingVertical: command ? 8 : 12,
512495
},
513496
inputBoxContainer,
514497
isFocused ? focusedInputBoxContainer : null,
@@ -519,6 +502,7 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
519502
<Reply />
520503
</View>
521504
)}
505+
522506
<AttachmentUploadPreviewList />
523507
{command ? (
524508
<CommandInput disabled={!isOnline} />
@@ -531,7 +515,7 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
531515
/>
532516
</View>
533517
)}
534-
</Pressable>
518+
</View>
535519
</>
536520
)}
537521

package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,7 +2135,6 @@ exports[`Thread should match thread snapshot 1`] = `
21352135
},
21362136
{
21372137
"borderColor": "#ECEBEB",
2138-
"paddingVertical": 12,
21392138
},
21402139
{},
21412140
null,
@@ -2148,8 +2147,6 @@ exports[`Thread should match thread snapshot 1`] = `
21482147
{
21492148
"alignItems": "center",
21502149
"flexDirection": "row",
2151-
"paddingLeft": 16,
2152-
"paddingRight": 16,
21532150
},
21542151
{},
21552152
]
@@ -2171,13 +2168,13 @@ exports[`Thread should match thread snapshot 1`] = `
21712168
"flex": 1,
21722169
"fontSize": 16,
21732170
"includeFontPadding": false,
2174-
"padding": 0,
2175-
"paddingTop": 0,
2171+
"paddingVertical": 12,
21762172
"textAlignVertical": "center",
21772173
},
21782174
{
21792175
"color": "#000000",
21802176
"maxHeight": 85,
2177+
"paddingHorizontal": 16,
21812178
"textAlign": "left",
21822179
},
21832180
{},

0 commit comments

Comments
 (0)