Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add support for svg uris without viewbox (#10247)
## **Description** We have ran into some SVG rendering issues with SVG URIs. This is due to some SVGs do not contain a view-box, thus can be much larger or smaller than the container it is trying to fit in. For example: - [This SVG](https://raw.githubusercontent.com/MetaMask/contract-metadata/master/images/usdt.svg) does not have a viewbox, and does not "render correctly" - [This SVG](https://token.api.cx.metamask.io/assets/nativeCurrencyLogos/ethereum.svg) does have a viewbox and can be rendered correctly. <details><summary>See Example Screenshot</summary> ![Screenshot 2024-07-04 at 02 36 32](https://github.com/MetaMask/metamask-mobile/assets/17534261/71b29017-bb0c-43a0-8b36-eba93489c643) </details> This adds an effect to use the SVG width/height for setting a view box if not set in the SVG. ## **Related issues** Known issue and temporary fix in `react-native-svg`: software-mansion/react-native-svg#1202 (comment) ## **Manual testing steps** ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> <details><summary>Before</summary> ![Screenshot 2024-07-04 at 02 36 32](https://github.com/MetaMask/metamask-mobile/assets/17534261/1a716d94-cd63-4aad-a995-4075cc14346c) </details> ### **After** <details><summary>After</summary> ![Screenshot 2024-07-04 at 12 32 35](https://github.com/MetaMask/metamask-mobile/assets/17534261/831cb931-01fc-4ffe-a4cc-1ef122c2f525) </details> <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
- Loading branch information