We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1fc7d98 commit e25b355Copy full SHA for e25b355
package/src/components/MessageInput/SendButton.tsx
@@ -1,4 +1,4 @@
1
-import React from 'react';
+import React, { useCallback } from 'react';
2
3
import { Pressable } from 'react-native';
4
@@ -38,10 +38,17 @@ export const SendButton = (props: SendButtonProps) => {
38
},
39
} = useTheme();
40
41
+ const onPressHandler = useCallback(() => {
42
+ if (disabled) {
43
+ return;
44
+ }
45
+ sendMessage();
46
+ }, [disabled, sendMessage]);
47
+
48
return (
49
<Pressable
50
disabled={disabled}
- onPress={disabled ? () => null : () => sendMessage()}
51
+ onPress={onPressHandler}
52
style={[sendButton]}
53
testID='send-button'
54
>
0 commit comments