Skip to content

Commit 98ec467

Browse files
authored
Merge pull request #23528 from ishpaul777/ishpaul777/RHN-no-dropzone
2 parents cd09dc9 + 4ab39f8 commit 98ec467

File tree

3 files changed

+58
-19
lines changed

3 files changed

+58
-19
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import {useEffect} from 'react';
2+
import PropTypes from 'prop-types';
3+
4+
const propTypes = {
5+
/** Content */
6+
children: PropTypes.node.isRequired,
7+
};
8+
9+
function NoDropZone(props) {
10+
function handleDrag(event) {
11+
event.preventDefault();
12+
// eslint-disable-next-line no-param-reassign
13+
event.dataTransfer.dropEffect = 'none';
14+
}
15+
16+
useEffect(() => {
17+
document.addEventListener('dragenter', handleDrag);
18+
document.addEventListener('dragover', handleDrag);
19+
20+
return () => {
21+
document.removeEventListener('dragenter', handleDrag);
22+
document.removeEventListener('dragover', handleDrag);
23+
};
24+
}, []);
25+
26+
return props.children;
27+
}
28+
29+
NoDropZone.displayName = 'NoDropZone';
30+
NoDropZone.propTypes = propTypes;
31+
32+
export default NoDropZone;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const NoDropZone = (props) => props.children;
2+
3+
NoDropZone.displayName = 'NoDropZone';
4+
5+
export default NoDropZone;

src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import styles from '../../../../styles/styles';
1111
import CONST from '../../../../CONST';
1212
import PressableWithoutFeedback from '../../../../components/Pressable/PressableWithoutFeedback';
1313
import useLocalize from '../../../../hooks/useLocalize';
14+
import NoDropZone from '../../../../components/DragAndDrop/NoDropZone';
1415

1516
const propTypes = {
1617
/* State from useNavigationBuilder */
@@ -53,25 +54,26 @@ function ThreePaneView(props) {
5354
}
5455
if (route.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR) {
5556
return (
56-
<View
57-
key={route.key}
58-
style={[
59-
styles.flexRow,
60-
styles.pAbsolute,
61-
styles.w100,
62-
styles.h100,
63-
StyleUtils.getBackgroundColorWithOpacityStyle(themeColors.shadow, CONST.RIGHT_MODAL_BACKGROUND_OVERLAY_OPACITY),
64-
StyleUtils.displayIfTrue(props.state.index === i),
65-
]}
66-
>
67-
<PressableWithoutFeedback
68-
style={[styles.flex1]}
69-
onPress={() => props.navigation.goBack()}
70-
accessibilityLabel={translate('common.close')}
71-
accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON}
72-
/>
73-
<View style={styles.rightPanelContainer}>{props.descriptors[route.key].render()}</View>
74-
</View>
57+
<NoDropZone key={route.key}>
58+
<View
59+
style={[
60+
styles.flexRow,
61+
styles.pAbsolute,
62+
styles.w100,
63+
styles.h100,
64+
StyleUtils.getBackgroundColorWithOpacityStyle(themeColors.shadow, CONST.RIGHT_MODAL_BACKGROUND_OVERLAY_OPACITY),
65+
StyleUtils.displayIfTrue(props.state.index === i),
66+
]}
67+
>
68+
<PressableWithoutFeedback
69+
style={[styles.flex1]}
70+
onPress={() => props.navigation.goBack()}
71+
accessibilityLabel={translate('common.close')}
72+
accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON}
73+
/>
74+
<View style={styles.rightPanelContainer}>{props.descriptors[route.key].render()}</View>
75+
</View>
76+
</NoDropZone>
7577
);
7678
}
7779
return (

0 commit comments

Comments
 (0)