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

Fix issues #2009 #2010

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix issues #2009 #2010

wants to merge 1 commit into from

Conversation

CainLuo
Copy link

@CainLuo CainLuo commented Jun 20, 2021

[bug] ASCellNode has no background color in iOS 13

[bug] ASCellNode has no background color in iOS 13
@CLAassistant
Copy link

CLAassistant commented Jun 20, 2021

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


CainLuo seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@CainLuo
Copy link
Author

CainLuo commented Jun 24, 2021

Regarding the above issue, I found the specific problem, in the - (void)setElement:(ASCollectionElement *)element method of the ASTableView.mm file, the backgroundColor of node is used to set the _ ASTableViewCell's backgroundColor, I think this is incorrect, because node's backgroundColor should not be used to set as _ASTableViewCell's backgroundColor, but to open a separate property value of color to set separately. The temporary solution is to comment out self.backgroundColor = node.backgroundColor; and hope that it can be solved in subsequent versions of Texture. #2010

Before: No cellBackgroundColor property

After

ASCellNode.h add cellBackgroundColor

/* @abstract The inset of the cell background color
 * ASTableView uses these properties when configuring UITableViewCells that host ASCellNodes.
 */
@property UIColor *cellBackgroundColor;

ASTableNode.mm update setElement method:

- (void)setElement:(ASCollectionElement *)element
{
  _element = element;
  ASCellNode *node = element.node;
  
  if (node) {
    if (node.cellBackgroundColor != nil) {
        self.backgroundColor = node.cellBackgroundColor;
    }
    if (node.selectedBackgroundView != nil) {
        self.selectedBackgroundView = node.selectedBackgroundView;
    }
#if TARGET_OS_IOS
    self.separatorInset = node.separatorInset;
#endif
    self.selectionStyle = node.selectionStyle;
    self.focusStyle = node.focusStyle;
    self.accessoryType = node.accessoryType;

    if (node.tintColor != nil) {
        self.tintColor = node.tintColor;
    }

    // the following ensures that we clip the entire cell to it's bounds if node.clipsToBounds is set (the default)
    // This is actually a workaround for a bug we are seeing in some rare cases (selected background view
    // overlaps other cells if size of ASCellNode has changed.)
    self.clipsToBounds = node.clipsToBounds;
  }
  
  [node __setSelectedFromUIKit:self.selected];
  [node __setHighlightedFromUIKit:self.highlighted];
}

@CainLuo
Copy link
Author

CainLuo commented Jun 24, 2021

@Adlai-Holler Hello, I fixed a problem, but I can't seem to merge it, how can I fix it?

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

Successfully merging this pull request may close these issues.

None yet

2 participants