Repository navigation
[No QA] Add a special gesture on dev to open the test tool menu #17253
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
Merged
neil-marcellini
merged 33 commits into
Expensify:main
from
alexxxwork:neil-test-tool-gesture
Apr 19, 2023
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
54c2cc6
Wrap with a TestToolsGesture detector on dev only
neil-marcellini 324f857
Merge branch 'main' into neil-test-tool-gesture
neil-marcellini 4386786
Restore previous work
neil-marcellini ccdaf00
Add 4-tap gesture and move to ScreenWrapper
alexxxwork 6bc8ad3
Fix trailing spaces, delete gesture detector
alexxxwork bf3b425
Add react-native-dev-menu item
alexxxwork 57abc31
Fix lint issues, add necessary files
alexxxwork c0dc3c7
Fix lint issues
alexxxwork 18844ee
Merge branch 'main' into neil-test-tool-gesture
alexxxwork be97a70
Add BaseScreenWrapper, CONST, TestTool action
alexxxwork b946971
Merge branch 'main' into neil-test-alex
alexxxwork 9e947fc
Merge branch 'main' into neil-test-alex
alexxxwork 6cc6f45
Fix lint issues
alexxxwork 5a553ab
Fix more lint issues and withWindowDimensions
alexxxwork dba33d4
Fix more lint issues
alexxxwork 2fac5ad
Fix import issue
alexxxwork 414d29e
Merge branch 'main' into neil-test-alex
alexxxwork dc4d281
Update src/CONST.js
alexxxwork f7d923d
Update src/CONST.js
alexxxwork f2442f7
Fix CONST name
alexxxwork 8808ed6
Move hocs to BaseScreenWrapper
alexxxwork afbb784
Fix copy, styling and props
alexxxwork b79e16b
Remove unused props
alexxxwork 6f5d493
Merge branch 'main' into neil-test-tool-gesture
alexxxwork a18fa6c
Add CustomDevMenu, revert to ScreenWrapper
alexxxwork e5bcfcf
Fix lint issue
alexxxwork 944fabd
Refactor CustomDevMenu and ScreenWrapper
alexxxwork cbff1f4
Minor change
alexxxwork 547ca6c
Style fix in ScreenWrapper
alexxxwork 5cd5d48
Merge branch 'main' into neil-test-tool-gesture
alexxxwork bf70370
Merge branch 'main' into neil-alex
alexxxwork 77782f7
Add react-native-dev-menu to mocks
alexxxwork 11b9f8c
Fix lint issue
alexxxwork 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 hidden or 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,3 @@ | ||
| export default { | ||
| addItem: jest.fn(), | ||
| }; |
This file contains hidden or 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
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,5 @@ | ||
| const CustomDevMenu = () => {}; | ||
|
|
||
| CustomDevMenu.displayName = 'CustomDevMenu'; | ||
|
|
||
| export default CustomDevMenu; |
This file contains hidden or 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,15 @@ | ||
| import {useEffect} from 'react'; | ||
| import DevMenu from 'react-native-dev-menu'; | ||
| import toggleTestToolsModal from '../../libs/actions/TestTool'; | ||
|
|
||
| const CustomDevMenu = () => { | ||
| useEffect(() => { | ||
| DevMenu.addItem('Open Test Preferences', toggleTestToolsModal); | ||
| }, []); | ||
|
|
||
| return null; | ||
| }; | ||
|
|
||
| CustomDevMenu.displayName = 'CustomDevMenu'; | ||
|
|
||
| export default CustomDevMenu; |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,51 @@ | ||
| import React from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| import {withOnyx} from 'react-native-onyx'; | ||
| import {View} from 'react-native'; | ||
| import ONYXKEYS from '../ONYXKEYS'; | ||
| import Modal from './Modal'; | ||
| import CONST from '../CONST'; | ||
| import toggleTestToolsModal from '../libs/actions/TestTool'; | ||
| import TestToolMenu from './TestToolMenu'; | ||
| import styles from '../styles/styles'; | ||
|
|
||
| const propTypes = { | ||
| /** Details about modal */ | ||
| modal: PropTypes.shape({ | ||
| /** Indicates when an Alert modal is about to be visible */ | ||
| willAlertModalBecomeVisible: PropTypes.bool, | ||
| }), | ||
|
|
||
| /** Whether the test tools modal is open */ | ||
| isTestToolsModalOpen: PropTypes.bool, | ||
| }; | ||
|
|
||
| const defaultProps = { | ||
| modal: {}, | ||
| isTestToolsModalOpen: false, | ||
| }; | ||
|
|
||
| const TestToolsModal = props => ( | ||
| <Modal | ||
| isVisible={props.isTestToolsModalOpen} | ||
| type={CONST.MODAL.MODAL_TYPE.CENTERED_SMALL} | ||
| onClose={toggleTestToolsModal} | ||
| > | ||
| <View style={[styles.settingsPageBody, styles.p5]}> | ||
| <TestToolMenu /> | ||
| </View> | ||
| </Modal> | ||
| ); | ||
|
|
||
| TestToolsModal.propTypes = propTypes; | ||
| TestToolsModal.defaultProps = defaultProps; | ||
| TestToolsModal.displayName = 'TestToolsModal'; | ||
|
|
||
| export default withOnyx({ | ||
| modal: { | ||
| key: ONYXKEYS.MODAL, | ||
| }, | ||
| isTestToolsModalOpen: { | ||
| key: ONYXKEYS.IS_TEST_TOOLS_MODAL_OPEN, | ||
| }, | ||
| })(TestToolsModal); |
This file contains hidden or 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,22 @@ | ||
| import Onyx from 'react-native-onyx'; | ||
| import _ from 'underscore'; | ||
| import ONYXKEYS from '../../ONYXKEYS'; | ||
| import CONST from '../../CONST'; | ||
|
|
||
| let isTestToolsModalOpen = false; | ||
| Onyx.connect({ | ||
| key: ONYXKEYS.IS_TEST_TOOLS_MODAL_OPEN, | ||
| callback: val => isTestToolsModalOpen = val || false, | ||
| }); | ||
|
|
||
| /** | ||
| * Toggle the test tools modal open or closed. | ||
| * Throttle the toggle to make the modal stay open if you accidentally tap an extra time, which is easy to do. | ||
| */ | ||
| function toggleTestToolsModal() { | ||
| const toggle = () => Onyx.set(ONYXKEYS.IS_TEST_TOOLS_MODAL_OPEN, !isTestToolsModalOpen); | ||
| const throttledToggle = _.throttle(toggle, CONST.TIMING.TEST_TOOLS_MODAL_THROTTLE_TIME); | ||
| throttledToggle(); | ||
| } | ||
|
|
||
| export default toggleTestToolsModal; |
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -28,6 +28,10 @@ export default { | |
| minWidth: '25%', | ||
| }, | ||
|
|
||
| mnw120: { | ||
| minWidth: 120, | ||
| }, | ||
|
|
||
| w50: { | ||
| width: '50%', | ||
| }, | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.