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

Feature request: Separator #91

Open
gjvpaet opened this issue Mar 1, 2018 · 4 comments
Open

Feature request: Separator #91

gjvpaet opened this issue Mar 1, 2018 · 4 comments

Comments

@gjvpaet
Copy link

gjvpaet commented Mar 1, 2018

It would be great if we can add an item separator in the picker dropdown items.

@tayyabaAslam
Copy link

tayyabaAslam commented Apr 16, 2019

@gjvpaet you can add separator using propsExtractor like this:

propsExtractor={({value, index}) => { return (value === 'lastElement' ? {style: {}} : {style: {borderBottomColor: '#D1D1D1', borderBottomWidth: 1, paddingTop: 5}}) }}

We will not add separator for last item.

@IkaroAlef
Copy link

IkaroAlef commented Feb 17, 2020

@gjvpaet you can add separator using propsExtractor like this:

propsExtractor={({value, index}) => { return (value === 'lastElement' ? {style: {}} : {style: {borderBottomColor: '#D1D1D1', borderBottomWidth: 1, paddingTop: 5}}) }}

We will not add separator for last item.

it doesn't work for me. Separator keeps showing in the last item.

Edit: it worked, I forgot to set the value of the last element.

@tayyabaAslam
Copy link

Great!

@IkaroAlef
Copy link

IkaroAlef commented Mar 10, 2020

Great!

but the "index" is returning undefine. It's working with "value" but I need to update this propsExtractor everytime I update de dropdown data or use with another dropdown (with different data, obviously.

Do you have any tip?
.
.
.
.
Edit:

@gjvpaet you can add separator using propsExtractor like this:

propsExtractor={({value, index}) => { return (value === 'lastElement' ? {style: {}} : {style: {borderBottomColor: '#D1D1D1', borderBottomWidth: 1, paddingTop: 5}}) }}

We will not add separator for last item.

here's the solution: just remove {} inside de params and the index is returning correctly
propsExtractor={(item, index) => { return index === <YOUR_DATA>.length - 1 ? { style: {}, // style for the last element } : { style: {}, //style for the others elements }; }}

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