react-native-svg
react-native-svg copied to clipboard
feat: add format and quality parameters toDataURL function
Summary
Feature #1588 Introduce new parameters, format, and quality, for the toDataURL function.
Allow users to select the compressed format (defaulting to PNG or JPEG) in the toDataURL function. Additionally, include a new parameter called quality for the JPEG format. Created a new type, ToDataUrlOptions, and exported it externally.
The data structure appears as follows:
const optionsWithJPEGFormat: ToDataUrlOptions = {
format: 'jpeg',
width,
height,
quality: 100,
};
const optionsWithPNGFormat: ToDataUrlOptions = {
format: 'png',
width,
height,
};
Test Plan
What's required for testing (prerequisites)?
What are the steps to reproduce (after prerequisites)?
Compatibility
| OS | Implemented |
|---|---|
| iOS | ✅ |
| MacOS | ✅ |
| Android | ✅ |
| Web | ✅ |
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)