Skip to content

Padding and alignment on compose field for iOS looks misaligned #1500

Closed

Description

@kadiealexander

Platform - version:
iOS 14
iPhone X

Action Performed (reproducible steps):
Open expensify.cash and login. Observe the Compose box. The text inside of the compose box is misaligned. It is not vertically centered.

Expected Result:
I would expect the text to be vertically aligned within the compose area. See below, it is sitting too low in the box.

Actual Result:
image

Notes/Photos/Videos:

Logs - JS/Android/iOS (if applicable):

Activity

  1. kadiealexander commented on Feb 18, 2021

    @kadiealexander
    ContributorAuthor
  2. aliabbasmalik8 commented on Feb 18, 2021

    @aliabbasmalik8
    Contributor

    Please remove alignSelf: 'center', from this style object textInputCompose that located in src/styles/styles.js it's on line # 661 in the below

    Screen Shot 2021-02-18 at 11 54 00 PM

    Latest screen after fix this
    image

  3. shawnborton commented on Feb 19, 2021

    @shawnborton
    Contributor

    @aliabbasmalik8 can you confirm that your proposed change will not break other platforms as well?

  4. aliabbasmalik8 commented on Feb 19, 2021

    @aliabbasmalik8
    Contributor

    Here is an updated solution that tested on web app as well as mobile devices
    We need to import
    import { Platform } from 'react-native'; at the top of src/styles/styles
    and add this code in textInputCompose style Object
    ...Platform.select({ web: { alignSelf: 'center', } }),
    Actually, we need this property only for web alignSelf: 'center'

    https://reactnative.dev/docs/platform-specific-code

    image

  5. shawnborton commented on Feb 19, 2021

    @shawnborton
    Contributor

    @marcaaron curious for your thoughts on the above... I know we try to avoid platform-specific instances like the above proposal, but I'm not sure how else to solve for this one.

  6. marcaaron commented on Feb 19, 2021

    @marcaaron
    Contributor

    Yes, well there is nothing wrong with having a platform specific implementation. It just needs to follow the guidance here as we have decided to avoid using Platform in the code. Instead we'd add something like this:

    .
    └── textInputAlignSelf/
        ├── index.js
        └── index.native.js
    
  7. aliabbasmalik8 commented on Feb 19, 2021

    @aliabbasmalik8
    Contributor

    Got it. so updated solution according to guidance is here
    Added textInputAlignSelf utility like this

    image

    and import at top
    import textInputAlignSelf from './utilities/textInputAlignSelf';
    and updated textInputCompose style object like this

    image

  8. marcaaron commented on Feb 19, 2021

    @marcaaron
    Contributor

    yep, you got it

  9. aliabbasmalik8 commented on Feb 23, 2021

    @aliabbasmalik8
    Contributor

    @kadiealexander can I do this Ticket?

  10. kadiealexander commented on Mar 2, 2021

    @kadiealexander
    ContributorAuthor

    @aliabbasmalik8 Hey! Thanks for sharing this fix. My colleague wanted to confirm if this will also fix the issue for Android, as we discovered the issue exists here too. Thanks in advance!

  11. aliabbasmalik8 commented on Mar 5, 2021

    @aliabbasmalik8
    Contributor

    @kadiealexander I tested it on all platforms and it's working well and also attached a screenshot for the android platform.
    Please let me know the device name if you still face this issue
    Thanks

    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions