-
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
Fix: back handler for Drawer #5745
Changes from 15 commits
bf5b355
3753c9d
2fd9753
d438612
58f6d1e
0c1a2a8
a9c8908
7f8577d
902ca46
6340532
27ea073
94498c7
ab7113c
f249b08
b50b783
080ce7e
9fe64ea
05aa313
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,10 +52,11 @@ | |
"@react-native-masked-view/masked-view": "^0.2.4", | ||
"@react-native-picker/picker": "^1.9.11", | ||
"@react-navigation/compat": "^5.3.15", | ||
"@react-navigation/drawer": "6.1.4", | ||
"@react-navigation/native": "6.0.2", | ||
"@react-navigation/stack": "6.0.7", | ||
"@react-navigation/drawer": "6.1.7", | ||
"@react-navigation/native": "6.0.5", | ||
"@react-navigation/stack": "6.0.10", | ||
"babel-plugin-transform-remove-console": "^6.9.4", | ||
"babel-polyfill": "^6.26.0", | ||
"dotenv": "^8.2.0", | ||
"electron-context-menu": "^2.3.0", | ||
"electron-log": "^4.3.5", | ||
|
@@ -92,7 +93,7 @@ | |
"react-native-permissions": "^3.0.1", | ||
"react-native-picker-select": "8.0.4", | ||
"react-native-plaid-link-sdk": "^7.1.0", | ||
"react-native-reanimated": "^2.3.0-alpha.1", | ||
"react-native-reanimated": "^2.3.0-beta.3", | ||
Comment on lines
-95
to
+96
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. Hey @Beamanator @parasharrajat this change here seems to have broken the Attachment Picker for me on iOS: https://expensify.slack.com/archives/C01GTK53T8Q/p1635874753343600 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. Hey, @kidroca this is PR is reverted now. Thanks for notifying me. |
||
"react-native-render-html": "6.0.0-beta.8", | ||
"react-native-safe-area-context": "^3.1.4", | ||
"react-native-screens": "^3.0.0", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import PropTypes from 'prop-types'; | ||
import {windowDimensionsPropTypes} from '../../../../components/withWindowDimensions'; | ||
|
||
const propTypes = { | ||
/** Screens to be passed in the Drawer */ | ||
screens: PropTypes.arrayOf(PropTypes.shape({ | ||
/** Name of the Screen */ | ||
name: PropTypes.string.isRequired, | ||
|
||
/** Component for the Screen */ | ||
component: PropTypes.elementType.isRequired, | ||
|
||
/** Optional params to be passed to the Screen */ | ||
// eslint-disable-next-line react/forbid-prop-types | ||
initialParams: PropTypes.object, | ||
})).isRequired, | ||
|
||
/** Drawer content Component */ | ||
drawerContent: PropTypes.elementType.isRequired, | ||
|
||
/** Whether use the legacy implementation of Drawer */ | ||
useLegacyImplementation: PropTypes.bool, | ||
|
||
/** If it's the main screen, don't wrap the content even if it's a full screen modal. */ | ||
isMainScreen: PropTypes.bool, | ||
|
||
/** Window Dimensions props */ | ||
...windowDimensionsPropTypes, | ||
}; | ||
|
||
const defaultProps = { | ||
useLegacyImplementation: false, | ||
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. Maybe make this required? Looks like it is being passed to all the drawers (or should be if not). 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. Yeah. Required is fine. I will update. 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. It's just fine this way, otherwise, we will get the Prop validation warning and to remove that we have to manipluate the propsType definition (extra overhead). 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.
Do you mean the linter?
What does this mean? Why does it create extra overhead? 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. It's not an overhead. I was just being lazy. Updated |
||
}; | ||
|
||
export { | ||
propTypes, | ||
defaultProps, | ||
}; |
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,22 @@ | ||||||||||||
import React from 'react'; | ||||||||||||
import withWindowDimensions from '../../../../components/withWindowDimensions'; | ||||||||||||
import BaseDrawerNavigator from './BaseDrawerNavigator'; | ||||||||||||
import {propTypes, defaultProps} from './drawerNavigatorPropTypes'; | ||||||||||||
|
||||||||||||
const DrawerNavigator = props => ( | ||||||||||||
<BaseDrawerNavigator | ||||||||||||
// eslint-disable-next-line react/jsx-props-no-spreading | ||||||||||||
{...props} | ||||||||||||
|
||||||||||||
// Drawer's implementaion is buggy. Modern implementaion does not work on mobile web and legacy breaks the layout on Desktop while resizing. | ||||||||||||
// For some reason, drawer never closes when opening the Drawer screen on mobile web. | ||||||||||||
// So we will switch between implementations based on the device width. | ||||||||||||
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
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. Is there any issue we are tracking for this? 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. No. I will create one. 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. No yet, I will create one in our repo. |
||||||||||||
// eslint-disable-next-line react/jsx-props-no-multi-spaces | ||||||||||||
useLegacyImplementation={props.isSmallScreenWidth} | ||||||||||||
/> | ||||||||||||
); | ||||||||||||
|
||||||||||||
DrawerNavigator.propTypes = propTypes; | ||||||||||||
DrawerNavigator.defaultProps = defaultProps; | ||||||||||||
DrawerNavigator.displayName = 'DrawerNavigator'; | ||||||||||||
export default withWindowDimensions(DrawerNavigator); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import withWindowDimensions from '../../../../components/withWindowDimensions'; | ||
import BaseDrawerNavigator from './BaseDrawerNavigator'; | ||
import {propTypes, defaultProps} from './drawerNavigatorPropTypes'; | ||
|
||
const DrawerNavigator = props => ( | ||
<BaseDrawerNavigator | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...props} | ||
useLegacyImplementation={false} | ||
/> | ||
); | ||
|
||
DrawerNavigator.propTypes = propTypes; | ||
DrawerNavigator.defaultProps = defaultProps; | ||
DrawerNavigator.displayName = 'DrawerNavigator'; | ||
export default withWindowDimensions(DrawerNavigator); |
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.
Just curious, what needed
babel-polyfill
?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.
I followed https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support. I don't know the consequences of removing this.
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.
I followed https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/web-support. I don't know the consequences of removing this.