nativescript-lottie
Advanced tools
Comparing version 5.0.2 to 5.0.3
@@ -29,11 +29,22 @@ import { knownFolders, path, Utils } from '@nativescript/core'; | ||
} | ||
else { | ||
if (src[0] === '~') { | ||
src = `${path.join(appPath, src.substring(2))}`; | ||
} | ||
else if (src[0] === '~') { | ||
src = `${path.join(appPath, src.substring(2))}`; | ||
if (!/.(json|zip)$/.test(src)) { | ||
src += '.json'; | ||
} | ||
this.nativeView.compatibleAnimation = CompatibleAnimation.alloc().initWithFilepath(src); | ||
try { | ||
this.nativeView.compatibleAnimation = CompatibleAnimation.alloc().initWithFilepath(src); | ||
} | ||
catch (error) { | ||
console.log(`Error initializing LottieView with src: ${src}`, error); | ||
} | ||
} | ||
else { | ||
try { | ||
this.nativeView.compatibleAnimation = CompatibleAnimation.alloc().initWithNameBundle(src, NSBundle.mainBundle); | ||
} | ||
catch (error) { | ||
console.log(`Error trying to set the iOS Lottie animation to LottieView with src: ${src}`, error); | ||
} | ||
} | ||
} | ||
@@ -72,14 +83,16 @@ [loopProperty.setNative](loop) { | ||
playAnimation() { | ||
if (this.nativeView) { | ||
if (this.completionBlock) { | ||
this.nativeView.playWithCompletion((animationFinished) => { | ||
if (this.completionBlock) { | ||
this.completionBlock(animationFinished); | ||
} | ||
}); | ||
setTimeout(() => { | ||
if (this.nativeView) { | ||
if (this.completionBlock) { | ||
this.nativeView.playWithCompletion((animationFinished) => { | ||
if (this.completionBlock) { | ||
this.completionBlock(animationFinished); | ||
} | ||
}); | ||
} | ||
else { | ||
this.nativeView.play(); | ||
} | ||
} | ||
else { | ||
this.nativeView.play(); | ||
} | ||
} | ||
}, 0); | ||
} | ||
@@ -86,0 +99,0 @@ playAnimationFromProgressToProgress(startProgress, endProgress) { |
{ | ||
"name": "nativescript-lottie", | ||
"version": "5.0.2", | ||
"version": "5.0.3", | ||
"description": "NativeScript plugin to expose AirBnB Lottie library", | ||
@@ -39,6 +39,10 @@ "main": "lottie", | ||
"build": "npm i && tsc", | ||
"tslint": "cd .. && tslint \"**/*.ts\" --config tslint.json --exclude \"**/node_modules/**\" --exclude \"*demo*/platforms/**\" --exclude \"**/typings/**\"", | ||
"tslint": "cd .. && tslint \"**/*.ts\" --config tslint.json --exclude \"**/node_modules/**\" --exclude \"*demo*/platforms/**\" --exclude \"*demo*/app/**\" --exclude \"**/typings/**\"", | ||
"ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**'", | ||
"demo.ios": "npm run setup && cd ../demo && tns run ios", | ||
"demo.android": "npm run setup && cd ../demo && tns run android", | ||
"demo.ng.ios": "npm run setup && cd ../demo-angular && tns run ios", | ||
"demo.ng.android": "npm run setup && cd ../demo-angular && tns run android", | ||
"demo.vue.ios": "npm run setup && cd ../demo-vue && tns run ios", | ||
"demo.vue.android": "npm run setup && cd ../demo-vue && tns run android", | ||
"setup": "npm i && tsc", | ||
@@ -45,0 +49,0 @@ "generate.typings.ios": "cd ../demo && TNS_DEBUG_METADATA_PATH=\"$(pwd)/metadata\" tns build ios && TNS_TYPESCRIPT_DECLARATIONS_PATH=\"$(pwd)/typings\" tns build ios && echo 'Now look for your library typings in demo/typings!'", |
@@ -212,1 +212,9 @@ <a align="center" href="https://www.npmjs.com/package/nativescript-lottie"> | ||
| [itstheceo](https://github.com/itstheceo) | [mudlabs](https://github.com/mudlabs) | | ||
## Contributing | ||
1. Fork and clone the repository | ||
2. `cd nativescript-lottie && npm run demo.android` (or demo.ios) | ||
3. Changes in the `src` directory of the plugin will sync to the demo app for testing changes. | ||
4. Create a PR with proposed changes. |
29818
483
219