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

Add 'Selectable' to a Text component on profile and wallet screens #3616

Closed
denis-sharypin opened this issue Mar 19, 2018 · 17 comments · Fixed by #3957
Closed

Add 'Selectable' to a Text component on profile and wallet screens #3616

denis-sharypin opened this issue Mar 19, 2018 · 17 comments · Fixed by #3957
Labels

Comments

@denis-sharypin
Copy link

User Story

As a user, I want to have an opportunity to copy contact codes and wallet address manually.

Description

Type: Feature

Afer a long press, I would like to have an opportunity to copy contact codes and wallet adress through a native platform instrument for iOS and Android. I believe it could be done by adding props Selectable to a Text component. Docs: https://facebook.github.io/react-native/docs/text.html#selectable

slice
(pic for iOS, on Android it should show its native instrument)

Reproduction

All three codes that have to be copyable could be found here:

  1. User contact code
  • Open Status
  • Tap Profile tab
  • Tap Share my contact code button
  • See Contact code below QR code
  1. Wallet address
  • Open Status
  • Tap Wallet tab
  • Tap Receive transaction button
  • See Wallet address below QR code
  1. Friends contact code
  • Open Status
  • Tap plus button on a Home tab
  • Tap Start new chat
  • Choose contact ex. Jarrad
  • See contact profile and contact code on it

Additional Information

  • Operating System: Android|iOS
@status-open-bounty
Copy link

status-open-bounty commented Mar 20, 2018

Balance: 0.000000 ETH
Tokens: SNT: 1000.00
Contract address: 0xb2fc4379141bc90d5e24b5458730ba10078529f4
Network: Mainnet
Paid to: go1t
Visit https://openbounty.status.im to learn more.

@denis-sharypin
Copy link
Author

@foopang Do you feel like you can fix this? :) I really like your contribution!

@foopang
Copy link
Contributor

foopang commented Mar 20, 2018

@denis-sharypin Thanks! I will keep an eye on it. I feel that it is a very beginner-friendly task, I guess you may wanna let new contributors work on it first.
I will quickly submit a PR after a couple of days if no one else is picking up the task :)

@go1t
Copy link
Contributor

go1t commented Apr 16, 2018

@denis-sharypin I can pick this up but just wondering one thing, wouldn't it be a better experience to make this text copied-on-tapped (and on tap we show a little small popup with the text "Address copied to clipboard" or something)? It's less tap that way and there are no other possible actions intended for this text too.

@denis-sharypin
Copy link
Author

denis-sharypin commented Apr 16, 2018

@go1t I thought about that. But decided to go with this solution bc it's simpler and quicker from implementation pov and such behavior consistent and native to the mobile platforms. Otherwise, I need to create a custom alert, then provide animation for this alert and behavior is not consistent with our patterns (it's a button behavior but we don't have buttons here). Later we will probably add a small button to this address which allows to copy this or even replace it with ens username.

Would be great if you pick up this.

@go1t
Copy link
Contributor

go1t commented Apr 17, 2018

Got it. I think the implementation would be about the same since normal selectable prop can't provide the highlight behavior (as far as I've searched), so we would need to use TouchableHighlight either way.

But yeah I agree that adding a copy button would make the most sense. I also have some experience in UI design so I can give this approach a shot as well if you are not available to design this yet. But I can keep going in the original direction as well if you want.

@denis-sharypin
Copy link
Author

@go1t thanks! I would happy if we go in the original direction right now.

@flexsurfer
Copy link
Member

@go1t @denis-sharypin @jeluard guys lets find some compromise because current solution from @go1t is over complicated for this issue, let's just implement standard os copy paste: long tap, select all, copy, wdyt?

@denis-sharypin
Copy link
Author

Let's add only Selectable to the text and that's it

@go1t
Copy link
Contributor

go1t commented May 3, 2018

@flexsurfer @denis-sharypin @jeluard There are four ways we can go about here:

  1. Add selectable prop only. This gives no highlight in any state.
  2. Add selectable prop along with a no-op on-press or on-long-press. This will give the highlight during the press, but the highlight will go away when the touch is released.
  3. The way I'm doing right now, which would give the highlight behavior as the design provided. The reason it's so complicated is because I have to provide an unhighlighting behavior. But if we can compromise by having the text stay highlighted until it's tapped again, things will be MUCH simpler.
  4. Replace this Text component with a TextInput (with editable = false and multiline = true). This will give a very similar behavior to the OS's. The image below is after a long tap (no styling yet)
    image

If we can go with the 3rd option with compromise, it will be just the matter of adding an atom to the text component and that's it (essentially a couple extra lines). The 4th option is as simple as adding a selectable prop as well, as it's just replacing the Text with TextInput. Probably need to add some styles but that's it. That's why I think either the 3rd option or 4th option is the better way to go here.

What do you think?

@jeluard
Copy link
Contributor

jeluard commented May 4, 2018

@go1t With option 2, can end users still copy the address content?

@go1t
Copy link
Contributor

go1t commented May 4, 2018

Yes. It’s just going to be a little confusing since the highlight would show up briefly then go away when the tooltip is there.

But yeah the behavior of option 1 and 2 is an issue on react-native side that has been there for quite a while :/

@jeluard
Copy link
Contributor

jeluard commented May 4, 2018

Can we disable the tooltip? Essentially we need a simple way to copy the address.
@denis-sharypin WDYT?

@go1t
Copy link
Contributor

go1t commented May 4, 2018

We definitely can. You can see our discussion in the comments above as well.

@denis-sharypin
Copy link
Author

@jeluard I personally don't want to introduce a new pattern right now (tap on something — get visual confirmation that it's copied with transition animations)
Initially, this task was proposed as a quick fix using native platform instruments.
We will def propose some design updates later when we have resources.

@jeluard
Copy link
Contributor

jeluard commented May 4, 2018

@go1t Sorry I guess we will go with your option 4. then, if you can make it look like initial screenshots.

@go1t
Copy link
Contributor

go1t commented May 4, 2018

got it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
9 participants