Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
bradmartin committed Dec 12, 2018
1 parent b543d21 commit 88d0b19
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 19 deletions.
10 changes: 8 additions & 2 deletions src/nativescript-lottie.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,15 @@ export class LottieView extends LottieViewBase {

if (value && value.length) {
value.forEach(dynamicValue => {
const callBack = LottieHelper.getIntCallback(new Color(dynamicValue.value).android);
const callBack = LottieHelper.getIntCallback(
new Color(dynamicValue.value).android
);
const keyPath = LottieHelper.keyPath(dynamicValue.keyPath);
this.nativeView.addValueCallback(keyPath, LottieProperty.COLOR, callBack);
this.nativeView.addValueCallback(
keyPath,
LottieProperty.COLOR,
callBack
);
});
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/nativescript-lottie.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ export const autoPlayProperty = new Property<LottieViewBase, boolean>({

autoPlayProperty.register(LottieViewBase);

export const cacheStrategyProperty = new Property<LottieViewBase, CacheStrategy>({
export const cacheStrategyProperty = new Property<
LottieViewBase,
CacheStrategy
>({
name: 'cacheStrategy'
});

Expand Down
44 changes: 28 additions & 16 deletions src/nativescript-lottie.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ export class LottieView extends LottieViewBase {
}

if (this.autoPlay) {
this.playAnimation().then(finished => {
// ignore
// TODO: could add debug mode which would log that it finished
}, err => {
// ignore (however note todo above)
});
this.playAnimation().then(
finished => {
// ignore
// TODO: could add debug mode which would log that it finished
},
err => {
// ignore (however note todo above)
}
);
}
}

Expand All @@ -94,12 +97,15 @@ export class LottieView extends LottieViewBase {
this.contentModeDefault();

if (!this.isAnimating()) {
this.playAnimation().then(finished => {
// ignore
// TODO: could add debug mode which would log that it finished
}, err => {
// ignore (however note todo above)
});
this.playAnimation().then(
finished => {
// ignore
// TODO: could add debug mode which would log that it finished
},
err => {
// ignore (however note todo above)
}
);
}
} else {
if (this.isAnimating()) {
Expand All @@ -121,9 +127,13 @@ export class LottieView extends LottieViewBase {

if (value && value.length) {
value.forEach(dynamicValue => {
const callBack = LOTColorValueCallback.withCGColor(new Color(dynamicValue.value).ios.CGColor);
const callBack = LOTColorValueCallback.withCGColor(
new Color(dynamicValue.value).ios.CGColor
);
dynamicValue.keyPath.push('Color');
const keyPath = LOTKeypath.keypathWithString(dynamicValue.keyPath.join('.'));
const keyPath = LOTKeypath.keypathWithString(
dynamicValue.keyPath.join('.')
);
this._animationView.setValueDelegateForKeypath(callBack, keyPath);
});
}
Expand All @@ -141,8 +151,10 @@ export class LottieView extends LottieViewBase {
const measuredHeight = layout.getMeasureSpecSize(heightMeasureSpec);

const scale = screen.mainScreen.scale;
const width = typeof this.width === 'number' ? this.width : measuredWidth / scale;
const height = typeof this.height === 'number' ? this.height : measuredHeight / scale;
const width =
typeof this.width === 'number' ? this.width : measuredWidth / scale;
const height =
typeof this.height === 'number' ? this.height : measuredHeight / scale;
this.setMeasuredDimension(measuredWidth, measuredHeight);
if (this._animationView) {
const newFrame = CGRectMake(0, 0, width, height);
Expand Down

0 comments on commit 88d0b19

Please sign in to comment.