@@ -8,6 +8,7 @@ import Tooltip from '@components/Tooltip';
8
8
import useLocalize from '@hooks/useLocalize' ;
9
9
import useTheme from '@hooks/useTheme' ;
10
10
import useThemeStyles from '@hooks/useThemeStyles' ;
11
+ import useWindowDimensions from '@hooks/useWindowDimensions' ;
11
12
import CONST from '@src/CONST' ;
12
13
13
14
type SendButtonProps = {
@@ -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 } = useWindowDimensions ( ) ;
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 = { `${ isSmallScreenWidth ? 0 : 1 } ` }
41
+ gesture = { Tap }
42
+ >
37
43
< Tooltip text = { translate ( 'common.send' ) } >
38
44
< PressableWithFeedback
39
45
style = { ( { pressed, isDisabled} ) => [
0 commit comments