@@ -376,28 +376,25 @@ This guide documents how to get started using the Rive React Native runtime. The
376376 Hook to create a view model instance from a ` RiveFile ` , ` ViewModel ` , or ` RiveViewRef ` :
377377
378378 ``` ts
379- // Get default instance from RiveFile (recommended)
379+ // From RiveFile — default artboard's ViewModel, default instance
380380 const instance = useViewModelInstance (riveFile );
381381
382- // or
383- // Get named instance from a ViewModel
384- const namedInstance = useViewModelInstance (viewModel , { name : ' My Instance ' });
382+ // From RiveFile — specify artboard or ViewModel name (mutually exclusive)
383+ const instance = useViewModelInstance ( riveFile , { artboardName: ' MainArtboard ' });
384+ const instance = useViewModelInstance (riveFile , { viewModelName : ' Settings ' });
385385
386- // or
387- // Create a new blank instance from a ViewModel
386+ // instanceName can be combined with any of the above to pick a specific instance
387+ const instance = useViewModelInstance (riveFile , { instanceName: ' PersonInstance' });
388+ const instance = useViewModelInstance (riveFile , { viewModelName: ' Settings' , instanceName: ' UserSettings' });
389+
390+ // From a ViewModel object
391+ const namedInstance = useViewModelInstance (viewModel , { name: ' My Instance' });
388392 const newInstance = useViewModelInstance (viewModel , { useNew: true });
389393
390- // or
391- // With required: true (throws if null, use with Error Boundary)
394+ // Options: required throws if null; onInit sets values before render
392395 const instance = useViewModelInstance (riveFile , { required: true });
393-
394- // or
395- // With onInit to set initial values synchronously
396396 const instance = useViewModelInstance (riveFile , {
397- onInit : (vmi ) => {
398- vmi .numberProperty (' count' )?.set (10 );
399- vmi .stringProperty (' name' )?.set (' Initial Name' );
400- }
397+ onInit : (vmi ) => vmi .numberProperty (' health' )! .value = 100 ,
401398 });
402399 ```
403400
0 commit comments