TextureGroup/Texture

[ASDisplayNode] setNeedsLayout doesn't work only Texture 2.7

GeekTree0101 opened this issue · 5 comments

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

I have faced such issue when I was changing collection node layout when rotating device. what I did was I write a custom collection flow layout using ASCollectionLayoutDelegate to calculate node frame

When Rx subscribe logic moves from initialization to didLoad method. I no longer faced this problem.
When using RxSwift / RxCocoa, it is safe to subscribe from the didLoad method.

2018-07-27 9 15 04

It is still a problem. I don't know that why constraintedSize min and max are equal & doesn't change after setNeedsLayout.

close!