@@ -6,6 +6,7 @@ import * as Expensicons from '@components/Icon/Expensicons';
6
6
import PressableWithFeedback from '@components/Pressable/PressableWithFeedback' ;
7
7
import Tooltip from '@components/Tooltip' ;
8
8
import useLocalize from '@hooks/useLocalize' ;
9
+ import useResponsiveLayout from '@hooks/useResponsiveLayout' ;
9
10
import useTheme from '@hooks/useTheme' ;
10
11
import useThemeStyles from '@hooks/useThemeStyles' ;
11
12
import CONST from '@src/CONST' ;
@@ -22,7 +23,7 @@ function SendButton({isDisabled: isDisabledProp, handleSendMessage}: SendButtonP
22
23
const theme = useTheme ( ) ;
23
24
const styles = useThemeStyles ( ) ;
24
25
const { translate} = useLocalize ( ) ;
25
-
26
+ const { isSmallScreenWidth } = useResponsiveLayout ( ) ;
26
27
const Tap = Gesture . Tap ( ) . onEnd ( ( ) => {
27
28
handleSendMessage ( ) ;
28
29
} ) ;
@@ -33,7 +34,12 @@ function SendButton({isDisabled: isDisabledProp, handleSendMessage}: SendButtonP
33
34
// Keep focus on the composer when Send message is clicked.
34
35
onMouseDown = { ( e ) => e . preventDefault ( ) }
35
36
>
36
- < GestureDetector gesture = { Tap } >
37
+ < GestureDetector
38
+ // A new GestureDetector instance must be created when switching from a large screen to a small screen
39
+ // if not, the GestureDetector may not function correctly.
40
+ key = { `send-button-${ isSmallScreenWidth ? 'small-screen' : 'normal-screen' } ` }
41
+ gesture = { Tap }
42
+ >
37
43
< Tooltip text = { translate ( 'common.send' ) } >
38
44
< PressableWithFeedback
39
45
style = { ( { pressed, isDisabled} ) => [
0 commit comments