Skip to content
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

workaround(android placeholders): make a workaround to not have android placeholders be cut-off #4833

Merged
merged 7 commits into from
May 24, 2021

Conversation

pvinis
Copy link
Contributor

@pvinis pvinis commented May 21, 2021

The type of this PR is: workaround

This PR resolves CX-1483

Description

I have added some docs in the code, but the main idea here is that ios handles long placeholders with ellipsis, and android doesn't, they are just cut-off. So instead, we now have a workaround where we can give an array of placeholders, from longest to shortest, and it will measure and use the longest string that fits in the TextInput, in our case the search field.

Here's how it looks:
https://user-images.githubusercontent.com/100233/119164903-cfb99f80-ba54-11eb-8c74-e60697573548.mov

First thing you will notice is the texts in red borders. These are the placeholders, longest to shortest. They are rendered and measured and their widths are underneath them.

Now notice on top, in the search field, the placeholder is the longest string because it fits. When the cancel button slides in, the placeholder becomes the second longest, without galleries.

In smaller devices a shorter one will be used directly, and the smallest we can show is just Search.

PR Checklist (tick all before merging)

  • I have included screenshots or videos to illustrate my changes, or I have not changed anything that impacts the UI.
  • I have tested my changes on iOS and Android.
  • I have added tests for my changes, or my changes don't require testing, or I have included a link to a separate Jira ticket covering the tests.
  • I have added a feature flag, or my changes don't require a feature flag. (How do I add one?)
  • I have documented any follow-up work that this PR will require, or it does not require any.
  • I have added an app state migration, or my changes do not require one. (What are migrations?)
  • I have added a CHANGELOG.yml entry or my changes do not require one.

Copy link
Contributor

@brainbicycle brainbicycle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice workaround! I'll give other people a chance to check it out but looks good to me.

@pvinis
Copy link
Contributor Author

pvinis commented May 24, 2021

I should also note that I spoke with Jonathan and showed it to him, and he approved it, and we can remove it once the PR on rn that fixes that is merged.

# Conflicts:
#	src/lib/Components/Input/Input.tsx
@MounirDhahri
Copy link
Member

Nice solution 🙌 this looks good to me, the only comment I had is about adding a changelog entry maybe, otherwise please feel free to merge

@pvinis
Copy link
Contributor Author

pvinis commented May 24, 2021

Now that the new changelog flow is almost here, I'm kinda tired of the old conflicts. I don't want to spend another second fixing changelog conflicts anymore. I much prefer spending some time helping with the new flow if there's anything needed there.

@brainbicycle brainbicycle added the Squash On Green A label to indicate that Peril should squash-merge this PR when all statuses are green label May 24, 2021
@artsy-peril artsy-peril bot merged commit 69e0b5e into master May 24, 2021
@artsy-peril artsy-peril bot deleted the search-placeholder-android branch May 24, 2021 17:46
@MrSltun MrSltun mentioned this pull request Apr 29, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Jira Synced Squash On Green A label to indicate that Peril should squash-merge this PR when all statuses are green
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants