Skip to content

[ASDisplayNode] setNeedsLayout doesn't work only Texture 2.7 #977

@GeekTree0101

Description

@GeekTree0101

similar issue
In my case, I forced setNeedLayout after textNode attributedText value with a few sec delay

     Observable.just(NSAttributedString(string: "test")
            .delay(2.0, scheduler: MainScheduler.asyncInstance) // a few sec delay
            .subscribe(onNext: { [weak self] value in 
                    self?.textNode.attributedText = value // update attributedText (data)
                    self?.setNeedsLayout()  // call setNeedsLayout
             }
            .disposed(by: disposeBag)

Texture 2.6 is correctly work like this picture
v2 6

But, I got unwanted UI in Texture 2.7 like this picture
v2 7

I check frame value from debugger
2018-06-19 6 38 55
I found that UITableViewCellContentView frame isn't equal with ASCellNode frame

So, just update ASCellNode frame with UITableViewCellContentView frame on didEnterVisibleState like this code

    override func didEnterVisibleState() {
        super.didEnterVisibleState()
        self.frame = self.view.superview?.frame ?? self.frame
    }

In this case, it's correctly work like this pic
2018-06-20 12 49 40

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions