Skip to content

Commit c70846c

Browse files
committedJun 19, 2024··
Fix: Send button does not response
1 parent dbea0f9 commit c70846c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
 

‎src/pages/home/report/ReportActionCompose/SendButton.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Tooltip from '@components/Tooltip';
88
import useLocalize from '@hooks/useLocalize';
99
import useTheme from '@hooks/useTheme';
1010
import useThemeStyles from '@hooks/useThemeStyles';
11+
import useWindowDimensions from '@hooks/useWindowDimensions';
1112
import CONST from '@src/CONST';
1213

1314
type SendButtonProps = {
@@ -22,7 +23,7 @@ function SendButton({isDisabled: isDisabledProp, handleSendMessage}: SendButtonP
2223
const theme = useTheme();
2324
const styles = useThemeStyles();
2425
const {translate} = useLocalize();
25-
26+
const {isSmallScreenWidth} = useWindowDimensions();
2627
const Tap = Gesture.Tap().onEnd(() => {
2728
handleSendMessage();
2829
});
@@ -33,7 +34,12 @@ function SendButton({isDisabled: isDisabledProp, handleSendMessage}: SendButtonP
3334
// Keep focus on the composer when Send message is clicked.
3435
onMouseDown={(e) => e.preventDefault()}
3536
>
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+
>
3743
<Tooltip text={translate('common.send')}>
3844
<PressableWithFeedback
3945
style={({pressed, isDisabled}) => [

0 commit comments

Comments
 (0)
Please sign in to comment.