fix: change useViewModel property hook parameters to match conventions

This commit is contained in:
Adam
2025-04-29 17:07:17 -07:00
parent efd6c4ce82
commit 4e45f74a47
9 changed files with 51 additions and 111 deletions

View File

@@ -1,21 +1,19 @@
import { useCallback } from 'react';
import { ViewModelInstanceBoolean } from '@rive-app/canvas';
import { UseViewModelInstanceBooleanParameters, UseViewModelInstanceBooleanResult } from '../types';
import { ViewModelInstanceBoolean, ViewModelInstance } from '@rive-app/canvas';
import { UseViewModelInstanceBooleanResult } from '../types';
import { useViewModelInstanceProperty } from './useViewModelInstanceProperty';
/**
* Hook for interacting with boolean ViewModel instance properties.
*
* @param params - Parameters for interacting with a boolean ViewModel instance property
* @param params.path - The path to the boolean property
* @param params.viewModelInstance - The ViewModelInstance containing the boolean property to operate on
* @param path - The path to the boolean property
* @param viewModelInstance - The ViewModelInstance containing the boolean property to operate on
* @returns An object with the boolean value and a setter function
*/
export default function useViewModelInstanceBoolean(
params: UseViewModelInstanceBooleanParameters
path: string,
viewModelInstance?: ViewModelInstance | null
): UseViewModelInstanceBooleanResult {
const { path, viewModelInstance } = params;
const result = useViewModelInstanceProperty<ViewModelInstanceBoolean, boolean, Omit<UseViewModelInstanceBooleanResult, 'value'>>(
path,
viewModelInstance,