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

@zplata zplata commented Aug 6, 2026

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 thread src/hooks/useViewModelInstanceImage.ts Outdated

Copilot AI 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
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.

@bodymovin bodymovin 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 main Aug 7, 2026
2 checks passed
@zplata
zplata deleted the feat/font-db branch August 7, 2026 15:26
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.

4 participants