Skip to content

feat(react): add hook for font databound properties - #435

Merged
zplata merged 3 commits into
mainfrom
feat/font-db
Aug 7, 2026
Merged

feat(react): add hook for font databound properties#435
zplata merged 3 commits into
mainfrom
feat/font-db

Conversation

@zplata

Copy link
Copy Markdown
Collaborator

With the recent JS runtime support of databinding font properties, adding an equivalent hook similar to the image property hook.

lancesnider
lancesnider previously approved these changes Aug 6, 2026
Comment threadsrc/hooks/useViewModelInstanceImage.ts Outdated

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 useViewModelInstanceFont hook for setting databound font properties via path lookup.
  • Extends public types with RiveDecodedFont / UseViewModelInstanceFontResult and exports the new hook from src/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
FileDescription
test/useViewModelInstanceFont.test.tsxAdds unit tests covering lookup, setter behavior (including null-clear), and subscription cleanup.
src/types.tsDefines RiveDecodedFont and the UseViewModelInstanceFontResult type used by the new hook.
src/index.tsRe-exports useViewModelInstanceFont from the package entry.
src/hooks/useViewModelInstanceImage.tsMinor docstring clarification for the existing image hook.
src/hooks/useViewModelInstanceFont.tsImplements the new font property hook using the shared useViewModelInstanceProperty base hook.
examples/src/components/DataBindingTests.tsxAdds a font databinding example component that decodes a font and sets/clears the property.
examples/src/components/DataBindingTests.stories.tsxAdds 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.

@bodymovinbodymovin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zplata
zplata merged commit d93a763 into mainAug 7, 2026
2 checks passed
@zplata
zplata deleted the feat/font-db branch August 7, 2026 15:26
Sign up for freeto 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.

4 participants

@zplata@lancesnider@bodymovin