-
Notifications
You must be signed in to change notification settings - Fork 984
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
[#18458] Token input fixes #18520
[#18458] Token input fixes #18520
Conversation
(str (.toFixed (/ num-value conversion) 2) " " (string/upper-case (or (clj->js token) "")))))) | ||
(str (.toFixed (/ num-value conversion) 2) | ||
" " | ||
(string/upper-case (or (clj->js token) "")))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a function that takes token symbols (:eth
) and return some user friendly string ("ETH"), I thought it already existed, but I couldn't find it.
These conversions are very error-prone, and they've given us some runtime crashes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point @ulisesmac. I have noticed that too in status-mobile. String manipulation in Clojure doesn't follow nil punning like collection functions do. It's a common source of error. I think the error prone aspect also comes from the lack of this knowledge.
I believe it's one of the reasons we have functions like safe-trim
or safe-replace
, because some mobile developers got tired of these nil pointer exceptions and the need to remember to check for nils, so they decided to wrap core cljs string functions. I did this too.
But these wrapping functions in utils.string
are a fragile solution and require this effort to wrap cljs functions and make the code more verbose (longer function names).
To me, all of us should just remember that almost anything can be nil in mobile, therefore, string manipulation should be considered unsafe without some->
or or
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sounds good, but, is there a way to override the string implementation?
TBH, I see this as a ClojureScript error, they are not consistent with their implementation, see string/blank?
:
They are calling gstring/makeSafe
why not call it in other places too?
I think it'd be ok if we just override some cljs.core implementations to add a call to makeSafe
. I know, probably not the best, but IMO they are also not doing the best.
[quo/token-input (assoc @state :value @value)] | ||
[quo/numbered-keyboard | ||
{:container-style {:padding-bottom (safe-area/get-top)} | ||
:left-action :dot | ||
:delete-key? true | ||
:on-press set-value | ||
:on-delete delete}]]))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the numbered-keyboard
to test this input in the preview screen.
It required to modify the preview-container
, now receives a full-screen?
boolean
cc: @ilmotta
Jenkins BuildsClick to see older builds (19)
|
e14f18a
to
548f212
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
548f212
to
9fcde75
Compare
Hey @ulisesmac thank you for PR. This issue related to flickering is fixed. One minor additional issue is found which is addressed by this PR ISSUE 1: [IOS] The asset label is initially too close to 0 valueSteps:
Actual result:input.mp4Expected result:
Device:iPhone 11 Pro max, IOS 16 |
85% of end-end tests have passed
Failed tests (4)Click to expandClass TestDeepLinksOneDevice:
Class TestCommunityOneDeviceMerged:
Class TestCommunityMultipleDeviceMerged:
Expected to fail tests (3)Click to expandClass TestCommunityOneDeviceMerged:
Class TestCommunityMultipleDeviceMergedTwo:
Class TestGroupChatMultipleDeviceMergedNewUI:
Passed tests (41)Click to expandClass TestOneToOneChatMultipleSharedDevicesNewUi:
Class TestActivityMultipleDevicePRTwo:
Class TestActivityCenterContactRequestMultipleDevicePR:
Class TestOneToOneChatMultipleSharedDevicesNewUiTwo:
Class TestCommunityMultipleDeviceMerged:
Class TestCommunityOneDeviceMerged:
Class TestGroupChatMultipleDeviceMergedNewUI:
Class TestActivityMultipleDevicePR:
Class TestCommunityMultipleDeviceMergedTwo:
|
Hey @VolodLytvynenko |
@ulisesmac, could you please extend the PR description and describe what approach you used to reduce flickering? I think that could be beneficial for the future. For example when someone will be solving similar problem and looking for related PRs) |
9fcde75
to
5561634
Compare
@VolodLytvynenko Here's the iOS version working: Screen.Recording.2024-01-19.at.9.55.57.p.m.movAnd Android: Screencast.from.2024-01-19.22-00-07.webm |
@vkjr The reason the input was flickering wasn't due to a state update or state propagation issue (like reagent re-renders). (cc: @Rende11 you may remember this). The issue was that the input's width was growing as the user typed, it seems this is something we should always avoid and instead set a fixed input width. But we can't set a fixed width because that token name ("ETH", "RARE", etc) should be right after the amount, and a fixed width will move the token name to the end. (check Omar's attempt, he showed some pictures). The first solution I tried was making that token name track the input's layout dimensions, The problem with this approach is that we have a very noticeable 1 frame delay, and lead to problems to render the first frame when there's no input dimensions. So I solved it by creating a "phantom" copy of the input on top of the actual input, opacity zero, no pointer events and not being able to be edited. It makes the exact spacing for "RARE"/"ETH"/... to be correctly placed. In the code the component is the function called |
7ad8062
to
2d52f9d
Compare
65% of end-end tests have passed
Failed tests (14)Click to expandClass TestOneToOneChatMultipleSharedDevicesNewUi:
Class TestDeepLinksOneDevice:
Class TestGroupChatMultipleDeviceMergedNewUI:
Class TestCommunityMultipleDeviceMerged:
Class TestActivityMultipleDevicePRTwo:
Expected to fail tests (3)Click to expandClass TestCommunityMultipleDeviceMergedTwo:
Class TestCommunityOneDeviceMerged:
Class TestGroupChatMultipleDeviceMergedNewUI:
Passed tests (31)Click to expandClass TestActivityMultipleDevicePR:
Class TestOneToOneChatMultipleSharedDevicesNewUi:
Class TestCommunityMultipleDeviceMergedTwo:
Class TestOneToOneChatMultipleSharedDevicesNewUiTwo:
Class TestCommunityOneDeviceMerged:
Class TestActivityCenterContactRequestMultipleDevicePR:
Class TestGroupChatMultipleDeviceMergedNewUI:
Class TestCommunityMultipleDeviceMerged:
|
hi @ulisesmac thank you for PR. No issue from my side. PR ready to be merged |
46% of end-end tests have passed
Failed tests (22)Click to expandClass TestGroupChatMultipleDeviceMergedNewUI:
Class TestCommunityMultipleDeviceMerged:
Class TestOneToOneChatMultipleSharedDevicesNewUiTwo:
Class TestDeepLinksOneDevice:
Class TestOneToOneChatMultipleSharedDevicesNewUi:
Expected to fail tests (4)Click to expandClass TestCommunityOneDeviceMerged:
Class TestGroupChatMultipleDeviceMergedNewUI:
Class TestCommunityMultipleDeviceMergedTwo:
Class TestOneToOneChatMultipleSharedDevicesNewUiTwo:
Passed tests (22)Click to expandClass TestActivityMultipleDevicePRTwo:
Class TestActivityCenterContactRequestMultipleDevicePR:
Class TestActivityMultipleDevicePR:
Class TestCommunityOneDeviceMerged:
Class TestGroupChatMultipleDeviceMergedNewUI:
Class TestCommunityMultipleDeviceMergedTwo:
Class TestOneToOneChatMultipleSharedDevicesNewUiTwo:
Class TestOneToOneChatMultipleSharedDevicesNewUi:
|
2d52f9d
to
9045ef2
Compare
9045ef2
to
090d880
Compare
fixes #18458
Summary
This PR solves the flickering we were having in the token input component:
before (taken by @VolodLytvynenko):
jump.mp4
now:
Screencast.from.2024-01-16.00-12-59.webm
Note: I'm taking multiple issues to improve the token input component, I was thinking about solving all of them in a single PR, but it's a lot of work/refactoring, I decided that it was better to open smaller PRs.
Review notes
I also modified the preview screen, so that our custom keyboard is used to test this input.
Platforms
Steps to test
Important this issue is only addressing the flickering, not the rest of the issues, they will be addressed separately.
Also notice that
is not caused or addressed by this PR.
status: ready