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

onSkinChange prop #165

Closed
akxcv opened this issue Feb 18, 2018 · 7 comments
Closed

onSkinChange prop #165

akxcv opened this issue Feb 18, 2018 · 7 comments

Comments

@akxcv
Copy link

akxcv commented Feb 18, 2018

Hi! Thank you for the great library!

I've encountered a use case where I need to do something whenever a skin tone is selected in the picker. I propose we add an onSkinChange prop to Picker's API. I can submit a pull request if you think this is a good idea.

EDIT:

Also, because of this line, it's impossible to change the picker's skin tone from the outside of if the skin tone is already set in the store. That's also a use case I'm personally interested in. Is there any reason why we have to check if skin tone is present in the store?

@EtienneLem
Copy link
Member

I propose we add an onSkinChange prop to Picker's API. I can submit a pull request if you think this is a good idea.

Sure! 👍

Is there any reason why we have to check if skin tone is present in the store?

Mmm, I guess my initial thought was to not allow skin change from the props when the user decides they want a certain skin tone. Props would be a way to set the default, but how can we tell if we should use the prop vs. the user’s choice? Perhaps a boolean forceSkin props could be introduced? What do you think?

@akxcv
Copy link
Author

akxcv commented Feb 22, 2018

Hmm. Is there a use case where you'd change the skinTone prop thinking that would change the default? 🤔
In my opinion, the skin tone from the store should merely be a default for the skinTone prop (in case it wasn't explicitly provided).

// '6' in store
<Picker {...props} /> // => skinTone is 6
<Picker {...props} skinTone={2} /> // => skinTone is 2
// nothing in store
<Picker {...props} /> // => skinTone is 1
<Picker {...props} skinTone={2} /> // => skinTone is 2

Does this make sense?

@EtienneLem
Copy link
Member

But if props is more important than store, then as soon as you pass a skin tone the user’s choice would be ignored. If that was to be the case, should passing skin remove the skin chooser completely? Otherwise the developer would have to pass the skin as the skin, but then I’m not sure that’s better than the current behavior and result would be the same.

@EtienneLem
Copy link
Member

I guess the best thing would be to handle all the use cases:

  • skin: Overwrites user’s choice. It’s up to the developer to handle skin in store if they want to.
  • defaultSkin: Only used when no skin in store.
  • showSkinTones: Boolean to toggle on/off the skin picker.

Would give max control to devs. Sounds like something that would work for you?

@akxcv
Copy link
Author

akxcv commented Feb 23, 2018

Sure, sounds good. Although I suppose, that would introduce a breaking change into the API, is that okay?

@akxcv
Copy link
Author

akxcv commented Mar 2, 2018

Cool, thank you!

@tarzak
Copy link

tarzak commented Jan 17, 2024

I see at some point in time, we had onSkinChange callback. But we don't anymore. We need to store skin tone for different users in our users' settings. Is it possible to return this prop? @EtienneLem

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

No branches or pull requests

3 participants