diff --git a/.travis.yml b/.travis.yml index 9ec790b..76f4903 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ matrix: env: - WebPack="iOS" osx_image: xcode9.2 - language: node_js + language: node_js node_js: "6" jdk: oraclejdk8 script: cd demo && npm run build.plugin && npm i && tns build ios --bundle --env.uglify @@ -21,8 +21,8 @@ matrix: jdk: oraclejdk8 before_install: nvm install 6.10.3 script: cd demo && npm run build.plugin && npm i && tns build android --bundle --env.uglify --env.snapshot - - stage: "Build and Test" - env: + - stage: "Build" + env: - BuildAndroid="26" language: android os: linux @@ -31,33 +31,15 @@ matrix: script: - cd src && npm i && npm run tsc && cd ../demo && tns build android - os: osx - env: + env: - BuildiOS="11" - Xcode="9.2" osx_image: xcode9.2 - language: node_js - node_js: "6" - jdk: oraclejdk8 - script: - - cd src && npm i && npm run tsc && cd ../demo && tns build ios - - os: linux - language: android - dist: precise - sudo: required - jdk: oraclejdk8 - before_script: - - echo no | android create avd --force -n test -t android-21 -b armeabi-v7a - - emulator -avd test -no-audio -no-window & - - android-wait-for-emulator - before_install: - - nvm install 6 - script: cd src && npm run test.android - - os: osx language: node_js node_js: "6" jdk: oraclejdk8 - osx_image: xcode9.2 - script: cd src && npm run test.ios + script: + - cd src && npm i && npm run tsc && cd ../demo && tns build ios android: components: @@ -72,4 +54,4 @@ android: install: - echo no | npm install -g nativescript - tns usage-reporting disable - - tns error-reporting disable \ No newline at end of file + - tns error-reporting disable diff --git a/src/image-zoom.common.ts b/src/image-zoom.common.ts index 6c8e5dc..713f44b 100644 --- a/src/image-zoom.common.ts +++ b/src/image-zoom.common.ts @@ -1,12 +1,18 @@ import { Property, View } from 'tns-core-modules/ui/core/view'; +import { Stretch } from 'tns-core-modules/ui/image/image'; export class ImageZoomBase extends View { src: string; zoomScale: number; minZoom: number; maxZoom: number; + stretch: string; } +export const stretchProperty = new Property({ + name: 'stretch' +}); + export const zoomScaleProperty = new Property({ name: 'zoomScale', defaultValue: 1 @@ -27,6 +33,7 @@ export const srcProperty = new Property({ }); srcProperty.register(ImageZoomBase); +stretchProperty.register(ImageZoomBase); zoomScaleProperty.register(ImageZoomBase); minZoomScaleProperty.register(ImageZoomBase); maxZoomScaleProperty.register(ImageZoomBase); diff --git a/src/image-zoom.ios.ts b/src/image-zoom.ios.ts index 8db4908..4bb93d5 100644 --- a/src/image-zoom.ios.ts +++ b/src/image-zoom.ios.ts @@ -5,7 +5,7 @@ import { minZoomScaleProperty, zoomScaleProperty } from './image-zoom.common'; -import { Image } from 'tns-core-modules/ui/image'; +import { Image, stretchProperty, Stretch } from 'tns-core-modules/ui/image'; import { layout } from 'tns-core-modules/ui/core/view'; import { topmost } from 'tns-core-modules/ui/frame'; import * as imageSource from 'tns-core-modules/image-source'; @@ -52,6 +52,10 @@ export class ImageZoom extends ImageZoomBase { } } + [stretchProperty.setNative](stretch: Stretch) { + this._image.stretch = stretch; + } + [zoomScaleProperty.setNative](scale: number) { if (this.nativeView) { this.nativeView.zoomScale = scale; diff --git a/src/package.json b/src/package.json index 9aa1402..ddd169e 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-image-zoom", - "version": "1.0.1", + "version": "1.1.0", "description": "Zoom enabled ImageView for NativeScript", "main": "image-zoom", "typings": "index.d.ts", @@ -33,8 +33,8 @@ "iOS" ], "author": { - "name": "Your Name", - "email": "youremail@yourdomain.com" + "name": "Osei Fortune", + "email": "fortune.osei@yahoo.com" }, "bugs": { "url": "https://github.com/triniwiz/nativescript-image-zoom/issues"