Skip to content

Commit

Permalink
Merge pull request #36940 from tienifr/fix/36868
Browse files Browse the repository at this point in the history
Fix: Context menu not appear on long press video
(cherry picked from commit 5707114)
  • Loading branch information
iwiznia authored and OSBotify committed Feb 22, 2024
1 parent ede6797 commit 547f132
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions src/components/VideoPlayerPreview/VideoPlayerThumbnail.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import Image from '@components/Image';
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
import {ShowContextMenuContext, showContextMenuForReport} from '@components/ShowContextMenuContext';
import useThemeStyles from '@hooks/useThemeStyles';
import ControlSelection from '@libs/ControlSelection';
import * as DeviceCapabilities from '@libs/DeviceCapabilities';
import * as ReportUtils from '@libs/ReportUtils';
import variables from '@styles/variables';
import CONST from '@src/CONST';

Expand Down Expand Up @@ -35,22 +39,31 @@ function VideoPlayerThumbnail({thumbnailUrl, onPress, accessibilityLabel}) {
/>
</View>
)}
<PressableWithoutFeedback
style={[styles.videoThumbnailContainer]}
accessibilityLabel={accessibilityLabel}
accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON}
onPress={onPress}
>
<View style={[styles.videoThumbnailPlayButton]}>
<Icon
src={Expensicons.Play}
fill="white"
width={variables.iconSizeXLarge}
height={variables.iconSizeXLarge}
additionalStyles={[styles.ml1]}
/>
</View>
</PressableWithoutFeedback>
<ShowContextMenuContext.Consumer>
{({anchor, report, action, checkIfContextMenuActive}) => (
<PressableWithoutFeedback
style={[styles.videoThumbnailContainer]}
accessibilityLabel={accessibilityLabel}
accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON}
onPress={onPress}
onPressIn={() => DeviceCapabilities.canUseTouchScreen() && ControlSelection.block()}
onPressOut={() => ControlSelection.unblock()}
onLongPress={(event) =>
showContextMenuForReport(event, anchor, (report && report.reportID) || '', action, checkIfContextMenuActive, ReportUtils.isArchivedRoom(report))
}
>
<View style={[styles.videoThumbnailPlayButton]}>
<Icon
src={Expensicons.Play}
fill="white"
width={variables.iconSizeXLarge}
height={variables.iconSizeXLarge}
additionalStyles={[styles.ml1]}
/>
</View>
</PressableWithoutFeedback>
)}
</ShowContextMenuContext.Consumer>
</View>
);
}
Expand Down

0 comments on commit 547f132

Please sign in to comment.