Skip to content

Commit e25b355

Browse files
committed
fix: send button and audiorecordingbutton re-renders
1 parent 1fc7d98 commit e25b355

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

package/src/components/MessageInput/SendButton.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useCallback } from 'react';
22

33
import { Pressable } from 'react-native';
44

@@ -38,10 +38,17 @@ export const SendButton = (props: SendButtonProps) => {
3838
},
3939
} = useTheme();
4040

41+
const onPressHandler = useCallback(() => {
42+
if (disabled) {
43+
return;
44+
}
45+
sendMessage();
46+
}, [disabled, sendMessage]);
47+
4148
return (
4249
<Pressable
4350
disabled={disabled}
44-
onPress={disabled ? () => null : () => sendMessage()}
51+
onPress={onPressHandler}
4552
style={[sendButton]}
4653
testID='send-button'
4754
>

0 commit comments

Comments
 (0)