Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.13k stars 2.63k forks source link

[HOLD for payment 2023-05-16] [$2000] Android - Composer input overlaps with attachment separator #16848

Closed kavimuru closed 1 year ago

kavimuru commented 1 year ago

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:

  1. Launch the app -> Login in account
  2. Navigate any chat conversation
  3. Notice composer input (from left side it overlaps)

Expected Result:

Composer input should not be overlaps with attachment separator

Actual Result:

Composer input overlaps with attachment separator

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

Version Number: 1.2.93-4 Reproducible in staging?: y Reproducible in production?: y 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

Expensify/Expensify Issue URL: Issue reported by: @dhairyasenjaliya Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1680359256103449

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0160683cfa6e9f3593
  • Upwork Job ID: 1643312444077060096
  • Last Price Increase: 2023-04-11
MelvinBot commented 1 year ago

Triggered auto assignment to @puneetlath (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

MelvinBot commented 1 year ago

Bug0 Triage Checklist (Main S/O)

puneetlath commented 1 year ago

Wow @dhairyasenjaliya you've got some good eyes.

MelvinBot commented 1 year ago

Job added to Upwork: https://www.upwork.com/jobs/~0160683cfa6e9f3593

MelvinBot commented 1 year ago

Current assignee @puneetlath is eligible for the External assigner, not assigning anyone new.

MelvinBot commented 1 year ago

Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt (External)

MelvinBot commented 1 year ago

Current assignee @puneetlath is eligible for the External assigner, not assigning anyone new.

ahmedGaber93 commented 1 year ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

composer input overlaps with attachment separator in android

What is the root cause of that problem?

the root case is ButtonAttachment borderRightWidth: 1 shown blurry on some screen density.

react native use dp for dimensions and round it to px, so if value 1dp = 2.5 pixels, some devices show it blurely because physical screens have only a fixed number of pixels.

to know how many pixels in 1dp in any device use PixelRatio.get(). in my emulator 1dp = 2.5px so the last .5px show blurely.

and in the app the current style for footer is :

Untitled22


<ButtonAttachment style={{borderRightWidth: 1}} />
// view paddingVertical: 5, and no backgroundColor let border to show blurely
<View>
    // Composer has backgroundColor: themeColors.componentBG
    <Composer />
</View>

What changes do you think we should make in order to solve the problem?

apply the same background color for <Composer /> and <View> wrap it, or clear it from both, or set it in the wraper.

my sugguest is to add backgroundColor: themeColors.componentBG for the wraper <View> here.

and also if we found the ButtonAttachment borderRightWidth: 1 is very thin, we may increase it.

    textInputComposeSpacing: {
        paddingVertical: 5,
        ...flex.flexRow,
        flex: 1,
        backgroundColor: themeColors.componentBG,
    },

What alternative solutions did you explore? (Optional)

Mabroorkhan commented 1 year ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

composer input overlaps with attachment separator in android

What is the root cause of that problem?

The root case may be the fixed width provided in the styling.

What changes do you think we should make in order to solve the problem?

the issue can be solved by not providing fixed width of composer and add a bit margin to it so it could have a safe space from separator and send button

UzairHKhan commented 1 year ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

composer input overlaps with attachment separator in android

What is the root cause of that problem?

The root cause of this problem is styling.

What changes do you think we should make in order to solve the problem?

This issue can be fixed by adding min-width and max-width in the massage dialog div.

s77rt commented 1 year ago

@ahmedGaber93 Thanks for the proposal. I'm not sure this is blur related. If you zoom the following screenshot https://user-images.githubusercontent.com/43996225/229310637-cf6becf7-ebc5-433f-9c6d-d73181242e12.png you will see that the separator is shown correctly on top and bottom parts and only the middle part where the input is rendered it's cut (overlapped).

Screenshot from 2023-04-04 23-56-29

s77rt commented 1 year ago

@Mabroorkhan Thanks for the proposal. Your RCA is not clear, you need to pinpoint the exact root cause and not guess potential causes.

s77rt commented 1 year ago

@UzairHKhan Thanks for the proposal. Your RCA is not clear, can you elaborate? And why this happens on Android only?

UzairHKhan commented 1 year ago

@s77rt some time it only happens in a single platform or in similar screen size phones and works fine in all others the main cause of these types of issues is the width of the boxes if it is taking the width more than it requires it will overlap or can displace another box the possible way to fix this is by adding

  width: -webkit-fit-content;
  width: -moz-fit-content;
  width: fit-content;

This similar issue occurred in my previous work history and was happening only in iOS.

s77rt commented 1 year ago

@UzairHKhan If that's the case then we need to figure out why the input is taking more space than it requires.

Mabroorkhan commented 1 year ago

@s77rt I find the issue is due to flex: 4 1 0% in textArea styling which can be fixed byflex: 1 and margin: 0px 2px

s77rt commented 1 year ago

@Mabroorkhan Thanks for checking. Can you elaborate why this happen only on Android?

UzairHKhan commented 1 year ago

@s77rt Yes I need to dive into the code to get more context on this possibly textarea has some width.

UzairHKhan commented 1 year ago

@s77rt Another possible way to fix the border issue is to make the textarea background transparent it won't affect the UI as div also have same bg color and if the text overlaps the border it will still be visible

ahmedGaber93 commented 1 year ago

@s77rt i think this overlaps not related with width of any View in the component, because i trying simple example in expo snack and the overlaps is exist.

simple example code. ```javascript import * as React from 'react'; import { View } from 'react-native'; export default function App() { return ( ); } ```
result. ![Untitled7](https://user-images.githubusercontent.com/41129870/230071146-e8bb2039-5eb9-493a-8eac-aec1e26d5b6b.png)

you can try snack here but test it in a real device because i think emulators don't have the a real number of pixels. and also result may be diffrent depond on sceen density.

s77rt commented 1 year ago

@UzairHKhan Thanks for the proposed fix but I think we are not looking for solutions at this point. It's important to understand the root cause first.

s77rt commented 1 year ago

@ahmedGaber93 Thanks for checking that. So looks like the bug is in RN. Let's fix it on RN then.

UzairHKhan commented 1 year ago

@s77rt thanks for the feed back

ahmedGaber93 commented 1 year ago

@s77rt I think the bug is in android itself not react native, and setting the wrapper view background is the simple way to fix the UI issue.

s77rt commented 1 year ago

@ahmedGaber93 Were you able to replicate the bug on Android (native code)?

ahmedGaber93 commented 1 year ago

@s77rt no i couldn't replicate the bug on android (native code).

s77rt commented 1 year ago

Not overdue. Still waiting for proposals, so far the bug seems to exist on RN too and we are aiming to fix it on that level (assuming the bug is not originating from native Android SDK).

MelvinBot commented 1 year ago

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

MelvinBot commented 1 year ago

Upwork job price has been updated to $2000

puneetlath commented 1 year ago

Still waiting on more proposals.

MelvinBot commented 1 year ago

@puneetlath @s77rt 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!

s77rt commented 1 year ago

We are not any close to picking a proposal. So far we think the bug is in RN and no proposals submitted for that matter.

UzairHKhan commented 1 year ago

@s77rt as I have proposed before these type of issues is caused by the width alow me solve this bug

s77rt commented 1 year ago

@UzairHKhan Thanks for the follow up. I'm not really convinced this is the reason. Can you please explain why this is happening on Android only?

UzairHKhan commented 1 year ago

@s77rt in the current implementation I noticed that it is using flex: 1 to fill all the available space between but in compilation of RN some time it produces bug in single platform and work fine in other so we have to replace flex: 1 with width and possibly it will fix the bug

narefyev91 commented 1 year ago

Hi I'm Nicolay from Callstack - expert contributor group - will start investigation in this area

s77rt commented 1 year ago

@UzairHKhan

but in compilation of RN some time it produces bug in single platform

We need to fix that bug instead of replacing flex with width.

s77rt commented 1 year ago

@puneetlath Please assign @narefyev91 as per the process.

MelvinBot commented 1 year ago

📣 @narefyev91 You have been assigned to this job by @puneetlath! Please apply to this job in Upwork and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻 Keep in mind: Code of Conduct | Contributing 📖

narefyev91 commented 1 year ago

My updates - indicated an issue - found a possible solution - provide proposal for internal review. Will post here - as soon as i get approval

narefyev91 commented 1 year ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

Composer overlaps border which coming from Add Attachment space

What is the root cause of that problem?

Issue related how 1px is rendering inside different android device. High-density screens have more pixels per inch than low-density ones. As a result, UI elements of the same pixel dimensions appear larger on low-density screens, and smaller on high-density screens.

Screenshot 2023-04-18 at 13 09 44

You can see on the image - how different sizes are shown on android (1px, 1.5px, 1.75px)

Screenshot 2023-04-19 at 11 09 38

What changes do you think we should make in order to solve the problem?

Issue persist in native android as well, blurry pixels are shown and that blurry area is not stopping any component to be drawable outside of it. The main solution will be - moving away from border width and create a new View like Separator, because border should not be used like separator between elements Screenshot 2023-04-18 at 13 18 26

What alternative solutions did you explore? (Optional)

Alternative solution can be some additional calculation to find how much does one pixel size is different on android To do it we can apply simple calculation - Android 1 px = 1(px) + (1px - StylesSheet.hairlineWidth) = 1.63 (on different device this value will be different)

Both solutions will work - but i will suggest to use StylesSheet.hairlineWidth. And maybe also change full borders for composer and attach button to this StylesSheet.hairlineWidth - which will remove dropping pixels

cc @puneetlath @s77rt

s77rt commented 1 year ago

@narefyev91 Thanks for the proposal. So If I get this correctly, you are saying that the Composer is not overlapping with the separator. But it's actually the separator taking more space. Would that be "about" right?

If that's the case why using flex does not take into consideration that extra space taken by the separator and draw the input on that used extra space. Why the input is not shifted so it does not collide with that? Is this by design? And lastly why we are not experiencing the bug on iOS (or are we)?

ahmedGaber93 commented 1 year ago

@s77rt I think StylesSheet.hairlineWidth will be very thin because it equals 1px, but borderRightWidth: 1 equal about 2.5px or 3px in modern devices depend on PixelRatio.get() and also it may not be visible in some devices.

narefyev91 commented 1 year ago

@narefyev91 Thanks for the proposal. So If I get this correctly, you are saying that the Composer is not overlapping with the separator. But it's actually the separator taking more space. Would that be "about" right?

If that's the case why using flex does not take into consideration that extra space taken by the separator and draw the input on that used extra space. Why the input is not shifted so it does not collide with that? Is this by design? And lastly why we are not experiencing the bug on iOS (or are we)?

I will say nothing is overlapping - we have dropping pixels in android - as you see in the screenshots. TextInput taken correct space, and the issue that line is not renders at it should be - not in a full width - that's why TextInput sees that max available space started from rendered line (rendered line it's line with bold color and not thin). Such issue does not exist on IOS because in IOS 1px = 1px - without any pixel drops.

narefyev91 commented 1 year ago

@s77rt I think StylesSheet.hairlineWidth will be very thin because it equals 1px, but borderRightWidth: 1 equal about 2.5px or 3px in modern devices depend on PixelRatio.get() and also it may not be visible in some devices.

We already use StylesSheet.hairlineWidth under the hood - it equal already drawable line - which in bold. If it will be not visible - the whole border will be not visible as well. And 1px is not equal 2.5px or 3px to be honest - it's something around 1.6px - 1.8px in modern phones

ahmedGaber93 commented 1 year ago

@narefyev91 I just try it before in my real device in this snack, and it displayed very thin and not fixed the issue, but may I missed something.

WhatsApp Image 2023-04-20 at 10 19 55 AM

narefyev91 commented 1 year ago

@ahmedGaber93 For sure the line will be thin that's why i told that maybe make sense to apply this width for the whole component. BTW i can't really say why in expo snack it still cutting, i tested on real device and devices in emulators and that was working. In any case i provided 2 possible solutions which i discovered

s77rt commented 1 year ago

@narefyev91

Such issue does not exist on IOS because in IOS 1px = 1px - without any pixel drops.

Did you mean to say that 1dp = a round number of pixels? Where on Android it may not always be the case?

Can you please include screenshots before the change and after the suggested change for both iOS and Android?

narefyev91 commented 1 year ago

@s77rt https://angrytools.com/android/pixelcalc/ Example

Screenshot 2023-04-20 at 15 21 22

Result you can see here: Before:

Screenshot 2023-04-18 at 13 09 44

After:

Screenshot 2023-04-18 at 13 26 24
s77rt commented 1 year ago

@narefyev91 Thanks, can you do the same for iOS please?