Skip to content

Fix Fit.LAYOUT artboard oversized on Android (experimental)#210

Closed
mfazekas wants to merge 87 commits intofeat/rive-ios-experimentalfrom
fix/android-fit-layout-scale-factor-experimental
Closed

Fix Fit.LAYOUT artboard oversized on Android (experimental)#210
mfazekas wants to merge 87 commits intofeat/rive-ios-experimentalfrom
fix/android-fit-layout-scale-factor-experimental

Conversation

@mfazekas
Copy link
Copy Markdown
Collaborator

Stacked on experimental branch. Same fix as #209.

Set layoutScaleFactorAutomatic to device density at init time to prevent the render thread from using the default 1.0 before onMeasure fires.

Fixes #206

mfazekas and others added 30 commits April 8, 2026 15:31
Add new experimental iOS backend (ios/new/) with synchronous API,
move legacy backend files to ios/legacy/, add getEnums() support,
retry listener streams on missingData, and restore TestComponentOverlay.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
getEnums() in legacy now throws directing users to the experimental
backend instead of creating throwaway Worker+File instances.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
… binding

Each Worker has its own C++ command server with its own m_artboards handle map.
Creating separate Workers per file meant artboard handles from one file were
invalid on another file's server. Using a shared singleton Worker fixes cross-file
artboard property set. Also wires fit/alignment through experimental Fit enum and
improves asset type detection with audio/font magic bytes.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Happy <yesreply@happy.engineering>
Passing fit to the Rive() constructor breaks layout mode because
the MTKView drawable isn't ready yet. Set rive.fit after
setupRiveUIView() instead.
Port Flutter data binding tests for VM access, enums, creation
variants, list properties, artboard and image properties. Includes
new .riv test assets and react-native-harness upgrade to alpha.25.
…ceByIndex

Prevents fatal crash when passing negative numbers to Swift APIs
expecting unsigned integers.
CocoaPods doesn't embed SPM-resolved dynamic frameworks automatically.
Patches the embed script to include RiveRuntime when USE_RIVE_SPM=1.
Move 19 backend-specific files to src/legacy/java/, add Gradle sourceSets
switching via USE_RIVE_NEW_API property, prepare empty experimental dirs.
Uses the new handle-based Rive Android SDK (app.rive.*) with CommandQueue,
path-based ViewModelInstance property access, and Kotlin Flows for reactivity.
Throws UnsupportedOperationException for SMI inputs, text runs, and events.
Also fixes Gradle property resolution to use rootProject.findProperty.
Custom TextureView renderer with Choreographer render loop, CommandQueue
polling infrastructure, ViewModel resolution and property validation,
and example Compose test activities for manual testing.
Also fix viewModelByIndex/ByName on Android legacy to catch SDK
exceptions instead of letting them propagate as JniExceptions.
…fferences

Fix colorProperty setter Double→Int overflow on Android legacy
(toLong().toInt()). Make enum and replaceViewModel tests tolerant
of Android SDK behavioral differences.
Use .viewModelDefault(from: .name(vmName)) for default instance
creation instead of artboard-based lookup that only worked for
the default artboard's VM. Skip instanceName, color get/set, and
non-existent property checks on experimental iOS where the SDK
doesn't support them.
…anceName

Add async variants for viewModelByName, defaultArtboardViewModel, and
ViewModel create methods. Pass instanceName through at creation time on
both iOS and Android experimental backends as a workaround for the SDK
not exposing ViewModelInstance.name.
…rimental iOS

Color.argbValue is now public in rive-ios 6.15.2 — implement getValue via
blockingAsync, addListener via valueStream, and fix setter crash by using
UInt32(bitPattern:) for negative ARGB values from JS.
- Always use SPM for RiveRuntime (remove CocoaPods fallback)
- Add RiveSPMEmbedFix module to auto-embed RiveRuntime.framework
- Pin SPM to exactVersion instead of upToNextMajorVersion
- Replace USE_RIVE_SPM with USE_RIVE_EXPERIMENTAL_RUNTIME to select
  legacy vs experimental backend independently of SPM
…erimental iOS test issues

- Rename USE_RIVE_EXPERIMENTAL_RUNTIME to USE_RIVE_NEW_API (matches Android)
- Remove USE_RIVE_SPM and all SPM embedding hacks from podspec/Podfile
- Use standard CocoaPods dependency for RiveRuntime
- Emit initial value in experimental addListener (number/string/bool/enum/color)
- Guard tests that crash on experimental iOS (list ops, autoPlay, artboard/image loading)
- Handle createInstanceByName throwing on experimental backend
mfazekas added 25 commits April 8, 2026 15:31
…ndroid

When auto-binding, cppDefaultVMCreateDefaultVMI returns handle 1L (null sentinel) if the artboard has no default ViewModel. Guard against passing this sentinel to bindViewModelInstance.
…allable methods

Nitro calls hybrid methods on the JS thread, not the main thread.
MainActor.assumeIsolated crashes at runtime when not on main.
@mfazekas mfazekas force-pushed the fix/android-fit-layout-scale-factor-experimental branch from e520b6e to 4cb25d3 Compare April 10, 2026 13:54
Set layoutScaleFactor to device density before setRiveFile when the user
hasn't set an explicit value. layoutScaleFactorAutomatic defaults to 1.0
and onMeasure may not fire before the render thread uses it.

Fixes #206
@mfazekas mfazekas force-pushed the fix/android-fit-layout-scale-factor-experimental branch from 4cb25d3 to f2e412a Compare April 10, 2026 14:25
@mfazekas mfazekas force-pushed the feat/rive-ios-experimental branch from 136e109 to 9a5182c Compare April 14, 2026 07:00
@mfazekas mfazekas closed this Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant