Skip to content

javierpal/nativescript-cscreenshot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nativescript Cscreenshot 📷

This plugin was created so you can take screenshots of views easily and then store it as you like.

this plugin is based on enchev's NativeScript Screenshot nativescript-screenshot but updated for better stability and angular, vue and react compatibility (still testing vue and react)

Now working in Nativescript 8

IMPORTANT: For some reason I can't test the ios version because of this problem Github, i will appreciate if you can and report this in the issues page.

Installation

Use the install command:

tns plugin add nativescript-cscreenshot

Usage

Just import the plugin in your project and use it like this

using Typescript:

    import { Cscreenshot } from 'nativescript-cscreenshot';
    import { ImageSource } from "tns-core-modules/image-source";

    // then in your take a screenshot method
    let screen = new Cscreenshot();

    // Using vanilla Nativescript
    let view = page.getViewById('main');

    // Using Angular Nativescript
    @ViewChild("main", { static: true }) main: ElementRef;
    let view = this.view.nativeElement;

    // Using Vue Nativescript
    let view = this.$refs.main.nativeView;

    screen.take(view, (image: ImageSource)=>{
        // Do whatever you want with the returned source image
    });

and in your template

    <!-- Assign the reference name depending on the framework -->
    <!-- 'id=""' for vanilla nativescript -->
    <!-- '#main' for angular nativescript -->
    <!-- 'ref="main"' for Vue nativescript -->
    <GridLayout id="main" #main ref="main">
        <!-- Content of your app here -->
    </GridLayout>

License

Apache License Version 2.0, January 2004

About

Your Take a View Screenshot Nativescript Plugin! 📷

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published