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

ESTabBarItem loses info #289

Open
hypermats opened this issue Dec 20, 2023 · 2 comments
Open

ESTabBarItem loses info #289

hypermats opened this issue Dec 20, 2023 · 2 comments

Comments

@hypermats
Copy link

With the changes from c454e05#diff-5abb945dc5865b317e84e001627a243f52e8b34f819e833d954e39b062fa38a1

The init function was changed to directly set properties on the contentView. This is problematic because the properties cannot be read. In our app it causes issues as we use the item tag and all items have tag 0 instead of the value we set in the init.

Repro example:

let item = ESTabBarItem(
            BounceTabBarItem(),
            title: "My Tab",
            image: .imageAsset,
            selectedImage: .activeImageAsset,
            tag: 7
        )
 print(item.tag) //prints 0. 7 is expected
 print(item.contentView.tag) // prints 7

The fix should be to go back to setting the contentView properties as a result of calling the setters on ESTabBarItem.

(A different question is how on earth we didn't update this library until recently and discovered this bug from 2020)

@rafaelfrancisco-dev
Copy link
Collaborator

I'll try to look into it. Do you have any PR to fix this by any chance ?

@hypermats
Copy link
Author

hypermats commented Dec 21, 2023

Hi @rafaelfrancisco-dev .

I think the easiest fix is to revert the change to the init function and bring back the
open func setTitle(_ title: String? = nil, image: UIImage? = nil, selectedImage: UIImage? = nil, tag: Int = 0) { function

If the calls are made to set the title, image, selectedImage and tag on self they are propagated to the contentView in didSet.

I don't have a PR ready, but I can probably create one. Not until earliest in the new year though.

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

2 participants