Skip to content

Commit 1c9daed

Browse files
committed
Stretch fix [IOS]
1 parent 6b5c5fc commit 1c9daed

File tree

4 files changed

+22
-29
lines changed

4 files changed

+22
-29
lines changed

.travis.yml

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ matrix:
1010
env:
1111
- WebPack="iOS"
1212
osx_image: xcode9.2
13-
language: node_js
13+
language: node_js
1414
node_js: "6"
1515
jdk: oraclejdk8
1616
script: cd demo && npm run build.plugin && npm i && tns build ios --bundle --env.uglify
@@ -21,8 +21,8 @@ matrix:
2121
jdk: oraclejdk8
2222
before_install: nvm install 6.10.3
2323
script: cd demo && npm run build.plugin && npm i && tns build android --bundle --env.uglify --env.snapshot
24-
- stage: "Build and Test"
25-
env:
24+
- stage: "Build"
25+
env:
2626
- BuildAndroid="26"
2727
language: android
2828
os: linux
@@ -31,33 +31,15 @@ matrix:
3131
script:
3232
- cd src && npm i && npm run tsc && cd ../demo && tns build android
3333
- os: osx
34-
env:
34+
env:
3535
- BuildiOS="11"
3636
- Xcode="9.2"
3737
osx_image: xcode9.2
38-
language: node_js
39-
node_js: "6"
40-
jdk: oraclejdk8
41-
script:
42-
- cd src && npm i && npm run tsc && cd ../demo && tns build ios
43-
- os: linux
44-
language: android
45-
dist: precise
46-
sudo: required
47-
jdk: oraclejdk8
48-
before_script:
49-
- echo no | android create avd --force -n test -t android-21 -b armeabi-v7a
50-
- emulator -avd test -no-audio -no-window &
51-
- android-wait-for-emulator
52-
before_install:
53-
- nvm install 6
54-
script: cd src && npm run test.android
55-
- os: osx
5638
language: node_js
5739
node_js: "6"
5840
jdk: oraclejdk8
59-
osx_image: xcode9.2
60-
script: cd src && npm run test.ios
41+
script:
42+
- cd src && npm i && npm run tsc && cd ../demo && tns build ios
6143

6244
android:
6345
components:
@@ -72,4 +54,4 @@ android:
7254
install:
7355
- echo no | npm install -g nativescript
7456
- tns usage-reporting disable
75-
- tns error-reporting disable
57+
- tns error-reporting disable

src/image-zoom.common.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import { Property, View } from 'tns-core-modules/ui/core/view';
2+
import { Stretch } from 'tns-core-modules/ui/image/image';
23

34
export class ImageZoomBase extends View {
45
src: string;
56
zoomScale: number;
67
minZoom: number;
78
maxZoom: number;
9+
stretch: string;
810
}
911

12+
export const stretchProperty = new Property<ImageZoomBase, Stretch>({
13+
name: 'stretch'
14+
});
15+
1016
export const zoomScaleProperty = new Property<ImageZoomBase, number>({
1117
name: 'zoomScale',
1218
defaultValue: 1
@@ -27,6 +33,7 @@ export const srcProperty = new Property<ImageZoomBase, string>({
2733
});
2834

2935
srcProperty.register(ImageZoomBase);
36+
stretchProperty.register(ImageZoomBase);
3037
zoomScaleProperty.register(ImageZoomBase);
3138
minZoomScaleProperty.register(ImageZoomBase);
3239
maxZoomScaleProperty.register(ImageZoomBase);

src/image-zoom.ios.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
minZoomScaleProperty,
66
zoomScaleProperty
77
} from './image-zoom.common';
8-
import { Image } from 'tns-core-modules/ui/image';
8+
import { Image, stretchProperty, Stretch } from 'tns-core-modules/ui/image';
99
import { layout } from 'tns-core-modules/ui/core/view';
1010
import { topmost } from 'tns-core-modules/ui/frame';
1111
import * as imageSource from 'tns-core-modules/image-source';
@@ -52,6 +52,10 @@ export class ImageZoom extends ImageZoomBase {
5252
}
5353
}
5454

55+
[stretchProperty.setNative](stretch: Stretch) {
56+
this._image.stretch = stretch;
57+
}
58+
5559
[zoomScaleProperty.setNative](scale: number) {
5660
if (this.nativeView) {
5761
this.nativeView.zoomScale = scale;

src/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-image-zoom",
3-
"version": "1.0.1",
3+
"version": "1.1.0",
44
"description": "Zoom enabled ImageView for NativeScript",
55
"main": "image-zoom",
66
"typings": "index.d.ts",
@@ -33,8 +33,8 @@
3333
"iOS"
3434
],
3535
"author": {
36-
"name": "Your Name",
37-
"email": "youremail@yourdomain.com"
36+
"name": "Osei Fortune",
37+
"email": "fortune.osei@yahoo.com"
3838
},
3939
"bugs": {
4040
"url": "https://github.com/triniwiz/nativescript-image-zoom/issues"

0 commit comments

Comments
 (0)