-
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 for: Editing workspace name to 1to3 characters adding extra line in the optional message when inviting users in Spanish #17878
Conversation
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
@techievivek @fedirjh One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@fedirjh @techievivek There are a couple of lines that weren't in my proposal: Firstly, I added this line to stop this unsightly flashing of the scrollbar that happens when you breaklines on web: Also I added this line as Android adds a tiny bit of padding to the right of the textInput which makes lines break incorrectly when typing thin characters such as Without With |
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.
Looks good. Left a few comments
@@ -218,21 +218,26 @@ class BaseTextInput extends Component { | |||
!this.props.hideFocusedState && this.state.isFocused && styles.borderColorFocus, | |||
(this.props.hasError || this.props.errorText) && styles.borderColorDanger, | |||
], (finalStyles, s) => ({...finalStyles, ...s}), {}); | |||
const maxHeight = StyleSheet.flatten(this.props.containerStyles).maxHeight; | |||
const autoGrowHeight = this.props.autoGrowHeight && this.props.multiline; |
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.
autoGrowHeight
should be added to baseTextInputPropTypes
. Also I think we should remove this line and use this.props.autoGrowHeight
directly, and for the input's prop multiline
, we can update it to :
multiline={this.props.multiline || this.props.autoGrowHeight}
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.
So when autoGrowHeight
is applied , multiline
should automatically set to true
// When autoGrowHeight is true calculate textinput width or when multiline | ||
// is not supplied calculate textinput height, using onLayout. |
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.
These comments are not so clear. Could you please update it ?
@fedirjh Thanks for the suggestions, all updated. |
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 few comments
]} | ||
multiline={this.props.multiline} | ||
multiline={this.props.multiline || this.props.autoGrowHeight} |
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.
Could you please update all other instances of this.props.multiline
to also include this.props.autoGrowHeight
, since the same rules that apply to multiline
should also apply to autoGrowHeight
? Perhaps we could create a local variable for this:
isMultiline = this.props.multiline || this.props.autoGrowHeight
onLayout={event => (this.props.autoGrowHeight && this.setState({width: event.nativeEvent.layout.width})) | ||
|| (!this.props.multiline && this.setState({height: event.nativeEvent.layout.height}))} |
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.
This can be simplified to :
onLayout = event => {
if (!this.props.autoGrowHeight && this.props.multiline){
return;
}
this.setState(prevState => ({
width: this.props.autoGrowHeight ? event.nativeEvent.layout.width : prevState.width,
height: !this.props.multiline ? event.nativeEvent.layout.height : prevState.height
}));
}
Co-authored-by: Fedi Rajhi <[email protected]>
@fedirjh Updated, thanks. |
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.
Code LGTM
@Ollyws we missed implementing the App/src/stories/TextInput.stories.js Line 61 in 17c1dd8
|
@fedirjh This last commit should fix the layout error. |
@fedirjh One thing I missed earlier is that the textInput ignores whitespace at the end of the line, but with the zero-width space appended this doesn't happen in the hidden text, causing this issue: whitespaceissue.mp4The last commit fixes this by only adding the zero-width space if the last character is |
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.
Looks good , left few comments
@fedirjh And updated as you suggested. |
@fedirjh And updated as per the latest suggestion. |
@Ollyws There are some inconsistencies:
NativeIOSScreen.Recording.2023-05-03.at.8.10.49.PM.movScreen.Recording.2023-05-03.at.8.11.35.PM.movAndroidScreen.Recording.2023-05-03.at.8.16.38.PM.movWeb/ Mobile webSafariScreen.Recording.2023-05-03.at.8.09.47.PM.movChromeScreen.Recording.2023-05-03.at.8.19.52.PM.mov |
@fedirjh The line break doesn't work on production for me either. |
{this.state.value || this.props.placeholder} | ||
{/* We are appending a zero width space (\u200B) here as the browser will remove a trailing newline that doesn't | ||
have any characters after it. This allows linebreaks to work properly on web when the user presses enter. */} | ||
{`${this.state.value}${this.props.autoGrowHeight && (this.state.value.slice(-1) === '\n') ? '\u200B' : ''}` || this.props.placeholder} |
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.
{`${this.state.value}${this.props.autoGrowHeight && (this.state.value.slice(-1) === '\n') ? '\u200B' : ''}` || this.props.placeholder} | |
{this.state.value || this.props.placeholder} |
The line break doesn't work on production for me either.
Since this is not working on production either , is there any need for these changes?
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.
@fedirjh Yeah that's for non-mobile web.
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.
Also for non-mobile web it doesn’t work either on prod
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.
Try pressing shift+enter
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.
Not working
Screen.Recording.2023-05-03.at.11.49.05.PM.mov
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.
@fedirjh The question is, was the removal of pressing enter to linebreak intentional or is it a bug?
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 think this is a bug , but it's not related to the changes within this PR , as this can be seen in production and in different places e.g. Close account
message input , I think this should be handled separately, and there is no need for these changes.
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.
Ok I'll get rid of these then.
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.
Have we reported this to the channel? But agree that this is a separate issue, so we shouldn't HOLD the PR for it.
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.
Missed this comment. We have an open ticket for this bug #18419
@fedirjh I resolved this issue by adding a fixed height to the textInput. It means we no longer needed scrollPaddingTop in Also, as we are getting closer to the 9 day penalty, perhaps we could request to not count the days between the 26th and the 1st toward the timeline? As during this period we considered the PR to be finished. |
@Ollyws Thanks for update, The native issue is fixed now , I will update the checklist with new recordings.
I am not the one who handles this, maybe you can raise that in the linked issue. |
@fedirjh Reverted the zero-width space. |
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.
The changes looks good and tests well. However, an unrelated issue was discovered during testing where the line break does not work as intended on the web. @Ollyws attempted to address the it here, albeit without success. It is recommended that this case be treated as a distinct issue and handled separately.
Over to you @techievivek
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.
Great work guys 🎉
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/techievivek in version: 1.3.11-0 🚀
|
🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.12-0 🚀
|
|
||
return { | ||
...styles.overflowHidden, | ||
height: maxHeight, |
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.
padding
and borderwidth
were not considered in maxHeight. It caused #18918 issue regression which is solved by https://github.com/Expensify/App/pull/19582/files
@@ -800,6 +800,11 @@ const styles = { | |||
backgroundColor: themeColors.buttonDefaultBG, | |||
}, | |||
|
|||
autoGrowHeightInputContainer: (textInputHeight, maxHeight) => ({ | |||
height: textInputHeight >= maxHeight ? maxHeight : textInputHeight, |
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.
👋 Coming from #22583
We were missing a check for the minimum height when setting the input height. It only checked if the calculated height is greater than the maxHeight, but didn't consider the case where the calculated height is less than the minHeight.
We resolved this by calculating the height using
lodashClamp(textInputHeight, minHeight, maxHeight)
Details
Fixed Issues
$ #17202
PROPOSAL: #17202 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
MacOS_Chrome.mp4
Mobile Web - Chrome
Android_Chrome.mp4
Mobile Web - Safari
iOS_Safari.mp4
Desktop
MacOS_Desktop.mp4
iOS
iOS_Native.mp4
Android
Android_Native.mp4