Repository navigation
Conversation
EQuimper
force-pushed
the
fix/ios-legacy-drawable-ancestor-transform
branch
from
September 24, 2026 16:49
6ad0653 to
09591cf
Compare
MTKView's automatic drawable resize derives per-axis scale factors once, on its first window attach when the screen's nativeScale differs from the view's contentScaleFactor (Display Zoom, iPhone mini and Plus). It computes them by converting the screen bounds through every ancestor transform, so a rotated ancestor at that moment leaves a non-uniform drawable for the view's lifetime and Fit.Contain squashes the artboard; a zero-scale ancestor yields an invalid drawable (blank since rive-ios 6.2.1, see rive-app/rive-ios#343). Turn autoResizeDrawable off on the legacy RiveView and set drawableSize from its bounds times the window screen's nativeScale on layout and on window changes.
mfazekas
force-pushed
the
fix/ios-legacy-drawable-ancestor-transform
branch
from
September 27, 2026 07:03
09591cf to
df552ed
Compare
3 tasks done
Collaborator
|
Thanks much for the fix and the root-cause analysis! We've reported this upstream (rive-app/rive-ios#463), and rive-ios has fixed it in the SDK itself for both runtimes (rive-app/rive-ios@21e702d), expected in the next rive-ios release. Once we bump to that release this change won't be needed, so we'll close this PR then. |
Author
|
@mfazekas perfect ! :) thanks |
Collaborator
|
Closing in favor of #401: rive-ios 6.28.0 fixes this in the SDK for both the legacy and the new runtime, and I verified it on an iPhone 13 mini simulator with no wrapper changes (rotated and scale(0) views now get correctly sized drawables). Thanks again for the report, the root-cause analysis and the fix! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
On devices where
nativeScale != scale, legacyRiveViews render squashed when they are mounted under a rotated parent, and blank under a parent scaled to zero. That means Display Zoom, and iPhone mini and Plus models. This PR turns offMTKView's automatic drawable sizing on the legacy view and sizes the drawable from the view's own bounds ×window.screen.nativeScale.Closes #393.
Problem
MTKViewcomputes its drawable size with per-axis factors. It derives them once, on the first window attach, by converting the screen bounds through every ancestor transform. A rotated ancestor at that moment leaves a non-uniform drawable for the view's whole lifetime, andFit.Containthen squashes the artboard. A zero-scale ancestor gives an invalid drawable, which is the crash in rive-app/rive-ios#343 and a blank view since 6.2.1. The full breakdown is in #393.Changes
ios/legacy/RiveReactNativeView.swift:riveView.autoResizeDrawable = falsewhen the view is created;syncDrawableSize(), called fromlayoutSubviewsanddidMoveToWindow. It setsdrawableSizetobounds × window.screen.nativeScale, rounded the wayMTKViewrounds, and skips empty bounds.When nothing is transformed, the result is the same size
MTKViewwould have picked.Testing
xcodebuildof theRNRivepod target passes, and SwiftLint reports no new warnings.Notes
RiveUIViewcreates a plainMTKViewwith automatic drawable sizing. The fix for that belongs in rive-ios, and I'm happy to open an issue there.release-v0.4, where the file isios/RiveReactNativeView.swift.