-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathIssue189.tsx
More file actions
68 lines (63 loc) · 2.03 KB
/
Issue189.tsx
File metadata and controls
68 lines (63 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* Reproducer for https://github.com/rive-app/rive-nitro-react-native/issues/189
*
* [Android] Rive files that have ViewModels but no default ViewModel for the
* artboard freeze when dataBind is not explicitly set (defaults to Auto).
*
* Root cause: in Auto mode Android checks viewModelCount > 0 and passes
* autoBind=true to setRiveFile. The Rive SDK then throws
* "No default ViewModel found for artboard" when the artboard has no default
* ViewModel assigned, which freezes the animation.
*
* Fix: don't use SDK-level autoBind for Auto mode. Let bindToStateMachine
* handle it — it already catches ViewModelException gracefully.
*
* Marketplace: https://rive.app/community/files/27026-50856-no-default-vm-for-artboard/
*
* Expected: bouncing animation plays on both platforms
* Actual (Android, unfixed): animation freezes, ViewModelInstanceNotFound error
*/
import { View, StyleSheet, Text } from 'react-native';
import { RiveView, useRiveFile } from '@rive-app/react-native';
import { type Metadata } from '../shared/metadata';
export default function Issue189Page() {
const { riveFile, error } = useRiveFile(
require('../../assets/rive/nodefaultbouncing.riv')
);
return (
<View style={styles.container}>
{error != null && (
<Text style={styles.errorText}>Error: {String(error)}</Text>
)}
{riveFile && (
<RiveView
file={riveFile}
autoPlay={true}
// No dataBind prop — defaults to Auto. On Android (unfixed) this
// triggers "No default ViewModel found for artboard" and freezes.
style={styles.rive}
/>
)}
</View>
);
}
Issue189Page.metadata = {
name: 'Issue #189',
description:
'[Android] Animation with ViewModels but no artboard default freezes in Auto dataBind mode',
} satisfies Metadata;
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
},
errorText: {
color: 'red',
textAlign: 'center',
padding: 8,
},
rive: {
flex: 1,
width: '100%',
},
});