Skip to content

text in ImageSVG will not shown #2404

Closed

Description

Description

https://shopify.github.io/react-native-skia/docs/images-svg#font-family

The document says:
When rendering your SVG with Skia, all fonts available in your app are also available to your SVG. However, the way you can set the font-family attribute is as flexible as on the web.

But I can't use the text that uses the system font in svg.

Version

1.2.1

Steps to reproduce

  1. Use ImageSVG components
  2. Use MakeFromString
  3. Add text to svg string
  4. This svg string is displayed normally in svgo

Snack, code example, screenshot, or link to a repository

const svg = Skia.SVG.MakeFromString(
  `<svg viewBox='0 0 200 200' width="200" height="200" xmlns='http://www.w3.org/2000/svg'>
    <text font-family="sans-serif" font-size="12" x="10" y="10" fill="#fff">Hello World</text>
  </svg>`
)!;

const HelloWorld = () => {
  return (
    <Canvas style={{ flex: 1, width: 300, height: 300 }}>
      <ImageSVG
        svg={svg}
        x={110}
        y={110}
        width={290}
        height={500}
      />
    </Canvas>
  );
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions