whitesmith/WSTagsField

Miscalculation of `isScrollEnabled`

lawmaestro opened this issue · 3 comments

Which version of the WSTagsField are you using?

5.2

On which platform does the issue happen?

iOS13

Are you using Carthage?

No

Are you using Cocoapods?

1.8.4

Which version of Xcode are you using?

11.4

What did you do?

Describe the problem.

Noticed in my usage of `WSTagsField` that tags were scrollable when I wasn't expecting them to be. I'm using the event `onDidChangeHeightTo` to dynamically update the height constraint on the wrapping view so it grows to encompass the size required when new tags are added/removed.

What did you expect to happen?

Given the wrapping view grows/shrinks accordingly the tags shouldn't ever be scrollable.

What happened instead?

The tags are scrollable

Poposed solution

Line 741 in WSTagsField.swift appears to be the issue:
self.isScrollEnabled = contentRect.height + contentInset.top + contentInset.bottom >= newIntrinsicContentHeight

Rather than >= this should surely just be >. I've tried with this change and sure enough it appears to fix the issue. Happy to raise a PR with this tweaked. Thoughts?

@lawmaestro Could please do a PR? I appreciate your work. Thank you.

@ricardopereira Sure. PR raised: #137

Merged, thanks!