Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ npm run dev

We use Storybook to deploy our examples out onto a public-facing page for folks to view and see code examples for. It also serves as the place we'll include any example suites. These story files are stored in `/examples`

To run Storybook, run the following command in the terminal:
To make sure you're using the latest version of the runtime and to see changes made to the Rive React runtime reflected in your storybook, run the following command in a separate terminal window:

```
npm run storybook
npm run dev
```

To see changes made to the Rive React runtime reflected in your storyook, run the following command in a separate terminal window:
To run Storybook, run the following command in the terminal:

```
npm run dev
npm run storybook
```

### Testing
Expand Down
Binary file added examples/public/Orbitron.ttf
Binary file not shown.
Binary file modified examples/public/font_db_test.riv
Binary file not shown.
15 changes: 8 additions & 7 deletions examples/src/components/DataBindingHooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,21 @@ const COLOR_PROP = 'backgroundColor';
const GLOBAL_VM_CURRENCY = 'Labels';
const CURRENCY_PROP = 'currency';


const GlobalViewModelInstance = () => {
const { rive, RiveComponent } = useRive({
src: 'global_variables_test.riv',
stateMachines: 'State Machine 1',
autoplay: false,
autoBind: false,
});

// Set up the main view model instance if you need a reference to it to change any properties.
// These two lines are optional here: the global hooks below trigger a bind(), and bind() fills
// any unset slots (including main) with their default instance — so the default main gets bound
// either way. (With autoBind:false and no globals, you'd need to set the main yourself.)
const mainViewModel = useViewModel(rive, { name: 'Main' });
useViewModelInstance(mainViewModel, {rive});
useViewModelInstance(mainViewModel, { rive });

// Set up global view model instances
// Note that we don't need to specify every global view model here - only the ones we want to have a reference to
// to change values on. The other globals will use a default instance.
Expand All @@ -47,19 +46,21 @@ const GlobalViewModelInstance = () => {
{ rive }
);

const globalCurrencyViewModel = useViewModel(rive, { name: GLOBAL_VM_CURRENCY });
const globalCurrencyViewModel = useViewModel(rive, {
name: GLOBAL_VM_CURRENCY,
});
const globalCurrencyInstance = useGlobalViewModelInstance(
globalCurrencyViewModel,
GLOBAL_VM_CURRENCY,
{ rive }
);

const { value: bgColor, setValue: setBgColor } = useViewModelInstanceColor(
const { setValue: setBgColor } = useViewModelInstanceColor(
COLOR_PROP,
globalColorsInstance
);

const { value: currency, setValue: setCurrency } = useViewModelInstanceString(
const { setValue: setCurrency } = useViewModelInstanceString(
CURRENCY_PROP,
globalCurrencyInstance
);
Expand Down
Loading
Loading