Skip to content

add remote image support for ImageSVG component #1078

Closed

Description

Description

why

https://developer.mozilla.org/en-US/docs/Web/SVG/Element/image
The SVG element includes images inside SVG documents. It can display raster image files or other SVG files.

usage

import React from "react";
import { Canvas, ImageSVG, Skia } from "@shopify/react-native-skia";

const svg = Skia.SVG.MakeFromString(
  `<svg viewBox='0 0 290 500' xmlns='http://www.w3.org/2000/svg'>
    <image href="https://yari-demos.prod.mdn.mozit.cloud/en-US/docs/Web/SVG/Element/image/mdn_logo_only_color.png" height="200" width="200"></image>
    <circle cx='31' cy='325' r='120px' fill='#c02aaa'/>
  </svg>`
)!;
 
export const SVG = () => {
  return (
    <Canvas style={{ flex: 1 }}>
      <ImageSVG
        svg={svg}
        x={0}
        y={0}
        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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions