AssistoLab / DropDown

A Material Design drop down for iOS
MIT License
2.44k stars 625 forks source link

Issue with width #210

Closed ivanlares closed 6 years ago

ivanlares commented 6 years ago

The layout is recalculated when the dataSource property is set.

There is an issue with the recalculation. width becomes nil after updating the datasource. Since width becomes nil the width of the dropdown will be set to the size of screen.

// line 643, self.width will be nil here and fittingWidth() will be used
let width = self.width ?? fittingWidth()
...

I could push a fix but I thought it would be best to discuss it here because there might be something that I'm missing.

I noticed that others brought up this issue but I thought it would be best to bring it up here with a bit more detail.

kevin-hirsch commented 6 years ago

Hello @ivanlares,

I cannot reproduce your issue with the demo of the DropDown (version 2.3.12). Can you give a concrete example with code? As far as I see, in the DropDown code, nowhere we do self.width = nil

ivanlares commented 6 years ago

Hi @kevin-hirsch,

Yes, I can create a project and share it here. But before I do that can you try using long strings for the cells. The string has to not fit the cell width.

If you still can't reproduce the error, I will create an example project.

Thank you

ivanlares commented 6 years ago

Sorry, it turns out the width property was never set only the anchorView. Everything works as expected.