I could not find a demo for Nativescript core so I created one (to save time for others). It draws both a simple black rectangle on a page and an svg from a certain source.
## `ui-svg` example
- Same file structure as above.
- Note that you need to install `@nativescript-community/arraybuffers`, `@nativescript-community/canvas`, and `@nativescript-community/ui-svg` to avoid dependency-related errors. Also, no need for the use of Javascript since we are directly using `SVGView`.
- app-root.xml
```xml
<Frame defaultPage="~/views/welcome/welcome-page" id="topmost"></Frame>
I could not find a demo for Nativescript core so I created one (to save time for others). It draws both a simple black rectangle on a page and an
svg
from a certain source.File structure:
package.json
welcome-page.xml
welcome-page.js
const { WelcomeViewModel } = require("./welcome-view-model");
const welcomeViewModel = new WelcomeViewModel();
export const onLoaded = (args) => { const page = args.object; page.bindingContext = welcomeViewModel; };
export const onDraw = (event) => { try { const paint = new Paint(); paint.setColor(new Color('black')); paint.strokeWidth = 10; event.canvas.drawRect(createRect(0, 0, 400, 400), paint); } catch(err) { console.log(err); } }