Skip to content

Conversation

@mfazekas
Copy link
Collaborator

@mfazekas mfazekas commented Nov 7, 2025

Basically allows simplified code:

function Foo() {
  const {riveFile, error, isLoading} = useRiveFile(require('foo/bar/baz.riv'))
  
  
  return (<RiveView file={riveFile} ...>
   </RiveView>)
}

to be written as:

function Foo() {
  return (<RiveView file={require('foo/bar/baz.riv')} ...>
   </RiveView>)
}

Advantages:

  • simpler examples
  • migration to new lib is easier
    Disadvanteges:
  • going from simple use to advanced is harder.

Alternatives:

  • introduces RiveController, that's really just a file and dartboard/statemachine for now

@mfazekas mfazekas changed the title feat: Allow file input on rive view feat: Allow fileInput props on rive view Nov 7, 2025
@mfazekas mfazekas force-pushed the feat/referencedAssets branch from e9240aa to 1171783 Compare November 10, 2025 13:25
@mfazekas mfazekas marked this pull request as ready for review November 11, 2025 08:52
@HayesGordon
Copy link
Contributor

@mfazekas this is great, and I think it will be useful for people migrating. But there are (and will be) a lot of other breaking changes. We should aim to only add this (and other similar) if it enhances this runtime. We shouldn't let the old runtime usage drag us down.

With that in mind, I like the above. My only concern is that over time, we add more and more affordances to the RiveView that will hide the underlying intended usage.

There is a big advantage in people understanding that they own/manage the lifetime of the Rive File object - we've learned that lesson in our other runtimes. Creating view model instances is also reliant on having the file object. Having one way to do something will reduce the amount of if this then that docs we need to write.

People can always write their own wrappers to simplify this.

I still like this change, though. But my concern is that people will ask that we allow them to customize the loading and error state - and the answer there will then be an if this then that. So the options are:

  • we expose a way to set the loading and error state (complicating the base usage that does not need it)
  • we recommend managing the file resource yourself (which any serious Rive user should be doing anyway)

@mfazekas mfazekas force-pushed the allow-file-input-on-rive-view branch from eb553a6 to 0cdc246 Compare November 12, 2025 14:55
@mfazekas mfazekas changed the base branch from feat/referencedAssets to main November 12, 2025 14:58
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.

3 participants