-
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
Changes from 15 commits
e70b5cb
8d96ea1
c99bec9
27a4c22
015b933
fa81912
e3c7cc6
a2f3f11
104140a
6645bab
e2f09bb
754cae0
8b0c4d8
fef13b2
646b621
b8839f0
37476d7
a9faa80
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -64,41 +64,22 @@ 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, | ||||||
); | ||||||
if (!this.props.disableArrowKeysActions) { | ||||||
ahmedGaber93 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
this.subscribeToKeyboardShortcut(); | ||||||
} | ||||||
|
||||||
this.scrollToIndex(this.props.selectedOptions.length ? 0 : this.state.focusedIndex, false); | ||||||
} | ||||||
|
||||||
componentDidUpdate(prevProps) { | ||||||
if (prevProps.disableArrowKeysActions !== this.props.disableArrowKeysActions) { | ||||||
if (this.props.disableArrowKeysActions) { | ||||||
this.unSubscribeToKeyboardShortcut(); | ||||||
} else { | ||||||
this.subscribeToKeyboardShortcut(); | ||||||
} | ||||||
} | ||||||
|
||||||
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 +129,7 @@ class BaseOptionsSelector extends Component { | |||||
clearTimeout(this.focusTimeout); | ||||||
} | ||||||
|
||||||
if (this.unsubscribeEnter) { | ||||||
this.unsubscribeEnter(); | ||||||
} | ||||||
|
||||||
if (this.unsubscribeCTRLEnter) { | ||||||
this.unsubscribeCTRLEnter(); | ||||||
} | ||||||
this.unSubscribeToKeyboardShortcut(); | ||||||
} | ||||||
|
||||||
/** | ||||||
|
@@ -179,6 +154,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]; | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -116,7 +116,7 @@ function buildOnyxDataForMoneyRequest( | |||||||||||||
key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.reportID}`, | ||||||||||||||
value: { | ||||||||||||||
...iouReport, | ||||||||||||||
lastMessageText: iouAction.message[0].text, | ||||||||||||||
lastMessageText: ReportUtils.formatReportLastMessageText(iouAction.message[0].text), | ||||||||||||||
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. 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. Actually I think this can be separate issue to fix inconsistency between optimistic data and backend data for last message text with multiline description. 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.
Are you mean remove new lines "\n" from message text? 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.
I meant to keep that optimistic value as is now but just fix display issue of wrapped 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. the wrap happened here because For that, we can fix it by replace App/src/components/LHNOptionsList/OptionRowLHN.js Lines 87 to 92 in 4362fe7
This will remove the new lines "\n" from message text and fix the wrap issue, but inconsistency with backend will still issue. 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. Workaround cannot be a quick fix. 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. I can't find a quick fix right now. What is the next step now?
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.
We can't do this because it looks weird and our PR might need to be reverted.
This is still concerned but we would consider this not a deploy blocker I believe. 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. Yes, I update the code to use styles.noWrap 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.
|
||||||||||||||
lastMessageHtml: iouAction.message[0].html, | ||||||||||||||
...(isNewIOUReport ? {pendingFields: {createChat: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD}} : {}), | ||||||||||||||
}, | ||||||||||||||
|
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)