-
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
Hide Keyboard shortcuts menu in Native Devices #6881
Hide Keyboard shortcuts menu in Native Devices #6881
Conversation
src/pages/settings/AboutPage.js
Outdated
}; | ||
|
||
const AboutPage = (props) => { | ||
const shouldShowKeyboardShortcutsMenu = !props.isSmallScreenWidth && [CONST.PLATFORM.WEB, CONST.PLATFORM.DESKTOP].indexOf(getPlatform()) > -1; |
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.
Sorry, due to our code guidelines we cannot use getPlatform
here – using it is basically equivalent to using Platform.select
or Platform.OS
, which is prohibited in our app (consult the README, section Cross Platform 99.9999%
. We should make this more explicit in our javascript style guide.
Anyways, the way you should implement this is:
-
Update the module structure as follows:
src/pages/settings/AboutPage/ ----| index.js // Move all the code from the current AboutPage.js to here ----| platformSpecificMenuItems --------| index.js // Export an array that contains the keyboard shortcuts menu item on wide screens or an empty array on narrow screens (mobile web) --------| index.native.js // Export an empty array
-
In the new
AboutPage/index.js
, import theplatformSpecificMenuItems
and add them to the array of menu items before rendering.
I know that this has the same result as what you've done here, but we've standardized on a code style that uses platform-specific file extensions instead of inline platform checks.
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.
Okay, I am aware of the index.native.js
, etc. but wasn't aware that getPlatform
cannot be used. I'll update the PR
Sorry for the inconvenience but I think we should hold this PR as a new discussion is popped up to enable keyboard shortcuts on native. https://expensify.slack.com/archives/C01GTK53T8Q/p1640208283479700 we may have to rethink about hiding the link on native. |
Nevertheless I am done with the changes @roryabraham suggested. |
@jasperhuangg Since pull request fixes a deploy-blocking regression, I am going to test this, and if it works then I'll merge it and CP to staging. We can treat #6883 as a separate issue. |
|
(cherry picked from commit c218d61)
🚀 Deployed to staging by @roryabraham in version: 1.1.23-2 🚀
|
🚀 Deployed to production by @francoisl in version: 1.1.24-8 🚀
|
Details
Fixed Issues
$ #6879
$ #6660
Tests
QA Steps
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android