Hi all, I've been using the onSizeChanged modifier...
# compose
m
Hi all, I've been using the onSizeChanged modifier to scroll when inside a multiline text field, inside a scrollable column, the cursor goes outside of the visual area. My problem is with the onSizeChanged modifier. I want to verify that is called only when size changes. Looking at its sources there is a check
Copy code
override fun onRemeasured(size: IntSize) {
        if (previousSize != size) {
            onSizeChanged(size)
            previousSize = size
        }
    }
But as the modifier is not remembered, in each recomposition it is recreated and the previousSize is lost. Would it be a good strategy to remember the modifier? Or should I create a remembered state to filter the events (even though the view is not updated with this state)? Thanks,