Open lanitochka17 opened 9 months ago
Triggered auto assignment to @garrettmknight (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Platforms
in OP are ✅)Assign Task- The header "from" field shows "Fro..." instead of " From username/email id"
In React Native, the Text
component does not automatically take the full available space within its parent container by default. This behavior is different from web-based HTML elements, where elements such as <div>
automatically take the full width of their parent container.
The reason why the Text
component doesn't take full space is because of its inherent behavior as a text-rendering component. The width of the Text
component is determined by the size of its content, and it will wrap to the next line if the content exceeds the available width. The default width of a Text
component is essentially based on the width required to display its content without overflowing.
android textbreakstrategy explanation here and here
If we want the Text component to take full space or expand to fill the available width of its parent container, we need to explicitly specify a width style for the Text component or use flexbox properties to control its dimensions.
1) using flexbox `flex:1`
https://github.com/Expensify/App/blob/8d84c23ae3a21130a540794104313b2f7e7e6b6a/src/components/ParentNavigationSubtitle.js?#L48 need add flex1 parent also need flex1 https://github.com/Expensify/App/blob/8d84c23ae3a21130a540794104313b2f7e7e6b6a/src/pages/home/HeaderView.js?#L196 updated correct https://github.com/Expensify/App/issues/24339#issuecomment-1690214992
2) when styles.alignSelfStart
its will not take full space. so that in android its not take up the full space.
the problem is android only so we can create a platform based style file like this under styles/HeaderViewStyle
index.js
index.android.js
index.js we can add styles.alignSelfStart
and styles.mw100
in index.android.js we don't need that so we can declare an empty style on that. or in android apply styles.alignSelfStart
and styles.w100
so that it will take full space.
in Pressable style
pressableStyles={headerViewStyle.pressableStyles}
headerViewStyle import basic of platform-based so in android pressableStyles
return empty style sheet.
Job added to Upwork: https://www.upwork.com/jobs/~013e6bf0d4c8e7ce65
Current assignee @garrettmknight is eligible for the External assigner, not assigning anyone new.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @abdulrahuman5196 (External
)
Assign Task- The header "from" field shows "Fro..." instead of " From username/email id"
the root cause I had finally found, it is the issue on Android when layout the text content, if there's space in strings, then it will auto break to the new line when wrap, wrap means it has more than one line, and we setmaxlines = 1, then it will wrap, and will break at the space position, that's why we see it ellipsis at From..., as after "From" there's a space char.
replace the space char with unicode will solve this issue, and it will have no regression issues on other platforms as the layout does not change, and we just "escaped space char with unicode", I tested it, it works on mobile both, and web desktop. For safely without any other issue on Android when there's some special chars make it unexpected break to new line, we could escape the string with unicode '\u200D'. use unicode '\u00A0' no-break space replace the space char we need to have, ie, 'From ' to be 'From\u00A0', tell the os not to beak, we add '\u200D' before special chars, tell the os it will join, while not break to a new line. The key to solve this issue is that we use the unicode features, to keep the display text same and let the os know how to do. after we replace the white space ' ' with unicode '\u00A0', on Android, there maybe still some issue for some special chars, so we could map the string to chars, then check the char, if it is a white space, we use '\u00A0' replace it, if it is out of '/[a-zA-Z\d]/' test, we think it maybe a special char, then we add '\u200D' before it, for the normal text '/[a-zA-Z\d]/' just keep it as it is.
use View layout on Android with platform specific, but it is not the real root cause solved solution, I preferred the unicode solution, text content will display to user same as before, but the issue on Android will disappear. The unicode does the magic.
📣 @gzqyl! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
Contributor details Expensify account email: allen.gzqyl@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~01e99782a01937e92c
just find that @foxmail.com can not be added slack channel, so I use google mail as a replace.
I have already checked out branch, and will merge the latest main branch when I PR, hope this issue assign to me.
@gzqyl don't create PR until assign you
@gzqyl don't create PR until assign you
@pradeepmdk thanks for your reminding, I will not create PR, just save the solution at local branch, so that I can watch other issues, and when the issue assigned to me, I can quickly checkout the branch to fix the issue.
Reviewing now
On @pradeepmdk 's proposal here, I agree that flex might be the right path to go, but the solution is not working for me.
@gzqyl On your proposal here https://github.com/Expensify/App/issues/24339#issuecomment-1674338057, we would need to know what change you are expecting to make explained as per our contributing guidelines to review the proposal - https://github.com/Expensify/App/blob/main/contributingGuides/CONTRIBUTING.md
@abdulrahuman5196 for me its working let's add my code here
App/src/components/ParentNavigationSubtitle.js
App/src/pages/home/HeaderView.js
Result before flex1
after flex1
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
@abdulrahuman5196 can you review?
@garrettmknight, @abdulrahuman5196 Whoops! This issue is 2 days overdue. Let's get this updated quick!
@abdulrahuman5196 please prioritize this one so we can get it moving. Thanks!
I am looking forward to the early reply too, as my proposal does fix the issue.
@garrettmknight I can help this to push forward.
No satisfactory proposals yet. If we stretch subtitle, it will cause regression - #21215
@situchan had you tested my proposal? I think my proposal works, and I will test the regression https://github.com/Expensify/App/issues/21215 later
@gzqyl you stretched subtitle by adding width: '100%'
@situchan Okay, let me test https://github.com/Expensify/App/issues/21215 firstly
❌ There was an error making the offer to @situchan for the Contributor role. The BZ member will need to manually hire the contributor. cc @thienlnam
❌ There was an error making the offer to @situchan for the Contributor role. The BZ member will need to manually hire the contributor. cc @thienlnam
does it mean this issue already assigned to @situchan , and @situchan gets the offer, so others' proposal will not get offer any more even if others update their proposals?
If @situchan accepts your proposals, you'll be assigned. Right now that's just clarifying that he's the C+ assigned to this bug.
@garrettmknight thanks, now I understand the process clearly, and I will try to think if we can get a better way to solve this issue
@gzqyl Click on the right area of email text. It should still go to details page, not parent report
@situchan tested mac desktop, right area of email text will go to details page, I will test ios now, for android, it had already occupied the full space, so there's no blank area right of email text.
@situchan How about specify the platform "Android", only on android, we use this style minWidth? This is not the best solution, for now, I have no other ideas, I will try to find a better way.
@situchan can you check this one https://github.com/Expensify/App/issues/24339#issuecomment-1676328189 because this will not create a regression https://github.com/Expensify/App/issues/21215
when we remove styles.alignSelfStart
only it will create the regression
why we should View while not Text here? on Android, Text changes in some cases not re-render after its size changes, that's why other platform is ok, Android keeps its short width size, use View will solve this issue, it will auto re-render and keep its layout adaptive with the Text width, we use flex row makes numberOfLines={1} works, and use flexShrink make it "inline-block" like a Text, hope that my proposal will be selected, I worked on this issue for hours already.
@garrettmknight @situchan this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!
@gzqyl I am still not inclined to your solution. Let's fix the root cause.
@situchan anyway, my solution has fixed the issue, and no any other regression issue occurs, I had already tested on the all platform, it really works.
@situchan were you able to check mine https://github.com/Expensify/App/issues/24339#issuecomment-1676328189
@pradeepmdk your solution does not work on ios device, and the style is a little strange on mobile device, I still think that the right way to solve this issue is using View while not Text only, my solution is almost the perfect, and tested on mobile, desktop, web, style is ok and no other issues.
@gzqyl yes, I agree, its adding space on native due to flex1
cc @situchan
we need add flexShrink1
web also working fine.
pressableStyles={[styles.alignSelfStart, styles.flexShrink1, styles.flexRow]}
and
style={[styles.optionAlternateText, styles.flex1 ]}
@situchan can you check my updated one https://github.com/Expensify/App/issues/24339#issuecomment-1690214992
@situchan can you review the updated solution here? If it's not satisfactory, should we be upping the $$ on this one?
@situchan can you review the updated solution here? If it's not satisfactory, should we be upping the $$ on this one?
yes, still looking for ideal solution which fixes the root cause which happens only on android
Upwork job price has been updated to $2000
Upwork job price has been updated to $1000
Just saw that the Help Wanted label got dropped. Readding and seeing if we get any other proposals before upping the price.
Assign Task- The header "from" field shows "Fro..." instead of " From username/email id"
The problem here is that unnecessary styling is being added to the ParentNavigationSubtitle. This issue isn't just limited to tasks; it's happening everywhere we use the HeaderView. For instance, we're seeing the same problem in thread headers as well.
Interestingly, this problem doesn't appear in IOU reports. The reason is that the styling used in that context is correct and doesn't cause the same issue.
We should implement the ParentNavigationSubtitle
in HeaderView the same way we do for IOU reports in AvtarWithDisplayName.
https://github.com/Expensify/App/blob/1139e7ca891e3b0b84d6773ef82152adf3083ed4/src/components/AvatarWithDisplayName.js#L129-L132
https://github.com/Expensify/App/blob/1139e7ca891e3b0b84d6773ef82152adf3083ed4/src/pages/home/HeaderView.js#L193-L197
I've observed that the issue stems from the usage of styles.alignSelfStart. To address this, we have two options:
Before
After
I have added background color here for convenience
@situchan the problem is android only so we can create a platform based style file like this under styles/HeaderViewStyle index.js index.android.js
index.js we can add styles.alignSelfStart and styles.mw100 in index.android.js we don't need that so we can declare an empty style on that.
@garrettmknight I had already solved this issue indeed, and I had already tested my solution on web, android, ios, desktop, it is fine without any other regression issue. Though @situchan was not much agree with the stated root cause is that using Text wrap Text is not a good practice, we should use View to keep flex layout works on all platforms. My solution is already a tested ok solution, hope that my proposal could be considered again, and when we want to layout multi Text component in later dev, we just use View layout it is ok, not much hard to understand, style the View and its child Text component is enough to solve such issue in the future devs.
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
In task conversation page, the header "from" field must show user name/ email id of contact which is selected for " Share somewhere "
Actual Result:
In task conversation page, the header "from" field shows "Fro..." instead of " From username/email id"
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: 1.3.52.1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
https://github.com/Expensify/App/assets/78819774/ebdc20aa-a271-4b83-bc27-488976019d6d
https://github.com/Expensify/App/assets/78819774/d063ac8b-a65d-4c1a-a4a6-7db76270af3d
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
View all open jobs on GitHub
Upwork Automation - Do Not Edit