-
Notifications
You must be signed in to change notification settings - Fork 66
Description
Description
Hi 👋
<Rive> component allows us (normally) to handle some errors (RNRiveErrorType):
- IncorrectRiveFileUrl
- MalformedFile
- FileNotFound
- IncorrectArtboardName
- UnsupportedRuntimeVersion
- IncorrectStateMachineName
- IncorrectStateMachineInput
But instead of displaying a warning and/or handling error with onError, the app crashes instantly with any of the errors listed above 😕
Example
The app crash instantly with something like that:
const malformedFileUrl =
"https://hatrabbits.com/wp-content/uploads/2017/01/random.jpg";
const correctFileUrl =
"https://public.rive.app/community/runtime-files/2195-4346-avatar-pack-use-case.riv";
export default function Example7() {
const riveRef = useRef<RiveRef>(null);
return (
<Rive
url={malformedFileUrl}
// url={correctFileUrl}
onError={(riveError: RNRiveError) => {
switch (riveError.type) {
case RNRiveErrorType.IncorrectRiveFileUrl: {
console.log(`${riveError.message}`);
return;
}
case RNRiveErrorType.MalformedFile: {
console.log("Malformed File");
return;
}
case RNRiveErrorType.FileNotFound: {
console.log("File not found");
return;
}
case RNRiveErrorType.IncorrectArtboardName: {
console.log("IncorrectAnimationName");
return;
}
case RNRiveErrorType.UnsupportedRuntimeVersion: {
console.log("Runtime version unsupported");
return;
}
case RNRiveErrorType.IncorrectStateMachineName: {
console.log(`${riveError.message}`);
return;
}
case RNRiveErrorType.IncorrectStateMachineInput: {
console.log(`${riveError.message}`);
return;
}
default:
return;
}
}}
/>
);
}Repository
To reproduce, I created a rive playground: https://github.com/guval-gh/rive-playground
And the last example (Example 7) crash: https://github.com/guval-gh/rive-playground/blob/main/app/example7.tsx
Expected behavior
I expect my log to be displayed in the case of onError:
case RNRiveErrorType.MalformedFile: {
console.log(“Malformed File”);
return;
}I expect that all the error cases that can be handled via onError won't cause the app to crash.
Screenshots
As soon as I try to go to the screen of the previous example, the app crashes:
Crash_on_error.mp4
Device
- (Screenrecord): iOS Simulator - iOS 18.1
- Crash on iOS Simulator and Android Emulator
Additional context
Crash appear on:
"expo": "^52.0.11",
"react-native": "0.76.3",
"rive-react-native": "^8.2.0",Also tested on rive-react-native versions: 8.0.0 and 8.1.0