From 9ad835302ba4b93657fcf6ab5f0e3a570412ea59 Mon Sep 17 00:00:00 2001 From: Dylan Nagler Date: Tue, 31 Oct 2023 15:36:55 -0400 Subject: [PATCH] Two bits of cleanup In UIViewLazyList (#1659) - Removing call to set contentView.translatesAutoresizingMaskIntoConstraints to false, because this is not supported by iOS, and yields the following warning: "Changing the translatesAutoresizingMaskIntoConstraints property of the contentView of a UITableViewCell is not supported and will result in undefined behavior, as this property is managed by the owning UITableViewCell" - Adding call to removeAllSubviews within prepareForReuse --- .../kotlin/app/cash/redwood/lazylayout/uiview/UIViewLazyList.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redwood-lazylayout-uiview/src/commonMain/kotlin/app/cash/redwood/lazylayout/uiview/UIViewLazyList.kt b/redwood-lazylayout-uiview/src/commonMain/kotlin/app/cash/redwood/lazylayout/uiview/UIViewLazyList.kt index 4ce0f6e061..6233bdfc9b 100644 --- a/redwood-lazylayout-uiview/src/commonMain/kotlin/app/cash/redwood/lazylayout/uiview/UIViewLazyList.kt +++ b/redwood-lazylayout-uiview/src/commonMain/kotlin/app/cash/redwood/lazylayout/uiview/UIViewLazyList.kt @@ -239,7 +239,6 @@ internal class LazyListContainerCell( removeAllSubviews() if (value != null) { contentView.addSubview(value.value) - contentView.translatesAutoresizingMaskIntoConstraints = false } setNeedsLayout() } @@ -273,6 +272,7 @@ internal class LazyListContainerCell( override fun prepareForReuse() { super.prepareForReuse() + removeAllSubviews() binding?.unbind() binding = null }