-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixed: Web - Desktop Attachments - Cannot attach a photo when the NEW ( green plus) button is pressed #9021
Merged
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a5bb991
dragOverListener method added to SidebarScreen
metehanozyurt 7573440
document changed to window.document and conditions added for unnecess…
metehanozyurt c06b304
BaseSidebarScreen.js, index.js and index.native.js created.
metehanozyurt 842b0a7
index.js and index.native.js files changed to function component, ind…
metehanozyurt c221851
sidebarPropTypes.js created,displayName and propTypes added for Sideb…
metehanozyurt dc06bce
allPolicies added to sidebarPropTypes. Fixed the use of ref. BaseSide…
metehanozyurt c853e4b
descriptive comment added.
metehanozyurt e48d2f9
comments changed
metehanozyurt 1584251
Merge branch 'main' of https://github.com/Expensify/App into issue-8842
metehanozyurt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,44 +2,40 @@ import lodashGet from 'lodash/get'; | |||||
import _ from 'underscore'; | ||||||
import React, {Component} from 'react'; | ||||||
import {View} from 'react-native'; | ||||||
import {withOnyx} from 'react-native-onyx'; | ||||||
import PropTypes from 'prop-types'; | ||||||
import {withNavigation} from '@react-navigation/compat'; | ||||||
import styles from '../../../styles/styles'; | ||||||
import SidebarLinks from './SidebarLinks'; | ||||||
import PopoverMenu from '../../../components/PopoverMenu'; | ||||||
import FAB from '../../../components/FAB'; | ||||||
import ScreenWrapper from '../../../components/ScreenWrapper'; | ||||||
import Navigation from '../../../libs/Navigation/Navigation'; | ||||||
import ROUTES from '../../../ROUTES'; | ||||||
import Timing from '../../../libs/actions/Timing'; | ||||||
import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions'; | ||||||
import CONST from '../../../CONST'; | ||||||
import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize'; | ||||||
import compose from '../../../libs/compose'; | ||||||
import * as Expensicons from '../../../components/Icon/Expensicons'; | ||||||
import Permissions from '../../../libs/Permissions'; | ||||||
import ONYXKEYS from '../../../ONYXKEYS'; | ||||||
import * as Policy from '../../../libs/actions/Policy'; | ||||||
import Performance from '../../../libs/Performance'; | ||||||
import * as Welcome from '../../../libs/actions/Welcome'; | ||||||
import styles from '../../../../styles/styles'; | ||||||
import SidebarLinks from '../SidebarLinks'; | ||||||
import PopoverMenu from '../../../../components/PopoverMenu'; | ||||||
import FAB from '../../../../components/FAB'; | ||||||
import ScreenWrapper from '../../../../components/ScreenWrapper'; | ||||||
import Navigation from '../../../../libs/Navigation/Navigation'; | ||||||
import ROUTES from '../../../../ROUTES'; | ||||||
import Timing from '../../../../libs/actions/Timing'; | ||||||
import CONST from '../../../../CONST'; | ||||||
import * as Expensicons from '../../../../components/Icon/Expensicons'; | ||||||
import Permissions from '../../../../libs/Permissions'; | ||||||
import * as Policy from '../../../../libs/actions/Policy'; | ||||||
import Performance from '../../../../libs/Performance'; | ||||||
import * as Welcome from '../../../../libs/actions/Welcome'; | ||||||
import {sidebarPropTypes, sidebarDefaultProps} from './sidebarPropTypes'; | ||||||
|
||||||
const propTypes = { | ||||||
/* Beta features list */ | ||||||
betas: PropTypes.arrayOf(PropTypes.string).isRequired, | ||||||
|
||||||
/* Is workspace is being created by the user? */ | ||||||
isCreatingWorkspace: PropTypes.bool, | ||||||
/* A callback to call when we show create menu */ | ||||||
onShowCreateMenu: PropTypes.func, | ||||||
|
||||||
...windowDimensionsPropTypes, | ||||||
/* A callback to call when we hide create menu */ | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
onHideCreateMenu: PropTypes.func, | ||||||
|
||||||
...withLocalizePropTypes, | ||||||
...sidebarPropTypes, | ||||||
}; | ||||||
const defaultProps = { | ||||||
isCreatingWorkspace: false, | ||||||
onHideCreateMenu: () => {}, | ||||||
onShowCreateMenu: () => {}, | ||||||
...sidebarDefaultProps, | ||||||
}; | ||||||
|
||||||
class SidebarScreen extends Component { | ||||||
class BaseSidebarScreen extends Component { | ||||||
constructor(props) { | ||||||
super(props); | ||||||
|
||||||
|
@@ -68,6 +64,7 @@ class SidebarScreen extends Component { | |||||
this.setState({ | ||||||
isCreateMenuActive: true, | ||||||
}); | ||||||
this.props.onShowCreateMenu(); | ||||||
} | ||||||
|
||||||
/** | ||||||
|
@@ -83,6 +80,7 @@ class SidebarScreen extends Component { | |||||
* Selecting an item on CreateMenu or closing it by clicking outside of the modal component | ||||||
*/ | ||||||
hideCreateMenu() { | ||||||
this.props.onHideCreateMenu(); | ||||||
this.setState({ | ||||||
isCreateMenuActive: false, | ||||||
}); | ||||||
|
@@ -184,22 +182,7 @@ class SidebarScreen extends Component { | |||||
} | ||||||
} | ||||||
|
||||||
SidebarScreen.propTypes = propTypes; | ||||||
SidebarScreen.defaultProps = defaultProps; | ||||||
|
||||||
export default compose( | ||||||
withNavigation, | ||||||
withLocalize, | ||||||
withWindowDimensions, | ||||||
withOnyx({ | ||||||
allPolicies: { | ||||||
key: ONYXKEYS.COLLECTION.POLICY, | ||||||
}, | ||||||
betas: { | ||||||
key: ONYXKEYS.BETAS, | ||||||
}, | ||||||
isCreatingWorkspace: { | ||||||
key: ONYXKEYS.IS_CREATING_WORKSPACE, | ||||||
}, | ||||||
}), | ||||||
)(SidebarScreen); | ||||||
BaseSidebarScreen.propTypes = propTypes; | ||||||
BaseSidebarScreen.defaultProps = defaultProps; | ||||||
|
||||||
export default BaseSidebarScreen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React from 'react'; | ||
import {withNavigation} from '@react-navigation/compat'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import compose from '../../../../libs/compose'; | ||
import withWindowDimensions from '../../../../components/withWindowDimensions'; | ||
import withLocalize from '../../../../components/withLocalize'; | ||
import ONYXKEYS from '../../../../ONYXKEYS'; | ||
import {sidebarPropTypes, sidebarDefaultProps} from './sidebarPropTypes'; | ||
import BaseSidebarScreen from './BaseSidebarScreen'; | ||
|
||
const SidebarScreen = (props) => { | ||
let baseSidebarScreen = null; | ||
|
||
/** | ||
* Method create event listener | ||
*/ | ||
const createDragoverListener = () => { | ||
document.addEventListener('dragover', baseSidebarScreen.hideCreateMenu); | ||
}; | ||
|
||
/** | ||
* Method remove event listener. | ||
*/ | ||
const removeDragoverListener = () => { | ||
document.removeEventListener('dragover', baseSidebarScreen.hideCreateMenu); | ||
}; | ||
return ( | ||
<BaseSidebarScreen | ||
ref={el => baseSidebarScreen = el} | ||
onShowCreateMenu={createDragoverListener} | ||
onHideCreateMenu={removeDragoverListener} | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...props} | ||
/> | ||
); | ||
}; | ||
|
||
SidebarScreen.propTypes = sidebarPropTypes; | ||
SidebarScreen.defaultProps = sidebarDefaultProps; | ||
SidebarScreen.displayName = 'SidebarScreen'; | ||
Luke9389 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
export default compose( | ||
withNavigation, | ||
withLocalize, | ||
withWindowDimensions, | ||
withOnyx({ | ||
allPolicies: { | ||
key: ONYXKEYS.COLLECTION.POLICY, | ||
}, | ||
betas: { | ||
key: ONYXKEYS.BETAS, | ||
}, | ||
isCreatingWorkspace: { | ||
key: ONYXKEYS.IS_CREATING_WORKSPACE, | ||
}, | ||
}), | ||
)(SidebarScreen); | ||
Luke9389 marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import {withNavigation} from '@react-navigation/compat'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import compose from '../../../../libs/compose'; | ||
import withWindowDimensions from '../../../../components/withWindowDimensions'; | ||
import withLocalize from '../../../../components/withLocalize'; | ||
import ONYXKEYS from '../../../../ONYXKEYS'; | ||
import {sidebarPropTypes, sidebarDefaultProps} from './sidebarPropTypes'; | ||
import BaseSidebarScreen from './BaseSidebarScreen'; | ||
|
||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
const SidebarScreen = props => <BaseSidebarScreen {...props} />; | ||
|
||
SidebarScreen.propTypes = sidebarPropTypes; | ||
SidebarScreen.defaultProps = sidebarDefaultProps; | ||
SidebarScreen.displayName = 'SidebarScreen'; | ||
Luke9389 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
export default compose( | ||
withNavigation, | ||
withLocalize, | ||
withWindowDimensions, | ||
withOnyx({ | ||
allPolicies: { | ||
key: ONYXKEYS.COLLECTION.POLICY, | ||
}, | ||
betas: { | ||
key: ONYXKEYS.BETAS, | ||
}, | ||
isCreatingWorkspace: { | ||
key: ONYXKEYS.IS_CREATING_WORKSPACE, | ||
}, | ||
}), | ||
)(SidebarScreen); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import PropTypes from 'prop-types'; | ||
import {windowDimensionsPropTypes} from '../../../../components/withWindowDimensions'; | ||
import {withLocalizePropTypes} from '../../../../components/withLocalize'; | ||
|
||
const sidebarPropTypes = { | ||
|
||
/** The list of policies the user has access to. */ | ||
allPolicies: PropTypes.shape({ | ||
/** The policy name */ | ||
name: PropTypes.string, | ||
}).isRequired, | ||
|
||
/* Beta features list */ | ||
betas: PropTypes.arrayOf(PropTypes.string).isRequired, | ||
Luke9389 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/* Is workspace is being created by the user? */ | ||
isCreatingWorkspace: PropTypes.bool, | ||
|
||
...windowDimensionsPropTypes, | ||
|
||
...withLocalizePropTypes, | ||
}; | ||
|
||
const sidebarDefaultProps = { | ||
isCreatingWorkspace: false, | ||
}; | ||
|
||
export {sidebarPropTypes, sidebarDefaultProps}; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.