-
Notifications
You must be signed in to change notification settings - Fork 985
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
Allow address copying in the QR code viewer, wallet & contact screens #3957
Allow address copying in the QR code viewer, wallet & contact screens #3957
Conversation
Hey @go1t, thanks for making your first pull request in status-react! ❤️ |
55911b0
to
2a02b4f
Compare
@go1t Thanks for joining! Would love to learn more about your journey into Status Open bounty, mind sending me a DM when you get a chance on https://chat.status.im ! I'm Hutch on there |
@pablanopete DM'ed! |
thanks for contribution @go1t , have you seen this #3646 (comment) ? |
@flexsurfer yep I have seen that. Unfortunately component cant do the highlight that would persist after long tap is released, so I had to use a bit of a state here to get that highlight to show up. But yeah it should be working |
|
||
(defn highlight-provider [render-fn] | ||
(let [highlighting (reagent/atom false)] | ||
[react/touchable-without-feedback {:on-press #(reset! highlighting false)} |
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.
Extra space?
(defn highlight-provider [render-fn] | ||
(let [highlighting (reagent/atom false)] | ||
[react/touchable-without-feedback {:on-press #(reset! highlighting false)} | ||
[react/view {:flex 1} |
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 have components/flex
for this.
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.
I can't find it :( I only saw this code being used elsewhere
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.
@@ -55,3 +56,5 @@ | |||
{:padding-top 26 | |||
:background-color colors/white}) | |||
|
|||
(def address-highlight | |||
{:background-color styles/color-light-blue-transparent}) |
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.
Please use colors
ns.
:accessibility-label accessibility-label | ||
:selectable true | ||
:suppress-highlighting true | ||
:on-long-press #(reset! highlight-address true)} |
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.
highlight-address?
maybe?
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.
sorry why do we need the question mark here?
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.
To better reflect that this is a boolean value?
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.
oh I wasn't aware that it's a naming convention. Fixed
:text-align :center | ||
:font-size 15 | ||
:letter-spacing -0.2 | ||
:line-height 20}) | ||
|
||
(def done-button-text | ||
{:color colors/white}) | ||
|
||
(def address-highlight | ||
{:background-color styles/color-light-blue-transparent}) |
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.
Please use colors
ns
@@ -68,8 +69,9 @@ | |||
[react/view styles/qr-code-viewer | |||
[status-bar/status-bar {:type :modal}] | |||
[qr-viewer-toolbar (:name contact) value] | |||
[qr-code-viewer/qr-code-viewer {:style styles/qr-code} | |||
value (i18n/label :t/qr-code-public-key-hint) (str value)]])) | |||
(highlight/highlight-provider (fn [highlight-address] |
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.
Why not regular reagent component usage?
(let [highlighting (reagent/atom false)] | ||
[react/touchable-without-feedback {:on-press #(reset! highlighting false)} | ||
[react/view {:flex 1} | ||
(render-fn highlighting)]])) |
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.
Can't this be a regular reagent component composition?
@go1t Thanks for the contribution! I added some comments. |
@jeluard Thanks for the review! Before the latest commit it was using plain reagent components (see here: https://github.com/status-im/status-react/pull/3957/files/f83415f0e698ec804d5ec4a909dd74b35e09b136). As you can see I had to copy and paste the atom and touchable-highlight with unhighlighting behavior everywhere I need to use it. I thought it would be nicer to abstract that part out and just expose the highlighting state to the outside so that it's easier to add / remove. Does this justify its existence a little bit, or do you prefer the plain version more? |
@go1t You can create your function that encapsulate those, then use it with reagent square bracket syntax. As a rule of thumb most components should follow this convention. Probably you can provide the highlight fn part of the props map. Does that make sense? |
Ah I see what you meant now. I wasn't aware that what I was doing was akin to defining a function that returns a component instead of defining a react component (sorry a little new to clojurescript and re-agent hehe). But yeah you are right my intention was to define a component that has render as a prop. I will update the pull request soon! |
d256818
to
e5d5c94
Compare
@jeluard I just force-pushed the same branch so I don't have to open a new pull request. Hopefully that works |
@go1t It does! Thanks for the extra effort. |
No problem! Thanks for the review in the previous iteration. |
75% of end-end tests have passed
Failed tests (4)Click to expand
Passed tests (12)Click to expand
|
@go1t would you mind please look at the issues outlined:
|
@asemiankevich Absolutely. Sorry I forgot to test on android before. The 2nd issue is somewhat a behavior that we can't do much about unless we want to complicate things more (e.g. introducing an atom). I think tapping other elements such as the qr code image would make it disappear. I will see what I can do though. |
Ugh seems like a multiline TextInput being non-selectable on android is another issue on react-native... :( Since selectable works fine on android but buggy on iOS, while TextInput works fine on iOS but buggy on android, I think it might make sense to just use both of them (with https://facebook.github.io/react-native/docs/platform-specific-code.html). What do you think? @jeluard @flexsurfer
|
@go1t Please go ahead! |
a18b849
to
0f9b717
Compare
@go1t it works fine. One small issue that still persist is the following - only on iOS, when qr code is copied the text is still selected: Can we deselect it? If not, let's merge. |
@go1t could you please squash commits, thanks |
@flexsurfer will do! @lukaszfryc there is no trivial way to deselect it as it's an upstream issue unfortunately and we would like to keep it simple so yeah I think we probably should go forward with this for now. |
0f9b717
to
e82e57e
Compare
Signed-off-by: Andrey Shovkoplyas <[email protected]>
e82e57e
to
49dbfe1
Compare
fixes #3616
Summary:
Allows long tap to copy the wallet address from the qr code viewer screen. This is done by adding
selectable
to the text.The highlight box will also show when the long press is performed, and go away when anywhere else is touched
status: ready