Skip to content

Commit 9a88c07

Browse files
committed
fix: send button visibility when async audio off and fixed few tests
1 parent fc00aa4 commit 9a88c07

File tree

7 files changed

+662
-592
lines changed

7 files changed

+662
-592
lines changed

package/src/components/Message/MessageSimple/__tests__/__snapshots__/MessageStatus.test.js.snap

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,55 @@ exports[`MessageStatus should render message status with read by container 1`] =
121121
</RNSVGSvgView>
122122
</View>
123123
</View>
124+
<View
125+
enablePanDownToClose={true}
126+
handleComponent={[Function]}
127+
handleHeight={20}
128+
index={-1}
129+
onChange={[Function]}
130+
snapPoints={
131+
[
132+
600.3000000000001,
133+
1334,
134+
]
135+
}
136+
>
137+
<RCTScrollView
138+
contentContainerStyle={
139+
[
140+
{
141+
"flexGrow": 1,
142+
},
143+
{
144+
"backgroundColor": "#FFFFFF",
145+
},
146+
{},
147+
{
148+
"opacity": 1,
149+
},
150+
]
151+
}
152+
data={[]}
153+
getItem={[Function]}
154+
getItemCount={[Function]}
155+
keyExtractor={[Function]}
156+
onContentSizeChange={[Function]}
157+
onEndReached={[Function]}
158+
onLayout={[Function]}
159+
onMomentumScrollBegin={[Function]}
160+
onMomentumScrollEnd={[Function]}
161+
onScroll={[Function]}
162+
onScrollBeginDrag={[Function]}
163+
onScrollEndDrag={[Function]}
164+
removeClippedSubviews={false}
165+
renderItem={[Function]}
166+
scrollEventThrottle={0.0001}
167+
stickyHeaderIndices={[]}
168+
testID="attachment-picker-list"
169+
viewabilityConfigCallbackPairs={[]}
170+
>
171+
<View />
172+
</RCTScrollView>
173+
</View>
124174
</View>
125175
`;

package/src/components/MessageInput/MessageInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
361361
const showSendingButton = hasText || attachments.length;
362362

363363
const isSendingButtonVisible = useMemo(() => {
364-
return asyncAudioEnabled && showSendingButton && !recording;
364+
return asyncAudioEnabled ? showSendingButton && !recording : true;
365365
}, [asyncAudioEnabled, recording, showSendingButton]);
366366

367367
const micPositionX = useSharedValue(0);

package/src/components/MessageInput/__tests__/ImageUploadPreview.test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ describe('ImageUploadPreview', () => {
104104

105105
const { queryAllByTestId } = screen;
106106

107+
await waitFor(() => {
108+
const imageAttachments = queryAllByTestId('image-attachment-upload-preview-image');
109+
for (const image of imageAttachments) {
110+
fireEvent(image, 'loadEnd');
111+
}
112+
});
113+
107114
await waitFor(() => {
108115
expect(queryAllByTestId('image-attachment-upload-preview')).toHaveLength(1);
109116
expect(queryAllByTestId('inactive-upload-progress-indicator')).toHaveLength(1);
@@ -131,6 +138,13 @@ describe('ImageUploadPreview', () => {
131138

132139
const { getAllByTestId, queryAllByTestId } = screen;
133140

141+
await waitFor(() => {
142+
const imageAttachments = queryAllByTestId('image-attachment-upload-preview-image');
143+
for (const image of imageAttachments) {
144+
fireEvent(image, 'loadEnd');
145+
}
146+
});
147+
134148
await waitFor(() => {
135149
expect(queryAllByTestId('image-attachment-upload-preview')).toHaveLength(1);
136150
expect(queryAllByTestId('retry-upload-progress-indicator')).toHaveLength(1);
@@ -166,6 +180,13 @@ describe('ImageUploadPreview', () => {
166180

167181
const { queryAllByText, queryAllByTestId } = screen;
168182

183+
await waitFor(() => {
184+
const imageAttachments = queryAllByTestId('image-attachment-upload-preview-image');
185+
for (const image of imageAttachments) {
186+
fireEvent(image, 'loadEnd');
187+
}
188+
});
189+
169190
await waitFor(() => {
170191
expect(queryAllByTestId('image-attachment-upload-preview')).toHaveLength(1);
171192
expect(queryAllByText('Not supported')).toHaveLength(1);
@@ -209,6 +230,13 @@ describe('ImageUploadPreview', () => {
209230

210231
const { queryAllByTestId, queryAllByText } = screen;
211232

233+
await waitFor(() => {
234+
const imageAttachments = queryAllByTestId('image-attachment-upload-preview-image');
235+
for (const image of imageAttachments) {
236+
fireEvent(image, 'loadEnd');
237+
}
238+
});
239+
212240
await waitFor(() => {
213241
expect(queryAllByTestId('image-attachment-upload-preview')).toHaveLength(4);
214242
expect(queryAllByTestId('upload-progress-indicator')).toHaveLength(1);

0 commit comments

Comments
 (0)