├── src
├── app
│ ├── app.html
│ ├── main.ts
│ ├── app.module.ts
│ ├── app.component.ts
│ └── app.scss
├── assets
│ └── icon
│ │ └── favicon.ico
├── pages
│ └── preview
│ │ ├── preview.scss
│ │ ├── preview.html
│ │ └── preview.ts
├── manifest.json
├── theme
│ ├── app.core.scss
│ ├── app.ios.scss
│ ├── app.wp.scss
│ ├── app.md.scss
│ ├── app.variables.scss
│ └── variables.scss
├── declarations.d.ts
├── service-worker.js
└── index.html
├── typings
├── index.d.ts
└── globals
│ └── es6-shim
│ ├── typings.json
│ └── index.d.ts
├── images
├── 1.png
└── 2.png
├── ionic.config.json
├── tslint.json
├── .editorconfig
├── .gitignore
├── tsconfig.json
├── README.md
├── package.json
└── config.xml
/src/app/app.html:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/typings/index.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
--------------------------------------------------------------------------------
/images/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TeamClouders/Ionic-2-camera-preview/HEAD/images/1.png
--------------------------------------------------------------------------------
/images/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TeamClouders/Ionic-2-camera-preview/HEAD/images/2.png
--------------------------------------------------------------------------------
/src/assets/icon/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TeamClouders/Ionic-2-camera-preview/HEAD/src/assets/icon/favicon.ico
--------------------------------------------------------------------------------
/ionic.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Ionic-2-camera-preview-updated",
3 | "app_id": "",
4 | "v2": true,
5 | "typescript": true
6 | }
--------------------------------------------------------------------------------
/src/pages/preview/preview.scss:
--------------------------------------------------------------------------------
1 | .displaybottom{
2 | padding-top: 86%;
3 | bottom: 0;
4 | }
5 |
6 |
7 | // .pictures{
8 | // position: relative;
9 | // bottom: 0;
10 | // }
--------------------------------------------------------------------------------
/src/app/main.ts:
--------------------------------------------------------------------------------
1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2 |
3 | import { AppModule } from './app.module';
4 |
5 | platformBrowserDynamic().bootstrapModule(AppModule);
6 |
--------------------------------------------------------------------------------
/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "no-duplicate-variable": true,
4 | "no-unused-variable": [
5 | true
6 | ]
7 | },
8 | "rulesDirectory": [
9 | "node_modules/tslint-eslint-rules/dist/rules"
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/src/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Ionic",
3 | "short_name": "Ionic",
4 | "start_url": "index.html",
5 | "display": "standalone",
6 | "icons": [{
7 | "src": "assets/imgs/logo.png",
8 | "sizes": "512x512",
9 | "type": "image/png"
10 | }],
11 | "background_color": "#4e8ef7",
12 | "theme_color": "#4e8ef7"
13 | }
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
2 | # editorconfig.org
3 |
4 | root = true
5 |
6 | [*]
7 | indent_style = space
8 | indent_size = 2
9 |
10 | # We recommend you to keep these unchanged
11 | end_of_line = lf
12 | charset = utf-8
13 | trim_trailing_whitespace = true
14 | insert_final_newline = true
15 |
16 | [*.md]
17 | trim_trailing_whitespace = false
--------------------------------------------------------------------------------
/typings/globals/es6-shim/typings.json:
--------------------------------------------------------------------------------
1 | {
2 | "resolution": "main",
3 | "tree": {
4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9807d9b701f58be068cb07833d2b24235351d052/es6-shim/es6-shim.d.ts",
5 | "raw": "registry:dt/es6-shim#0.31.2+20160602141504",
6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9807d9b701f58be068cb07833d2b24235351d052/es6-shim/es6-shim.d.ts"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/theme/app.core.scss:
--------------------------------------------------------------------------------
1 | // http://ionicframework.com/docs/v2/theming/
2 |
3 |
4 | // App Shared Imports
5 | // --------------------------------------------------
6 | // These are the imports which make up the design of this app.
7 | // By default each design mode includes these shared imports.
8 | // App Shared Sass variables belong in app.variables.scss.
9 |
10 | // @import "../pages/about/about";
11 |
12 | // @import "../pages/contact/contact";
13 |
14 | // @import "../pages/home/home";
15 | @import "../pages/preview/preview";
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Specifies intentionally untracked files to ignore when using Git
2 | # http://git-scm.com/docs/gitignore
3 |
4 | *~
5 | *.sw[mnpcod]
6 | *.log
7 | *.tmp
8 | *.tmp.*
9 | log.txt
10 | *.sublime-project
11 | *.sublime-workspace
12 | .vscode/
13 | npm-debug.log*
14 |
15 | .idea/
16 | .sass-cache/
17 | .tmp/
18 | .versions/
19 | coverage/
20 | dist/
21 | node_modules/
22 | tmp/
23 | temp/
24 | hooks/
25 | platforms/
26 | plugins/
27 | plugins/android.json
28 | plugins/ios.json
29 | www/
30 | $RECYCLE.BIN/
31 |
32 | .DS_Store
33 | Thumbs.db
34 | UserInterfaceState.xcuserstate
35 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "allowSyntheticDefaultImports": true,
4 | "declaration": false,
5 | "emitDecoratorMetadata": true,
6 | "experimentalDecorators": true,
7 | "lib": [
8 | "dom",
9 | "es2015"
10 | ],
11 | "module": "es2015",
12 | "moduleResolution": "node",
13 | "sourceMap": true,
14 | "target": "es5"
15 | },
16 | "include": [
17 | "src/**/*.ts"
18 | ],
19 | "exclude": [
20 | "node_modules"
21 | ],
22 | "compileOnSave": false,
23 | "atom": {
24 | "rewriteTsconfig": false
25 | }
26 | }
--------------------------------------------------------------------------------
/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule, ErrorHandler } from '@angular/core';
2 | import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
3 | import { MyApp } from './app.component';
4 | import {preview} from '../pages/preview/preview'
5 |
6 | @NgModule({
7 | declarations: [
8 | MyApp,
9 | preview
10 | ],
11 | imports: [
12 | IonicModule.forRoot(MyApp)
13 | ],
14 | bootstrap: [IonicApp],
15 | entryComponents: [
16 | MyApp,
17 | preview
18 | ],
19 | providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}]
20 | })
21 | export class AppModule {}
22 |
--------------------------------------------------------------------------------
/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import {Component} from '@angular/core';
2 | import {Platform} from 'ionic-angular';
3 | import {StatusBar} from 'ionic-native';
4 | import {preview} from '../pages/preview/preview';
5 |
6 |
7 | @Component({
8 | templateUrl: 'app.html'
9 | })
10 | export class MyApp {
11 |
12 | rootPage: any = preview;
13 |
14 | constructor(private platform: Platform) {
15 | // this.rootPage = preview;
16 |
17 | platform.ready().then(() => {
18 | // Okay, so the platform is ready and our plugins are available.
19 | // Here you can do any higher level native things you might need.
20 | StatusBar.styleDefault();
21 | });
22 | }
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/src/declarations.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | Declaration files are how the Typescript compiler knows about the type information(or shape) of an object.
3 | They're what make intellisense work and make Typescript know all about your code.
4 |
5 | A wildcard module is declared below to allow third party libraries to be used in an app even if they don't
6 | provide their own type declarations.
7 |
8 | To learn more about using third party libraries in an Ionic app, check out the docs here:
9 | http://ionicframework.com/docs/v2/resources/third-party-libs/
10 |
11 | For more info on type definition files, check out the Typescript docs here:
12 | https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html
13 | */
14 | declare module '*';
--------------------------------------------------------------------------------
/src/app/app.scss:
--------------------------------------------------------------------------------
1 | // http://ionicframework.com/docs/v2/theming/
2 |
3 |
4 | // App Global Sass
5 | // --------------------------------------------------
6 | // Put style rules here that you want to apply globally. These
7 | // styles are for the entire app and not just one component.
8 | // Additionally, this file can be also used as an entry point
9 | // to import other Sass files to be included in the output CSS.
10 | //
11 | // Shared Sass variables, which can be used to adjust Ionic's
12 | // default Sass variables, belong in "theme/variables.scss".
13 | //
14 | // To declare rules for a specific mode, create a child rule
15 | // for the .md, .ios, or .wp mode classes. The mode class is
16 | // automatically applied to the
element in the app.
17 |
--------------------------------------------------------------------------------
/src/service-worker.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Check out https://googlechrome.github.io/sw-toolbox/docs/master/index.html for
3 | * more info on how to use sw-toolbox to custom configure your service worker.
4 | */
5 |
6 |
7 | 'use strict';
8 | importScripts('./build/sw-toolbox.js');
9 |
10 | self.toolbox.options.cache = {
11 | name: 'ionic-cache'
12 | };
13 |
14 | // pre-cache our key assets
15 | self.toolbox.precache(
16 | [
17 | './build/main.js',
18 | './build/main.css',
19 | './build/polyfills.js',
20 | 'index.html',
21 | 'manifest.json'
22 | ]
23 | );
24 |
25 | // dynamically cache any other local assets
26 | self.toolbox.router.any('/*', self.toolbox.cacheFirst);
27 |
28 | // for any other requests go to the network, cache,
29 | // and then only use that cached resource if your user goes offline
30 | self.toolbox.router.default = self.toolbox.networkFirst;
--------------------------------------------------------------------------------
/src/pages/preview/preview.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Preview Page
4 |
5 |
6 |
7 |
8 | This is camera Preview Application..
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
![]()
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/theme/app.ios.scss:
--------------------------------------------------------------------------------
1 | // http://ionicframework.com/docs/v2/theming/
2 |
3 |
4 | // App Shared Variables
5 | // --------------------------------------------------
6 | // Shared Sass variables go in the app.variables.scss file
7 | @import "app.variables";
8 |
9 |
10 | // App iOS Variables
11 | // --------------------------------------------------
12 | // iOS only Sass variables can go here
13 |
14 |
15 | // Ionic iOS Sass
16 | // --------------------------------------------------
17 | // Custom App variables must be declared before importing Ionic.
18 | // Ionic will use its default values when a custom variable isn't provided.
19 | @import "ionic.ios";
20 |
21 |
22 | // App Shared Sass
23 | // --------------------------------------------------
24 | // All Sass files that make up this app goes into the app.core.scss file.
25 | // For simpler CSS overrides, custom app CSS must come after Ionic's CSS.
26 | @import "app.core";
27 |
28 |
29 | // App iOS Only Sass
30 | // --------------------------------------------------
31 | // CSS that should only apply to the iOS app
32 |
--------------------------------------------------------------------------------
/src/theme/app.wp.scss:
--------------------------------------------------------------------------------
1 | // http://ionicframework.com/docs/v2/theming/
2 |
3 |
4 | // App Shared Variables
5 | // --------------------------------------------------
6 | // Shared Sass variables go in the app.variables.scss file
7 | @import "app.variables";
8 |
9 |
10 | // App Windows Variables
11 | // --------------------------------------------------
12 | // Windows only Sass variables can go here
13 |
14 |
15 | // Ionic Windows Sass
16 | // --------------------------------------------------
17 | // Custom App variables must be declared before importing Ionic.
18 | // Ionic will use its default values when a custom variable isn't provided.
19 | @import "ionic.wp";
20 |
21 |
22 | // App Shared Sass
23 | // --------------------------------------------------
24 | // All Sass files that make up this app goes into the app.core.scss file.
25 | // For simpler CSS overrides, custom app CSS must come after Ionic's CSS.
26 | @import "app.core";
27 |
28 |
29 | // App Windows Only Sass
30 | // --------------------------------------------------
31 | // CSS that should only apply to the Windows app
32 |
--------------------------------------------------------------------------------
/src/theme/app.md.scss:
--------------------------------------------------------------------------------
1 | // http://ionicframework.com/docs/v2/theming/
2 |
3 |
4 | // App Shared Variables
5 | // --------------------------------------------------
6 | // Shared Sass variables go in the app.variables.scss file
7 | @import "app.variables";
8 |
9 |
10 | // App Material Design Variables
11 | // --------------------------------------------------
12 | // Material Design only Sass variables can go here
13 |
14 |
15 | // Ionic Material Design Sass
16 | // --------------------------------------------------
17 | // Custom App variables must be declared before importing Ionic.
18 | // Ionic will use its default values when a custom variable isn't provided.
19 | @import "ionic.md";
20 |
21 |
22 | // App Shared Sass
23 | // --------------------------------------------------
24 | // All Sass files that make up this app goes into the app.core.scss file.
25 | // For simpler CSS overrides, custom app CSS must come after Ionic's CSS.
26 | @import "app.core";
27 |
28 |
29 | // App Material Design Only Sass
30 | // --------------------------------------------------
31 | // CSS that should only apply to the Material Design app
32 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Ionic 2 Camera Preview Example Updated to Ionic 2.0 final
2 |
3 | Steps:
4 | 1. Download Nodejs.
5 | 2. Download git.
6 | 3. type `npm install -g ionic cordova` in your command prompt.
7 | 4. type `git clone https://github.com/TeamClouders/Ionic-2-camera-preview` in your command prompt.
8 | 5. After cloning type `npm install` to install dependencies.
9 | 6. Attach your Mobile Device (Android/IOS).
10 | 7. If Android first type `adb devices` to check if your device is avalible and Add Platform for yours example `ionic platform add android` OR `ios`
11 | 8. If Device is avalible type `ionic run android` it will build and install on your android device.
12 | 9. For IPhone build type `ionic build ios` (only works when using Mac).
13 | 10. open `XCODE` And deloy on your device or simmulator.
14 |
15 | 
16 |
17 | 
18 |
19 | Now You can Display your camera in your own Hybrid Application.
20 |
21 | I made simple steps to show you can type Camera Preview code in Typescript.
22 |
23 | It will Display Camera in your HTML view.
24 |
25 | More Tutorials are comming soon...
26 |
27 | Good Luck...!!
28 |
--------------------------------------------------------------------------------
/src/theme/app.variables.scss:
--------------------------------------------------------------------------------
1 | // http://ionicframework.com/docs/v2/theming/
2 |
3 | // Ionic Shared Functions
4 | // --------------------------------------------------
5 | // Makes Ionic Sass functions available to your App
6 |
7 | @import "globals.core";
8 |
9 | // App Shared Variables
10 | // --------------------------------------------------
11 | // To customize the look and feel of this app, you can override
12 | // the Sass variables found in Ionic's source scss files. Setting
13 | // variables before Ionic's Sass will use these variables rather than
14 | // Ionic's default Sass variable values. App Shared Sass imports belong
15 | // in the app.core.scss file and not this file. Sass variables specific
16 | // to the mode belong in either the app.ios.scss or app.md.scss files.
17 |
18 |
19 | // App Shared Color Variables
20 | // --------------------------------------------------
21 | // It's highly recommended to change the default colors
22 | // to match your app's branding. Ionic uses a Sass map of
23 | // colors so you can add, rename and remove colors as needed.
24 | // The "primary" color is the only required color in the map.
25 | // Both iOS and MD colors can be further customized if colors
26 | // are different per mode.
27 |
28 | $colors: (
29 | primary: #387ef5,
30 | secondary: #32db64,
31 | danger: #f53d3d,
32 | light: #f4f4f4,
33 | dark: #222,
34 | favorite: #69BB7B
35 | );
36 |
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Ionic App
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Ionic-camera-preview-updated",
3 | "author": "Ghayyas Mubahsir",
4 | "homepage": "http://github.com/ghayyas",
5 | "private": true,
6 | "scripts": {
7 | "clean": "ionic-app-scripts clean",
8 | "build": "ionic-app-scripts build",
9 | "ionic:build": "ionic-app-scripts build",
10 | "ionic:serve": "ionic-app-scripts serve"
11 | },
12 | "dependencies": {
13 | "@angular/common": "2.4.8",
14 | "@angular/compiler": "2.4.8",
15 | "@angular/compiler-cli": "2.4.8",
16 | "@angular/core": "2.4.8",
17 | "@angular/forms": "2.4.8",
18 | "@angular/http": "2.4.8",
19 | "@angular/platform-browser": "2.4.8",
20 | "@angular/platform-browser-dynamic": "2.4.8",
21 | "@angular/platform-server": "2.4.8",
22 | "@ionic-native/camera-preview": "^3.1.0",
23 | "@ionic/storage": "2.0.0",
24 | "ionic-angular": "2.2.0",
25 | "ionic-native": "2.4.1",
26 | "ionicons": "3.0.0",
27 | "rxjs": "5.0.1",
28 | "sw-toolbox": "3.4.0",
29 | "zone.js": "0.7.2"
30 | },
31 | "devDependencies": {
32 | "@ionic/app-scripts": "1.1.4",
33 | "typescript": "2.0.9"
34 | },
35 | "cordovaPlugins": [
36 | "cordova-plugin-whitelist",
37 | "cordova-plugin-console",
38 | "ionic-plugin-keyboard",
39 | "cordova-plugin-statusbar",
40 | "cordova-plugin-device",
41 | "cordova-plugin-splashscreen"
42 | ],
43 | "cordovaPlatforms": [],
44 | "description": "Ionic-2-camera-preview: An Ionic project"
45 | }
46 |
--------------------------------------------------------------------------------
/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | SAMPLE CAMERA
4 | An Teamclouders Simple Project to help others Developer to work fast.
5 | Ghayyas Mubashir
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/theme/variables.scss:
--------------------------------------------------------------------------------
1 | // Ionic Variables and Theming. For more info, please see:
2 | // http://ionicframework.com/docs/v2/theming/
3 | $font-path: "../assets/fonts";
4 |
5 | @import "ionic.globals";
6 |
7 |
8 | // Shared Variables
9 | // --------------------------------------------------
10 | // To customize the look and feel of this app, you can override
11 | // the Sass variables found in Ionic's source scss files.
12 | // To view all the possible Ionic variables, see:
13 | // http://ionicframework.com/docs/v2/theming/overriding-ionic-variables/
14 |
15 |
16 |
17 |
18 | // Named Color Variables
19 | // --------------------------------------------------
20 | // Named colors makes it easy to reuse colors on various components.
21 | // It's highly recommended to change the default colors
22 | // to match your app's branding. Ionic uses a Sass map of
23 | // colors so you can add, rename and remove colors as needed.
24 | // The "primary" color is the only required color in the map.
25 |
26 | $colors: (
27 | primary: #387ef5,
28 | secondary: #32db64,
29 | danger: #f53d3d,
30 | light: #f4f4f4,
31 | dark: #222
32 | );
33 |
34 |
35 | // App iOS Variables
36 | // --------------------------------------------------
37 | // iOS only Sass variables can go here
38 |
39 |
40 |
41 |
42 | // App Material Design Variables
43 | // --------------------------------------------------
44 | // Material Design only Sass variables can go here
45 |
46 |
47 |
48 |
49 | // App Windows Variables
50 | // --------------------------------------------------
51 | // Windows only Sass variables can go here
52 |
53 |
54 |
55 |
56 | // App Theme
57 | // --------------------------------------------------
58 | // Ionic apps can have different themes applied, which can
59 | // then be future customized. This import comes last
60 | // so that the above variables are used and Ionic's
61 | // default are overridden.
62 |
63 | @import "ionic.theme.default";
64 |
65 |
66 | // Ionicons
67 | // --------------------------------------------------
68 | // The premium icon font for Ionic. For more info, please see:
69 | // http://ionicframework.com/docs/v2/ionicons/
70 |
71 | @import "ionic.ionicons";
72 |
73 |
74 | // Fonts
75 | // --------------------------------------------------
76 |
77 | @import "roboto";
78 | @import "noto-sans";
79 |
--------------------------------------------------------------------------------
/src/pages/preview/preview.ts:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * By: Ghayyas Mubashir
4 | * Date: Fri Aug 19 2016
5 | * Updated-At: Wed Mar 22 2017
6 | *
7 | */
8 |
9 |
10 |
11 | import {Component,NgZone} from "@angular/core";
12 | import {NavController} from "ionic-angular";
13 |
14 | /**
15 | *
16 | * Component
17 | *
18 | */
19 | declare var CameraPreview:any;
20 | @Component({
21 | selector: 'preview-html',
22 | templateUrl: 'preview.html'
23 | })
24 |
25 | /**
26 | *
27 | * Preview Class
28 | *
29 | */
30 |
31 |
32 | export class preview {
33 | public getWidth: number;
34 | public getHeight : number;
35 | public calcWidth : number;
36 | constructor(private nav: NavController, private zone:NgZone){
37 |
38 | this.zone.run(() => {
39 | this.getWidth = window.innerWidth;
40 |
41 | this.getHeight = window.innerHeight;
42 | });
43 | console.log('width',this.getWidth);
44 |
45 | this.calcWidth = this.getWidth - 80; // Calculate the width of device and substract 80 from device width;
46 |
47 | console.log('calc width',this.calcWidth);
48 |
49 | }
50 |
51 | /**
52 | *
53 | * Before Using Ionic Native Camera Preview Please Note...
54 | *
55 | * 1. Camera Drag Working in android (However not tested in IOS)
56 | * 2. tap Photo not working in android (However not tested in IOS)
57 | * 3. Default Camera Direction i.e Front/Back is Working (However not tested in IOS)
58 | * 4. toBack and Alpha are useless in Android (However not checking in IOS)
59 | *
60 | *
61 | * */
62 |
63 | startCamera(){
64 | // let react = {x: 40, y: 100, width: this.calcWidth ,height: 220} //Decrepted due to previous code
65 | CameraPreview.startCamera({x: 40, y: 100, width: this.calcWidth, height: 220, toBack: false, previewDrag: true, tapPhoto: true});
66 | //.startCamera(react, defaultCamera:'back',tapEnabled: true, dragEnabled: true, toBack:true, alpha:1); //Decrepeted
67 | }
68 |
69 | stopCamera(){
70 | CameraPreview.stopCamera();
71 | }
72 |
73 | takePicture(){
74 |
75 | // let size = {maxWidth: 1024, maxHeight: 640};
76 | // CameraPreview.takePicture(size); //Decrepted
77 | CameraPreview.takePicture(function(imgData){
78 | (document.getElementById('previewPicture')).src = 'data:image/jpeg;base64,' + imgData;
79 | });
80 | }
81 |
82 |
83 | SwitchCamera(){
84 | CameraPreview.switchCamera();
85 | }
86 | showCamera(){
87 | CameraPreview.show();
88 | }
89 | hideCamera(){
90 | CameraPreview.hide();
91 | }
92 |
93 |
94 | }
--------------------------------------------------------------------------------
/typings/globals/es6-shim/index.d.ts:
--------------------------------------------------------------------------------
1 | // Generated by typings
2 | // Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/9807d9b701f58be068cb07833d2b24235351d052/es6-shim/es6-shim.d.ts
3 | declare type PropertyKey = string | number | symbol;
4 |
5 | interface IteratorResult {
6 | done: boolean;
7 | value?: T;
8 | }
9 |
10 | interface IterableShim {
11 | /**
12 | * Shim for an ES6 iterable. Not intended for direct use by user code.
13 | */
14 | "_es6-shim iterator_"(): Iterator;
15 | }
16 |
17 | interface Iterator {
18 | next(value?: any): IteratorResult;
19 | return?(value?: any): IteratorResult;
20 | throw?(e?: any): IteratorResult;
21 | }
22 |
23 | interface IterableIteratorShim extends IterableShim, Iterator {
24 | /**
25 | * Shim for an ES6 iterable iterator. Not intended for direct use by user code.
26 | */
27 | "_es6-shim iterator_"(): IterableIteratorShim;
28 | }
29 |
30 | interface StringConstructor {
31 | /**
32 | * Return the String value whose elements are, in order, the elements in the List elements.
33 | * If length is 0, the empty string is returned.
34 | */
35 | fromCodePoint(...codePoints: number[]): string;
36 |
37 | /**
38 | * String.raw is intended for use as a tag function of a Tagged Template String. When called
39 | * as such the first argument will be a well formed template call site object and the rest
40 | * parameter will contain the substitution values.
41 | * @param template A well-formed template string call site representation.
42 | * @param substitutions A set of substitution values.
43 | */
44 | raw(template: TemplateStringsArray, ...substitutions: any[]): string;
45 | }
46 |
47 | interface String {
48 | /**
49 | * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
50 | * value of the UTF-16 encoded code point starting at the string element at position pos in
51 | * the String resulting from converting this object to a String.
52 | * If there is no element at that position, the result is undefined.
53 | * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
54 | */
55 | codePointAt(pos: number): number;
56 |
57 | /**
58 | * Returns true if searchString appears as a substring of the result of converting this
59 | * object to a String, at one or more positions that are
60 | * greater than or equal to position; otherwise, returns false.
61 | * @param searchString search string
62 | * @param position If position is undefined, 0 is assumed, so as to search all of the String.
63 | */
64 | includes(searchString: string, position?: number): boolean;
65 |
66 | /**
67 | * Returns true if the sequence of elements of searchString converted to a String is the
68 | * same as the corresponding elements of this object (converted to a String) starting at
69 | * endPosition – length(this). Otherwise returns false.
70 | */
71 | endsWith(searchString: string, endPosition?: number): boolean;
72 |
73 | /**
74 | * Returns a String value that is made from count copies appended together. If count is 0,
75 | * T is the empty String is returned.
76 | * @param count number of copies to append
77 | */
78 | repeat(count: number): string;
79 |
80 | /**
81 | * Returns true if the sequence of elements of searchString converted to a String is the
82 | * same as the corresponding elements of this object (converted to a String) starting at
83 | * position. Otherwise returns false.
84 | */
85 | startsWith(searchString: string, position?: number): boolean;
86 |
87 | /**
88 | * Returns an HTML anchor element and sets the name attribute to the text value
89 | * @param name
90 | */
91 | anchor(name: string): string;
92 |
93 | /** Returns a HTML element */
94 | big(): string;
95 |
96 | /** Returns a