react-native-svg
react-native-svg copied to clipboard
feat: SvgFromUri/SvgFromXml add props onError execution
Summary
The onError function of the SvgFromUri / SvgFromXml component does not work.
According to the current code, there is no way to track if an error occurs in the component rendering.
Test Plan
What's required for testing (prerequisites)?
uri fetch fails.
What are the steps to reproduce (after prerequisites)?
Pass the onError function as props to test whether it is executed.
Compatibility
| OS | Implemented |
|---|---|
| iOS | ✅ |
| Android | ✅❌ |
Checklist
- [x] I have tested this on a device and a simulator
- [ ] I added documentation in
README.md - [x] I updated the typed files (typescript)
- [ ] I added a test for the API in the
__tests__folder
Could you resolve the failing CI job? It should be ready for merge then 🚀
Could you resolve the failing CI job? It should be ready for merge then 🚀
@WoLewicki
I am very sorry for the late reply.
I expect TypeScript compilerOptions to be stable.
Perhaps the modified code will pass the CI job safely.
Please check new commit. Also, I hope you compare the new commit with the code below and choose a better solution.
this.props.onError ? this.props.onError(e as Error) : console.error(e);
Hello @H2-won,
Thank you so much for your time and for all that you do. We have closed the PR case as we have already implemented part of your changes in our codebase. Nevertheless, we truly appreciate your contributions. Thank you again.