feat(react): add hook for font databound properties - #435
Merged
Conversation
lancesnider
previously approved these changes
Aug 6, 2026
bodymovin
reviewed
Aug 6, 2026
There was a problem hiding this comment.
Pull request overview
Adds a new React hook to support databound font properties on a ViewModelInstance, mirroring the existing image property hook pattern and surfacing it through the public package entrypoints and examples.
Changes:
- Introduces
useViewModelInstanceFonthook for setting databound font properties via path lookup. - Extends public types with
RiveDecodedFont/UseViewModelInstanceFontResultand exports the new hook fromsrc/index.ts. - Adds unit tests and Storybook/example coverage for the new font databinding behavior.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/useViewModelInstanceFont.test.tsx | Adds unit tests covering lookup, setter behavior (including null-clear), and subscription cleanup. |
| src/types.ts | Defines RiveDecodedFont and the UseViewModelInstanceFontResult type used by the new hook. |
| src/index.ts | Re-exports useViewModelInstanceFont from the package entry. |
| src/hooks/useViewModelInstanceImage.ts | Minor docstring clarification for the existing image hook. |
| src/hooks/useViewModelInstanceFont.ts | Implements the new font property hook using the shared useViewModelInstanceProperty base hook. |
| examples/src/components/DataBindingTests.tsx | Adds a font databinding example component that decodes a font and sets/clears the property. |
| examples/src/components/DataBindingTests.stories.tsx | Adds a Storybook story + play assertions for the new font property example. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
With the recent JS runtime support of databinding font properties, adding an equivalent hook similar to the image property hook.