You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(android): resize the render surface when the view size changes - #419
On the new backend, onSurfaceTextureSizeChanged now resizes the RiveSurface through a reflective call to the Kotlin-internal RiveSurface.resize (resolved by name prefix and (int, int) signature, cached), mirroring what upstream RiveView does. It fails open: if the method is missing or throws, it logs a warning and keeps the old size. Fit.Layout resizes are also followed by a zero advance, since the render loop stops advancing a settled or paused state machine and the artboard resize would otherwise never apply. Adds an Issue #418 reproducer page.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The layout advance can run before data binding, freeze responsive animations after resizing, or trigger state-machine transitions on paused views during unrelated prop updates.
This PR addresses issue #418 by updating Android’s experimental backend to resize the render surface when its view changes size, rather than retaining the creation-time dimensions.
Changes:
Adds cached reflective access to the SDK’s internal surface resize method, with warning logs on failure.
Advances Fit.Layout state machines by zero time after artboard resizing to apply layout updates.
Adds a reproducer comparing animated height changes with remounting.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Reloads can apply a stale resize to a new paused state machine, while layout changes can cause indefinite frame advances because SDK settling is not reset.
If a paused Layout view is resized and its fit changes to a non-Layout fit before the next frame, the fit update does not reload the state machine, so this branch leaves the previous layout advance pending. The next frame then advances the paused machine and can consume inputs or fire transitions even though the current fit no longer needs that layout update. Clear the pending advance when leaving Layout.
Re the previously missed issue in Copilot's last review (a pending layout advance surviving a switch to a non-Layout fit): fixed in 9f3ac21. resizeArtboardIfLayout() now clears layoutAdvancePending along with appliedLayout when the fit is not Layout.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On the new backend, onSurfaceTextureSizeChanged now resizes the RiveSurface through a reflective call to the Kotlin-internal RiveSurface.resize (resolved by name prefix and (int, int) signature, cached), mirroring what upstream RiveView does. It fails open: if the method is missing or throws, it logs a warning and keeps the old size. Fit.Layout resizes are also followed by a zero advance, since the render loop stops advancing a settled or paused state machine and the artboard resize would otherwise never apply. Adds an Issue #418 reproducer page.
Fixes #418