Skip to content

Commit f5baf03

Browse files
committed
refactor: simplify MenuListExample to use useViewModelInstance(file)
1 parent 6ece098 commit f5baf03

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

example/src/pages/MenuListExample.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import {
1616
useRiveFile,
1717
useRiveList,
1818
useViewModelInstance,
19-
useRive,
20-
DataBindMode,
2119
} from '@rive-app/react-native';
2220
import { type Metadata } from '../helpers/metadata';
2321

@@ -40,8 +38,7 @@ export default function MenuListExample() {
4038
}
4139

4240
function MenuList({ file }: { file: RiveFile }) {
43-
const { riveViewRef, setHybridRef } = useRive();
44-
const instance = useViewModelInstance(riveViewRef);
41+
const instance = useViewModelInstance(file);
4542

4643
const addLabelRef = useRef<TextInput>(null);
4744
const lastAdded = useRef<ViewModelInstance | null>(null);
@@ -123,10 +120,9 @@ function MenuList({ file }: { file: RiveFile }) {
123120
return (
124121
<View style={styles.container}>
125122
<RiveView
126-
hybridRef={setHybridRef}
127123
style={styles.rive}
128124
autoPlay={true}
129-
dataBind={DataBindMode.Auto}
125+
dataBind={instance ?? undefined}
130126
fit={Fit.FitWidth}
131127
file={file}
132128
/>

0 commit comments

Comments
 (0)