Skip to content

Commit

Permalink
Fix: Send button does not response
Browse files Browse the repository at this point in the history
  • Loading branch information
truph01 committed Jun 19, 2024
1 parent dbea0f9 commit c70846c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/pages/home/report/ReportActionCompose/SendButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Tooltip from '@components/Tooltip';
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import CONST from '@src/CONST';

type SendButtonProps = {
Expand All @@ -22,7 +23,7 @@ function SendButton({isDisabled: isDisabledProp, handleSendMessage}: SendButtonP
const theme = useTheme();
const styles = useThemeStyles();
const {translate} = useLocalize();

const {isSmallScreenWidth} = useWindowDimensions();
const Tap = Gesture.Tap().onEnd(() => {
handleSendMessage();
});
Expand All @@ -33,7 +34,12 @@ function SendButton({isDisabled: isDisabledProp, handleSendMessage}: SendButtonP
// Keep focus on the composer when Send message is clicked.
onMouseDown={(e) => e.preventDefault()}
>
<GestureDetector gesture={Tap}>
<GestureDetector
// A new GestureDetector instance must be created when switching from a large screen to a small screen
// if not, the GestureDetector may not function correctly.
key={`${isSmallScreenWidth ? 0 : 1}`}
gesture={Tap}
>
<Tooltip text={translate('common.send')}>
<PressableWithFeedback
style={({pressed, isDisabled}) => [
Expand Down

0 comments on commit c70846c

Please sign in to comment.