@@ -76,6 +76,7 @@ open class ComponentHost(
76
76
attrs : AttributeSet ? ,
77
77
private val unsafeModificationPolicy : UnsafeModificationPolicy ?
78
78
) : Host(context, attrs), DisappearingHost, SupportsPivotTransform {
79
+
79
80
private val mountItems: SparseArrayCompat <MountItem > = SparseArrayCompat ()
80
81
private var scrapMountItemsArray: SparseArrayCompat <MountItem >? = null
81
82
private val viewMountItems = SparseArrayCompat <MountItem >()
@@ -93,6 +94,21 @@ open class ComponentHost(
93
94
private var componentAccessibilityDelegate: ComponentAccessibilityDelegate ? = null
94
95
private var isComponentAccessibilityDelegateSet = false
95
96
private var onLongClickListener: ComponentLongClickListener ? = null
97
+ private var onInterceptTouchEventHandler: EventHandler <InterceptTouchEvent >? = null
98
+ private var pivotXPercent = UNSET
99
+ private var pivotYPercent = UNSET
100
+ /* *
101
+ * Is `true` if and only if any accessible mounted child content has extra A11Y nodes. This is
102
+ * `false` by default, and is set for every mount, unmount, and update call.
103
+ */
104
+ private var implementsVirtualViews = false
105
+ /* *
106
+ * This flag is used to understand if a view property (e.g, click listener) was modified under the
107
+ * context of a Litho operation or not. It is used to detect unsafe modifications and log them.
108
+ *
109
+ * @see {@link LithoViewAttributesExtension}
110
+ */
111
+ private var isSafeViewModificationsEnabled = false
96
112
97
113
/* *
98
114
* Sets a focus change listener on this host.
@@ -212,28 +228,6 @@ open class ComponentHost(
212
228
return drawables
213
229
}
214
230
215
- private var onInterceptTouchEventHandler: EventHandler <InterceptTouchEvent >? = null
216
- private var pivotXPercent = UNSET
217
- private var pivotYPercent = UNSET
218
-
219
- internal interface ExceptionLogMessageProvider {
220
- val logMessage: StringBuilder ?
221
- }
222
-
223
- /* *
224
- * Is `true` if and only if any accessible mounted child content has extra A11Y nodes. This is
225
- * `false` by default, and is set for every mount, unmount, and update call.
226
- */
227
- private var implementsVirtualViews = false
228
-
229
- /* *
230
- * This flag is used to understand if a view property (e.g, click listener) was modified under the
231
- * context of a Litho operation or not. It is used to detect unsafe modifications and log them.
232
- *
233
- * @see {@link LithoViewAttributesExtension}
234
- */
235
- private var isSafeViewModificationsEnabled = false
236
-
237
231
constructor (
238
232
context: Context ,
239
233
unsafeModificationPolicy: UnsafeModificationPolicy ?
@@ -1374,6 +1368,33 @@ open class ComponentHost(
1374
1368
super .setOnFocusChangeListener(l)
1375
1369
}
1376
1370
1371
+ /* * Clean up all fields to avoid being reused with an incorrect state. */
1372
+ fun cleanup () {
1373
+ mountItems.clear()
1374
+ viewMountItems.clear()
1375
+ drawableMountItems.clear()
1376
+ scrapViewMountItemsArray = null
1377
+ scrapMountItemsArray = null
1378
+ scrapDrawableMountItems = null
1379
+ disappearingItems = null
1380
+ contentDescription = null
1381
+ viewTags = null
1382
+ childDrawingOrder = IntArray (0 )
1383
+ isChildDrawingOrderDirty = false
1384
+ inLayout = false
1385
+ hadChildWithDuplicateParentState = false
1386
+ componentAccessibilityDelegate = null
1387
+ isComponentAccessibilityDelegateSet = false
1388
+ onLongClickListener = null
1389
+ onInterceptTouchEventHandler = null
1390
+ pivotXPercent = UNSET
1391
+ pivotYPercent = UNSET
1392
+ implementsVirtualViews = false
1393
+ isSafeViewModificationsEnabled = false
1394
+ componentTouchListener = null
1395
+ touchExpansionDelegate = null
1396
+ }
1397
+
1377
1398
/* *
1378
1399
* This determines what is the actions to take if we detected an invalid modification of a
1379
1400
* [ComponentHost].
0 commit comments