Skip to content

bug: iOS: SVG images are not rendered properly, not scaled and the format is not auto-detected  #382

Description

@SimpleCreations

What's happening?

Hi! First of all, thank you for such an amazing library!

On iOS, it seems like:

  • SVG format is not auto-detected (I need to supply format="svg" in order for the image to display);
  • The rendering is vastly different from other implementations (web, react-native-svg);
  • resizeMode seems to have no effect — the image is not scaled to fit the container, even if <svg> tag doesn't have width and height attributes.

My SVG image is very simple — it contains only 2 paths. No filters/gradients/masks etc.

No format prop format="svg"
Simulator Screenshot - iPhone 11 Pro - 2025-01-01 at 16 34 40 Simulator Screenshot - iPhone 11 Pro - 2025-01-01 at 16 34 28

Reproduceable Code

import { Text } from 'react-native';

import { SafeAreaView } from 'react-native-safe-area-context';
import { SvgUri } from 'react-native-svg';
import TurboImage from 'react-native-turbo-image';

const URI =
  'https://images.ctfassets.net/zhgoh1a85x2k/3P07taNJiznsHQPzDGAwZv/6ce82ca823046bd051803c991ebd6ffd/Adyen_Visa.svg';
const STYLE = { width: 128, height: 128, backgroundColor: 'lightgrey' };

const App = () => (
  <SafeAreaView style={{ gap: 16 }}>
    <Text>TurboImage</Text>
    <TurboImage
      style={STYLE}
      resizeMode='contain'
      source={{ uri: URI }}
      format='svg'
    />
    <Text>SvgUri from react-native-svg</Text>
    <SvgUri style={STYLE} uri={URI} />
  </SafeAreaView>
);

export default App;

Relevant log output

Didn't see any logs

Device

iOS simulator (iOS 17.5)

TurboImage Version

1.21.0

Can you reproduce this issue in the TurboImage Example app?

Yes, I can reproduce the same issue in the Example app

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingno-stale

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions