-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
allow Request money 'Description' to accept multiline #21664
Merged
Merged
Changes from 17 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e70b5cb
allow Request money 'Description' to accept multiline
ahmedGaber93 8d96ea1
add prop type numberOfLines for menuItemPropTypes.js
ahmedGaber93 c99bec9
allow Request money 'Description' to accept multiline - remove header…
ahmedGaber93 27a4c22
Merge branch 'main' into issue-19872
ahmedGaber93 015b933
fix Request money 'Description' auto focus && submit on enter
ahmedGaber93 fa81912
Merge branch 'main' into issue-19872
ahmedGaber93 e3c7cc6
request money description max lines
ahmedGaber93 a2f3f11
Merge branch 'main' into issue-19872
ahmedGaber93 104140a
money request mobile fix submitOnEnter behaviour
ahmedGaber93 6645bab
money request mobile fix submitOnEnter behaviour
ahmedGaber93 e2f09bb
prettier
ahmedGaber93 754cae0
Merge branch 'main' into issue-19872
ahmedGaber93 8b0c4d8
update DisplayNamesWithToolTip.js Text style
ahmedGaber93 fef13b2
fix lastMessageText multiline on request money.
ahmedGaber93 646b621
fix request money merchant text not break.
ahmedGaber93 b8839f0
fix BaseOptionsSelector.js keyboard shortcut listener
ahmedGaber93 37476d7
fix lastMessageText display on LHN.
ahmedGaber93 a9faa80
rename unSubscribeFromKeyboardShortcut
ahmedGaber93 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
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
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
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 | ||||
---|---|---|---|---|---|---|
|
@@ -64,41 +64,20 @@ class BaseOptionsSelector extends Component { | |||||
} | ||||||
|
||||||
componentDidMount() { | ||||||
const enterConfig = CONST.KEYBOARD_SHORTCUTS.ENTER; | ||||||
this.unsubscribeEnter = KeyboardShortcut.subscribe( | ||||||
enterConfig.shortcutKey, | ||||||
this.selectFocusedOption, | ||||||
enterConfig.descriptionKey, | ||||||
enterConfig.modifiers, | ||||||
true, | ||||||
() => !this.state.allOptions[this.state.focusedIndex], | ||||||
); | ||||||
|
||||||
const CTRLEnterConfig = CONST.KEYBOARD_SHORTCUTS.CTRL_ENTER; | ||||||
this.unsubscribeCTRLEnter = KeyboardShortcut.subscribe( | ||||||
CTRLEnterConfig.shortcutKey, | ||||||
() => { | ||||||
if (this.props.canSelectMultipleOptions) { | ||||||
this.props.onConfirmSelection(); | ||||||
return; | ||||||
} | ||||||
|
||||||
const focusedOption = this.state.allOptions[this.state.focusedIndex]; | ||||||
if (!focusedOption) { | ||||||
return; | ||||||
} | ||||||
|
||||||
this.selectRow(focusedOption); | ||||||
}, | ||||||
CTRLEnterConfig.descriptionKey, | ||||||
CTRLEnterConfig.modifiers, | ||||||
true, | ||||||
); | ||||||
this.subscribeToKeyboardShortcut(); | ||||||
|
||||||
this.scrollToIndex(this.props.selectedOptions.length ? 0 : this.state.focusedIndex, false); | ||||||
} | ||||||
|
||||||
componentDidUpdate(prevProps) { | ||||||
if (prevProps.isFocused !== this.props.isFocused) { | ||||||
if (this.props.isFocused) { | ||||||
this.subscribeToKeyboardShortcut(); | ||||||
} else { | ||||||
this.unSubscribeToKeyboardShortcut(); | ||||||
} | ||||||
} | ||||||
|
||||||
if (this.textInput && this.props.autoFocus && !prevProps.isFocused && this.props.isFocused) { | ||||||
InteractionManager.runAfterInteractions(() => { | ||||||
// If we automatically focus on a text input when mounting a component, | ||||||
|
@@ -148,13 +127,7 @@ class BaseOptionsSelector extends Component { | |||||
clearTimeout(this.focusTimeout); | ||||||
} | ||||||
|
||||||
if (this.unsubscribeEnter) { | ||||||
this.unsubscribeEnter(); | ||||||
} | ||||||
|
||||||
if (this.unsubscribeCTRLEnter) { | ||||||
this.unsubscribeCTRLEnter(); | ||||||
} | ||||||
this.unSubscribeToKeyboardShortcut(); | ||||||
} | ||||||
|
||||||
/** | ||||||
|
@@ -179,6 +152,49 @@ class BaseOptionsSelector extends Component { | |||||
return defaultIndex; | ||||||
} | ||||||
|
||||||
subscribeToKeyboardShortcut() { | ||||||
const enterConfig = CONST.KEYBOARD_SHORTCUTS.ENTER; | ||||||
this.unsubscribeEnter = KeyboardShortcut.subscribe( | ||||||
enterConfig.shortcutKey, | ||||||
this.selectFocusedOption, | ||||||
enterConfig.descriptionKey, | ||||||
enterConfig.modifiers, | ||||||
true, | ||||||
() => !this.state.allOptions[this.state.focusedIndex], | ||||||
); | ||||||
|
||||||
const CTRLEnterConfig = CONST.KEYBOARD_SHORTCUTS.CTRL_ENTER; | ||||||
this.unsubscribeCTRLEnter = KeyboardShortcut.subscribe( | ||||||
CTRLEnterConfig.shortcutKey, | ||||||
() => { | ||||||
if (this.props.canSelectMultipleOptions) { | ||||||
this.props.onConfirmSelection(); | ||||||
return; | ||||||
} | ||||||
|
||||||
const focusedOption = this.state.allOptions[this.state.focusedIndex]; | ||||||
if (!focusedOption) { | ||||||
return; | ||||||
} | ||||||
|
||||||
this.selectRow(focusedOption); | ||||||
}, | ||||||
CTRLEnterConfig.descriptionKey, | ||||||
CTRLEnterConfig.modifiers, | ||||||
true, | ||||||
); | ||||||
} | ||||||
|
||||||
unSubscribeToKeyboardShortcut() { | ||||||
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. Renamed |
||||||
if (this.unsubscribeEnter) { | ||||||
this.unsubscribeEnter(); | ||||||
} | ||||||
|
||||||
if (this.unsubscribeCTRLEnter) { | ||||||
this.unsubscribeCTRLEnter(); | ||||||
} | ||||||
} | ||||||
|
||||||
selectFocusedOption() { | ||||||
const focusedOption = this.state.allOptions[this.state.focusedIndex]; | ||||||
|
||||||
|
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
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
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.
styles.noWrap
is not needed here #32555 (comment)