Repository navigation
Conversation
On iOS, Fabric creates a new native view when an <Activity> reveals a RiveView, and RiveView disposes the view it replaced. useRive kept returning that disposed view until the new one was ready, so an effect that re-ran in between threw "undefined is not a function" on play(). useRive now resets riveViewRef to undefined as soon as a new node arrives, and ignores an awaitViewReady() result for a node that has since been replaced. Fixes #473
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.
Fixes #473
On iOS, Fabric creates a new native view when an
<Activity>reveals aRiveView, andRiveViewdisposes the view it replaced.useRivekept returning that disposed view until the new one was ready (3–7 ms on the simulator), so an effect that re-ran in between threwTypeError: undefined is not a functiononplay(). Reproduced on an iOS 26.5 simulator in debug and release; Android keeps the same native view across hide and reveal, so it isn't affected.useRivenow resetsriveViewReftoundefinedas soon as a new node arrives, and ignores anawaitViewReady()result for a node that has since been replaced, which could otherwise publish the older view (ornull) over the newer one.example/__tests__/activity-reveal-view-ref.harness.tsxand the two new cases inuseRive.test.tsfail on main and pass with the fix. TheIssue473StaleViewRefexample page shows it with hide/reveal buttons and a counter of calls on disposed views.Code that reads the last-rendered
riveViewRefin the same tick a new node arrives, before React re-renders, can still see the disposed view; making calls on a disposed view no-ops would close that and is left for a follow-up.