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

Placeholder #29

Open
nfq opened this issue Jun 29, 2017 · 14 comments
Open

Placeholder #29

nfq opened this issue Jun 29, 2017 · 14 comments

Comments

@nfq
Copy link

nfq commented Jun 29, 2017

Hi, is it possible to have a separate placeholder text color and change that to the prop 'textStyle' after?

@gs-akhan
Copy link
Owner

Hi, I did not understand the question.

@nfq
Copy link
Author

nfq commented Jun 29, 2017

So, on normal form elements you can usually set a default placeholder text and a colour, usually a light grey. When the user enters a value, the placeholder is gone and the entered text is a solid black or whatever input colour you choose.

@gs-akhan
Copy link
Owner

gs-akhan commented Jun 30, 2017 via email

@kaiyes
Copy link

kaiyes commented Aug 20, 2017

has this been fixed ? Could this be the reason why upon selecting a value the defaultText doesn't change ?

@Kazi-Yako
Copy link

How Do I access defaultText after onSelect please? you are returning value but I want to be able to get the text as well.
let optionItems = this.state.locations.map((s, i) => {
return ({s.title})
});
I got the value and I need the text which is s.title to be populated as defautText.
Thank you!

@gs-akhan
Copy link
Owner

Since you have selected value.. You can filter it from your data that you have and get value.. The component currently does not give text out, but I can do this as an enhancement.

@gs-akhan
Copy link
Owner

@Kazi-Yako The onselect is invoked with two arguments. Can you check if second argument is a label ?

@Kazi-Yako
Copy link

Yes in your function here:
onSelect(label, value) {
this.props.onSelect(value);
this.setState({
modalVisible: false,
defaultText: label
});
}
the first one is the label which I need and the second one is the value.

But in mine when I call:
<Select
onSelect = {this.onSelect.bind(this)}
defaultText = {this.state.defaultMsg}
style = {{borderWidth : 1, borderColor : "green"}}
textStyle = {{}}
backdropStyle = {{backgroundColor : "#d3d5d6"}}
optionListStyle = {{backgroundColor : "#F5FCFF"}}>
{optionItems}

and use:
onSelect(label, data) {
this.setState({selectedLocationId : data, defaultMsg: label});
}

label has the value and data is undefined.
I am trying to capture both.

Thank you for the prompted response.

@gs-akhan
Copy link
Owner

gs-akhan commented Sep 26, 2017 via email

@gs-akhan
Copy link
Owner

You see. the this.props.onSelect is invoked with only value. Can you make a PR on this ?
Thanks

@gs-akhan
Copy link
Owner

@Kazi-Yako
invoke it with both value and label and make a PR. also update the docs.
Here : https://github.com/gs-akhan/react-native-chooser/blob/master/lib/select.js#L59

@Kazi-Yako
Copy link

Done! I am not sure if I did it the right but please let me know when you update the library so my team can pull that over.

@gs-akhan
Copy link
Owner

@Kazi-Yako published on NPM ..
npm install react-native-chooser@1.6.2 --save
should do it for you.

Thanks

@solshuffle
Copy link

Going back to the original question.
Is it possible now to style the placeholder different to the selected option?
Thank you in advance :)

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

5 participants