Skip to content

Commit

Permalink
Stretch fix [IOS]
Browse files Browse the repository at this point in the history
  • Loading branch information
triniwiz committed Jan 4, 2018
1 parent 6b5c5fc commit 1c9daed
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 29 deletions.
32 changes: 7 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -72,4 +54,4 @@ android:
install:
- echo no | npm install -g nativescript
- tns usage-reporting disable
- tns error-reporting disable
- tns error-reporting disable
7 changes: 7 additions & 0 deletions src/image-zoom.common.ts
Original file line number Diff line number Diff line change
@@ -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<ImageZoomBase, Stretch>({
name: 'stretch'
});

export const zoomScaleProperty = new Property<ImageZoomBase, number>({
name: 'zoomScale',
defaultValue: 1
Expand All @@ -27,6 +33,7 @@ export const srcProperty = new Property<ImageZoomBase, string>({
});

srcProperty.register(ImageZoomBase);
stretchProperty.register(ImageZoomBase);
zoomScaleProperty.register(ImageZoomBase);
minZoomScaleProperty.register(ImageZoomBase);
maxZoomScaleProperty.register(ImageZoomBase);
6 changes: 5 additions & 1 deletion src/image-zoom.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 1c9daed

Please sign in to comment.