-
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
[HOLD for payment 2022-05-20]iOS - Chat - The maximum height of compose box is 5 instead of 6 lines. #7980
Comments
Triggered auto assignment to @francoisl ( |
Triggered auto assignment to @kevinksullivan ( |
Proposal: Line 377 in ea691f0
App/src/components/TextInputFocusable/index.android.js Lines 66 to 74 in ea691f0
<RNTextInput
placeholderTextColor={themeColors.placeholderText}
ref={el => this.textInput = el}
- maxHeight={CONST.COMPOSER_MAX_HEIGHT}
+ maxHeight={CONST.COMPOSER_MAX_HEIGHT_ANDROID}
rejectResponderTermination={false}
editable={!this.props.isDisabled}
/* eslint-disable-next-line react/jsx-props-no-spreading */
{...this.props}
/> App/src/components/TextInputFocusable/index.ios.js Lines 78 to 86 in ea691f0
<RNTextInput
placeholderTextColor={themeColors.placeholderText}
ref={el => this.textInput = el}
- maxHeight={CONST.COMPOSER_MAX_HEIGHT}
+ maxHeight={CONST.COMPOSER_MAX_HEIGHT_IOS}
rejectResponderTermination={false}
editable={!this.props.isDisabled}
/* eslint-disable-next-line react/jsx-props-no-spreading */
{...propsToPass}
/> |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat ( |
Triggered auto assignment to @pecanoro ( |
I don't understand the proposal @sobitneupane. What does changing height have to do anything with it? AFAIK, react-native usages DPI. |
ProposalWe need to calculate correct value of Line 377 in 0e3bbe7
- COMPOSER_MAX_HEIGHT: 116,
+ COMPOSER_MAX_HEIGHT: 130, // lineHeight*numberOfLines + marginVertical (20*6 + (5 + 5)) Tested on |
The issue was also there in |
Record_2022-03-04-18-01-08.mp4 |
Proposal
App/src/components/TextInputFocusable/index.ios.js Lines 15 to 17 in 0e3bbe7
const propTypes = {
/** Maximum number of lines in the text input */
maxLines: PropTypes.number,
/** General styles to apply to the text input */
// eslint-disable-next-line react/forbid-prop-types
style: PropTypes.any,
const defaultProps = {
maxLines: -1,
style: null,
class TextInputFocusable extends React.Component {
constructor(props) {
super(props);
this.state = {
textInputMaxHeight: CONST.COMPOSER_MAX_HEIGHT,
};
}
render() {
// Selection Property not worked in IOS properly, So removed from props.
const propsToPass = _.omit(this.props, 'selection');
const maxHeight = CONST.COMPOSER_MAX_HEIGHT;
const propStyles = StyleSheet.flatten(this.props.style);
return (
<RNTextInput
EDITED: We should use return (
<RNTextInput
placeholderTextColor={themeColors.placeholderText}
ref={el => this.textInput = el}
maxHeight={this.state.textInputMaxHeight}
rejectResponderTermination={false}
editable={!this.props.isDisabled}
onContentSizeChange={(event) => {
const height = event.nativeEvent.contentSize.height;
const lines = Math.round(height / propStyles.lineHeight);
const visibleLines = lines < this.props.maxLines ? lines : this.props.maxLines;
if (visibleLines >= this.props.maxLines) {
this.setState({textInputMaxHeight: maxHeight + propStyles.lineHeight});
}
}} |
Adding to my initial proposal #7980 (comment) we can alternatively pass the required props and calculate the const maxLines = this.props.maxLines;
const { lineHeight, marginVertical } = StyleSheet.flatten(propsToPass.style);
const maxHeight = lineHeight*maxLines + 2*marginVertical; |
Ok, we can calculate the maxHeight of the component based on max lines. I like @mdneyazahmad 's proposals. But this const is also used in cc: @pecanoro |
Cool! @mdneyazahmad I assigned you the issue, don't forget to apply for the job in Upwork |
📣 @mdneyazahmad You have been assigned to this job by @pecanoro! |
+1 @mdneyazahmad please apply for the job in upwork and I'll hire you there as well. Thanks! |
For now, I would suggest keeping the same behavior as it is working now. We don't have to improve it. |
The number of lines is not 6 on native device. This will fix it #7980 (comment) |
Sorry, I have already given my suggestion. I don't have anything else to ask or suggest. If you are still facing issues, I suggest you ask on public channel. |
Thank you then should we close this |
cc: @pecanoro ⬆️ |
I am a bit confused, is there a reason why we shouldn't do this? I know we should try to make it dynamic, but it seems it's a fixed value already, right? |
Discussion is happening around applying the dynamic solution. #7980 (comment) was suggested to be added. My suggestion is to apply this dynamically. Based on #7980 (comment) , this prop will have two values on the web. I don't see how replacing the const will use a dynamic value of maxLines prop. @mdneyazahmad is trying to get a solution to do that. There are two places where this CONST is used. #7980 (comment). @mdneyazahmad is already hired for the issue and we are awaiting a PR. |
@parasharrajat This #7980 (comment) is not used in |
Sorry, I didn't understand. What is trying to say by referring to this statement? You have pointed that out a few times. |
App/src/components/Composer/index.js Lines 190 to 195 in 9a8291b
But we are not using this App/src/components/Composer/index.ios.js Line 81 in 9a8291b
|
Ok, Thanks. But even on |
It is not an issue there it works as expected. |
This issue only exists in |
I still think calculating the values dynamically should be the way as hard-coded values will be more error-prone. But @pecanoro I leave the decision to you. Thanks. This is the @mdneyazahmad's suggested change #7980 (comment) |
So I would usually agree that a dynamic value would be better, but it is already hardcoded so it's not that we are making it worse. Also, since making it dynamic does not seem that straightforward, let's just fix this issue with the proposed solution and maybe in the future we can refactor the whole thing to make it dynamic. @mdneyazahmad I will assign the job to you! |
Oh wait, the issue had gone pretty long, you are assigned already! Go ahead with the PR, just make sure it does not cause any regressions. |
PR being worked on |
Issue not reproducible during KI retests. (First week) |
@kevinksullivan This was merged and deployed to staging more than a week ago |
All set and payments sent. Thanks @parasharrajat and @mdneyazahmad ! |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Issue was found when executing #7891
Action Performed:
Expected Result:
The maximum height of compose box does not exceed 6 lines.
Actual Result:
The maximum height of compose box is 5 lines.
Workaround:
Visual
Platform:
Where is this issue occurring?
Version Number: 1.1.41-1
Reproducible in staging?: Y
Reproducible in production?: Y
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:
https://user-images.githubusercontent.com/43996225/156388405-4c55d506-50f9-4e2c-a9c7-00f43bc8f2e7.mp4
Expensify/Expensify Issue URL:
Issue reported by: Applause
Job Post: https://www.upwork.com/jobs/~013a3b361194e64884
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: