Skip to content

Adds support for SVGs in your NativeScript apps.

License

Notifications You must be signed in to change notification settings

madebyoutloud/ui-svg

 
 

Repository files navigation

NativeScript SVG widget

npm downloads npm downloads npm

A NativeScript SVG plugin. Very basic implementation for now

Installation

Run the following command from the root of your project:

tns plugin add @nativescript-community/ui-svg

Configuration

For now only vue (and core) is supported.

import CanvasSVG from '@nativescript-community/ui-svg/vue';
Vue.use(CanvasSVG);

It works in 3 ways!.

CanvasSVG extending Canvas

<CanvasSVG>
    <CSVG horizontalAlignment="left" src="~/assets/svgs/Ghostscript_Tiger.svg" height="100%" stretch="aspectFit" />
</CanvasSVG>

or SVGView which is a basic svg view with support for auto sizing

<SVGView height="30%" src="~/assets/svgs/Ghostscript_Tiger.svg" stretch="aspectFit" backgroundColor="red" />

Or within and canvas extending view

<CanvasLabel>
 <CGroup fontSize="18" verticalAlignment="middle" paddingLeft="20">
        <CSpan text="test" fontWeight="bold" />
        <CSpan text="test2" color="#ccc" fontSize="16" />
    </CGroup>
    <CSVG horizontalAlignment="left" src="~/assets/svgs/Ghostscript_Tiger.svg" height="10" stretch="aspectFit" />
</CanvasSVG>

For full example / doc look at the vue demo and the typings.

About

Adds support for SVGs in your NativeScript apps.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 49.7%
  • TypeScript 47.0%
  • Vue 2.6%
  • Other 0.7%