Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graceful handling of invalid Rive file URLs for iOS after calling .play (Expo) #211

Open
niklasmachacek opened this issue Nov 29, 2023 · 0 comments

Comments

@niklasmachacek
Copy link

niklasmachacek commented Nov 29, 2023

Description

When providing an invalid URL to the Rive component on iOS and calling .play, the application crashes instead of handling the error gracefully. It would be beneficial to have a fallback mechanism or error handling similar to what is currently implemented on Android, which provides a clear error message without causing a crash.

Steps to Reproduce

  1. Pass an invalid URL to the Rive component in Expo. e.g.:
<StyledSparkleRive
    url="invalidUrl"
	ref={riveRef}
    artboardName="Artboard"
    animationName="Idle"
    onError={reportIssue}
/>
  1. Call .play on the riveRef.current
  2. Try to test the animation inside your emulator/test device.

Expected Behavior

When an invalid URL is passed to the Rive component, the application should not crash when trying to call .play on the riveRef. Instead, it should handle the error by providing an appropriate message, allowing developers to implement a fallback UI or retry mechanism.

Actual Behavior

The application crashes when the Rive component on iOS receives an invalid URL and is being played using the .play function. No error message is logged. Using the autoplay prop does not cause the animation to crash.

Android Error Handling (for reference)

On Android, the error is handled correctly, and the following message is presented:
json
{
"type": "IncorrectRiveFileUrl",
"message": "Unable to download Rive file from: invalidUrl"
}

Additional Information

  • rive-react-native: [6.1.1]
  • react-native: [0.71.14]
  • expo: [48.0.21]
  • Platform: iOS (Android works as expected)
  • reproduced on: [both real iOS Device and Simulator]
  • environment: [DEV]

It would be greatly appreciated if the same error handling implemented for Android could be applied to the iOS side to improve the robustness of the Rive component in various network conditions or potential server outages.

@niklasmachacek niklasmachacek changed the title Graceful handling of invalid Rive file URLs for iOS (Expo) Graceful handling of invalid Rive file URLs for iOS after calling .play (Expo) Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant