From 42fa1f6b32d55d2b628a5ebed5257248268cfa2f Mon Sep 17 00:00:00 2001 From: Ishpaul Singh <104348397+ishpaul777@users.noreply.github.com> Date: Fri, 21 Jul 2023 23:10:33 +0530 Subject: [PATCH 1/8] Update Permissions.js --- src/libs/Permissions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/Permissions.js b/src/libs/Permissions.js index f3dd7177051d..b402cce80631 100644 --- a/src/libs/Permissions.js +++ b/src/libs/Permissions.js @@ -7,7 +7,8 @@ import CONST from '../CONST'; * @returns {Boolean} */ function canUseAllBetas(betas) { - return _.contains(betas, CONST.BETAS.ALL); + return true + // return _.contains(betas, CONST.BETAS.ALL); } /** From c6ba18fe866b50f356d08322d440280b7ecfb0db Mon Sep 17 00:00:00 2001 From: Ishpaul Singh <104348397+ishpaul777@users.noreply.github.com> Date: Sun, 23 Jul 2023 16:03:53 +0000 Subject: [PATCH 2/8] made RHN modal no dropzone --- .../DragAndDrop/NoDropZone/index.js | 30 ++++++++++++ .../DragAndDrop/NoDropZone/index.native.js | 7 +++ .../ThreePaneView.js | 48 ++++++++++--------- 3 files changed, 62 insertions(+), 23 deletions(-) create mode 100644 src/components/DragAndDrop/NoDropZone/index.js create mode 100644 src/components/DragAndDrop/NoDropZone/index.native.js diff --git a/src/components/DragAndDrop/NoDropZone/index.js b/src/components/DragAndDrop/NoDropZone/index.js new file mode 100644 index 000000000000..276fe7a4b824 --- /dev/null +++ b/src/components/DragAndDrop/NoDropZone/index.js @@ -0,0 +1,30 @@ +import {useEffect} from 'react'; +import PropTypes from 'prop-types'; + +const propTypes = { + /** Content */ + children: PropTypes.node.isRequired, +}; + +function NoDropZone(props) { + useEffect(() => { + document.addEventListener('dragover', handleDragOver); + + return () => { + document.removeEventListener('dragover', handleDragOver); + }; + }, []); + + function handleDragOver(event) { + event.preventDefault(); + console.log('dragover'); + event.dataTransfer.dropEffect = 'none'; + } + + return props.children; +} + +NoDropZone.displayName = 'NoDropZone'; +NoDropZone.propTypes = propTypes; + +export default NoDropZone; diff --git a/src/components/DragAndDrop/NoDropZone/index.native.js b/src/components/DragAndDrop/NoDropZone/index.native.js new file mode 100644 index 000000000000..c07028f5ff24 --- /dev/null +++ b/src/components/DragAndDrop/NoDropZone/index.native.js @@ -0,0 +1,7 @@ +// /components/DragAndDrop/NoDropZone/index.native.js + +const NoDropZone = (props) => props.children; + +NoDropZone.displayName = 'NoDropZone'; + +export default NoDropZone; diff --git a/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js b/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js index 75a5a1f514f7..b01111f12725 100644 --- a/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js +++ b/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js @@ -1,16 +1,17 @@ import * as React from 'react'; import _ from 'underscore'; -import {View} from 'react-native'; +import { View } from 'react-native'; import PropTypes from 'prop-types'; import SCREENS from '../../../../SCREENS'; import themeColors from '../../../../styles/themes/default'; import NAVIGATORS from '../../../../NAVIGATORS'; import * as StyleUtils from '../../../../styles/StyleUtils'; -import {withNavigationPropTypes} from '../../../../components/withNavigation'; +import { withNavigationPropTypes } from '../../../../components/withNavigation'; import styles from '../../../../styles/styles'; import CONST from '../../../../CONST'; import PressableWithoutFeedback from '../../../../components/Pressable/PressableWithoutFeedback'; import useLocalize from '../../../../hooks/useLocalize'; +import NoDropZone from '../../../../components/DragAndDrop/NoDropZone'; const propTypes = { /* State from useNavigationBuilder */ @@ -25,8 +26,8 @@ const propTypes = { }; function ThreePaneView(props) { - const lastCentralPaneIndex = _.findLastIndex(props.state.routes, {name: NAVIGATORS.CENTRAL_PANE_NAVIGATOR}); - const {translate} = useLocalize(); + const lastCentralPaneIndex = _.findLastIndex(props.state.routes, { name: NAVIGATORS.CENTRAL_PANE_NAVIGATOR }); + const { translate } = useLocalize(); return ( @@ -53,25 +54,26 @@ function ThreePaneView(props) { } if (route.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR) { return ( - - props.navigation.goBack()} - accessibilityLabel={translate('common.close')} - accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON} - /> - {props.descriptors[route.key].render()} - + + + props.navigation.goBack()} + accessibilityLabel={translate('common.close')} + accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON} + /> + {props.descriptors[route.key].render()} + + ); } return ( From 79bc7d222cf49d0e150503c375e7a0fd61d42c01 Mon Sep 17 00:00:00 2001 From: Ishpaul Singh <104348397+ishpaul777@users.noreply.github.com> Date: Tue, 25 Jul 2023 05:53:34 +0000 Subject: [PATCH 3/8] code linting and permission reverted --- .../createResponsiveStackNavigator/ThreePaneView.js | 8 ++++---- src/libs/Permissions.js | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js b/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js index b01111f12725..afa075bcb550 100644 --- a/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js +++ b/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js @@ -1,12 +1,12 @@ import * as React from 'react'; import _ from 'underscore'; -import { View } from 'react-native'; +import {View} from 'react-native'; import PropTypes from 'prop-types'; import SCREENS from '../../../../SCREENS'; import themeColors from '../../../../styles/themes/default'; import NAVIGATORS from '../../../../NAVIGATORS'; import * as StyleUtils from '../../../../styles/StyleUtils'; -import { withNavigationPropTypes } from '../../../../components/withNavigation'; +import {withNavigationPropTypes} from '../../../../components/withNavigation'; import styles from '../../../../styles/styles'; import CONST from '../../../../CONST'; import PressableWithoutFeedback from '../../../../components/Pressable/PressableWithoutFeedback'; @@ -26,8 +26,8 @@ const propTypes = { }; function ThreePaneView(props) { - const lastCentralPaneIndex = _.findLastIndex(props.state.routes, { name: NAVIGATORS.CENTRAL_PANE_NAVIGATOR }); - const { translate } = useLocalize(); + const lastCentralPaneIndex = _.findLastIndex(props.state.routes, {name: NAVIGATORS.CENTRAL_PANE_NAVIGATOR}); + const {translate} = useLocalize(); return ( diff --git a/src/libs/Permissions.js b/src/libs/Permissions.js index e13b3a95286e..7f8dcd036365 100644 --- a/src/libs/Permissions.js +++ b/src/libs/Permissions.js @@ -7,8 +7,7 @@ import CONST from '../CONST'; * @returns {Boolean} */ function canUseAllBetas(betas) { - return true - // return _.contains(betas, CONST.BETAS.ALL); + return _.contains(betas, CONST.BETAS.ALL); } /** From 3134ac21f25090c455caee8c188196db77e604ac Mon Sep 17 00:00:00 2001 From: Ishpaul Singh <104348397+ishpaul777@users.noreply.github.com> Date: Tue, 25 Jul 2023 08:07:28 +0000 Subject: [PATCH 4/8] remove consoles and fixes lint errrors --- src/components/DragAndDrop/NoDropZone/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/DragAndDrop/NoDropZone/index.js b/src/components/DragAndDrop/NoDropZone/index.js index 276fe7a4b824..fe89001b2d06 100644 --- a/src/components/DragAndDrop/NoDropZone/index.js +++ b/src/components/DragAndDrop/NoDropZone/index.js @@ -7,6 +7,12 @@ const propTypes = { }; function NoDropZone(props) { + function handleDragOver(event) { + event.preventDefault(); + // eslint-disable-next-line no-param-reassign + event.dataTransfer.dropEffect = 'none'; + } + useEffect(() => { document.addEventListener('dragover', handleDragOver); @@ -15,12 +21,6 @@ function NoDropZone(props) { }; }, []); - function handleDragOver(event) { - event.preventDefault(); - console.log('dragover'); - event.dataTransfer.dropEffect = 'none'; - } - return props.children; } From e3ddd3586d456a81079dd421e7813530c1941095 Mon Sep 17 00:00:00 2001 From: Ishpaul Singh <104348397+ishpaul777@users.noreply.github.com> Date: Wed, 26 Jul 2023 16:31:55 +0000 Subject: [PATCH 5/8] fixes flickering cursor on continuous dragover --- src/components/DragAndDrop/NoDropZone/index.js | 8 +++++--- .../createResponsiveStackNavigator/ThreePaneView.js | 12 ++++++++---- src/styles/styles.js | 12 ++++++++++++ 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/components/DragAndDrop/NoDropZone/index.js b/src/components/DragAndDrop/NoDropZone/index.js index fe89001b2d06..f562796ce09a 100644 --- a/src/components/DragAndDrop/NoDropZone/index.js +++ b/src/components/DragAndDrop/NoDropZone/index.js @@ -7,17 +7,19 @@ const propTypes = { }; function NoDropZone(props) { - function handleDragOver(event) { + function handleDrag(event) { event.preventDefault(); // eslint-disable-next-line no-param-reassign event.dataTransfer.dropEffect = 'none'; } useEffect(() => { - document.addEventListener('dragover', handleDragOver); + document.addEventListener('dragenter', handleDrag); + document.addEventListener('dragover', handleDrag); return () => { - document.removeEventListener('dragover', handleDragOver); + document.removeEventListener('dragenter', handleDrag); + document.removeEventListener('dragover', handleDrag); }; }, []); diff --git a/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js b/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js index afa075bcb550..b311742803c8 100644 --- a/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js +++ b/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js @@ -1,12 +1,12 @@ import * as React from 'react'; import _ from 'underscore'; -import {View} from 'react-native'; +import { View } from 'react-native'; import PropTypes from 'prop-types'; import SCREENS from '../../../../SCREENS'; import themeColors from '../../../../styles/themes/default'; import NAVIGATORS from '../../../../NAVIGATORS'; import * as StyleUtils from '../../../../styles/StyleUtils'; -import {withNavigationPropTypes} from '../../../../components/withNavigation'; +import { withNavigationPropTypes } from '../../../../components/withNavigation'; import styles from '../../../../styles/styles'; import CONST from '../../../../CONST'; import PressableWithoutFeedback from '../../../../components/Pressable/PressableWithoutFeedback'; @@ -26,8 +26,8 @@ const propTypes = { }; function ThreePaneView(props) { - const lastCentralPaneIndex = _.findLastIndex(props.state.routes, {name: NAVIGATORS.CENTRAL_PANE_NAVIGATOR}); - const {translate} = useLocalize(); + const lastCentralPaneIndex = _.findLastIndex(props.state.routes, { name: NAVIGATORS.CENTRAL_PANE_NAVIGATOR }); + const { translate } = useLocalize(); return ( @@ -56,6 +56,7 @@ function ThreePaneView(props) { return ( {props.descriptors[route.key].render()} + ); } diff --git a/src/styles/styles.js b/src/styles/styles.js index 0c6c0f4cde78..ab8929e8cd22 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -3180,6 +3180,18 @@ const styles = { zIndex: 1000, }, + noDropZoneTopInvisibleOverlay: { + position: 'fixed', + width: '100%', + height: '100%', + top: 0, + left: 0, + right: 0, + bottom: 0, + backgroundColor: themeColors.dropTransparentOverlay, + zIndex: 100, + }, + cardSection: { backgroundColor: themeColors.cardBG, borderRadius: variables.componentBorderRadiusCard, From 1f2edf6a0e61da996b584783ea9f7bf8142b4a53 Mon Sep 17 00:00:00 2001 From: Ishpaul Singh <104348397+ishpaul777@users.noreply.github.com> Date: Wed, 26 Jul 2023 16:39:54 +0000 Subject: [PATCH 6/8] code linting --- .../createResponsiveStackNavigator/ThreePaneView.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js b/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js index b311742803c8..2b143b2d0dc6 100644 --- a/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js +++ b/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js @@ -1,12 +1,12 @@ import * as React from 'react'; import _ from 'underscore'; -import { View } from 'react-native'; +import {View} from 'react-native'; import PropTypes from 'prop-types'; import SCREENS from '../../../../SCREENS'; import themeColors from '../../../../styles/themes/default'; import NAVIGATORS from '../../../../NAVIGATORS'; import * as StyleUtils from '../../../../styles/StyleUtils'; -import { withNavigationPropTypes } from '../../../../components/withNavigation'; +import {withNavigationPropTypes} from '../../../../components/withNavigation'; import styles from '../../../../styles/styles'; import CONST from '../../../../CONST'; import PressableWithoutFeedback from '../../../../components/Pressable/PressableWithoutFeedback'; @@ -26,8 +26,8 @@ const propTypes = { }; function ThreePaneView(props) { - const lastCentralPaneIndex = _.findLastIndex(props.state.routes, { name: NAVIGATORS.CENTRAL_PANE_NAVIGATOR }); - const { translate } = useLocalize(); + const lastCentralPaneIndex = _.findLastIndex(props.state.routes, {name: NAVIGATORS.CENTRAL_PANE_NAVIGATOR}); + const {translate} = useLocalize(); return ( @@ -74,9 +74,7 @@ function ThreePaneView(props) { /> {props.descriptors[route.key].render()} - + ); } From 4f1cbc36a908d0428bd07479487dfc6838de3c32 Mon Sep 17 00:00:00 2001 From: Ishpaul Singh <104348397+ishpaul777@users.noreply.github.com> Date: Thu, 27 Jul 2023 07:58:19 +0000 Subject: [PATCH 7/8] code clean up --- .../createResponsiveStackNavigator/ThreePaneView.js | 2 -- src/styles/styles.js | 12 ------------ 2 files changed, 14 deletions(-) diff --git a/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js b/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js index 2b143b2d0dc6..afa075bcb550 100644 --- a/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js +++ b/src/libs/Navigation/AppNavigator/createResponsiveStackNavigator/ThreePaneView.js @@ -56,7 +56,6 @@ function ThreePaneView(props) { return ( {props.descriptors[route.key].render()} - ); } diff --git a/src/styles/styles.js b/src/styles/styles.js index ab8929e8cd22..0c6c0f4cde78 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -3180,18 +3180,6 @@ const styles = { zIndex: 1000, }, - noDropZoneTopInvisibleOverlay: { - position: 'fixed', - width: '100%', - height: '100%', - top: 0, - left: 0, - right: 0, - bottom: 0, - backgroundColor: themeColors.dropTransparentOverlay, - zIndex: 100, - }, - cardSection: { backgroundColor: themeColors.cardBG, borderRadius: variables.componentBorderRadiusCard, From 4ab39f8fa0f204107155120663b362ba95b6e6fe Mon Sep 17 00:00:00 2001 From: Ishpaul Singh <104348397+ishpaul777@users.noreply.github.com> Date: Thu, 27 Jul 2023 13:37:27 +0000 Subject: [PATCH 8/8] remove unnecessary comments --- src/components/DragAndDrop/NoDropZone/index.native.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/DragAndDrop/NoDropZone/index.native.js b/src/components/DragAndDrop/NoDropZone/index.native.js index c07028f5ff24..c091ce4b6597 100644 --- a/src/components/DragAndDrop/NoDropZone/index.native.js +++ b/src/components/DragAndDrop/NoDropZone/index.native.js @@ -1,5 +1,3 @@ -// /components/DragAndDrop/NoDropZone/index.native.js - const NoDropZone = (props) => props.children; NoDropZone.displayName = 'NoDropZone';