Skip to content

Commit 749210e

Browse files
committed
fix: update deps and support dotLottie files
1 parent 50fe9a0 commit 749210e

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11

22
dependencies {
3-
def androidXAppCompat = project.hasProperty("androidXAppCompat") ? project.androidXAppCompat : "1.1.0"
4-
implementation("androidx.appcompat:appcompat:$androidXAppCompat") {
5-
exclude group: 'androidx.fragment'
6-
}
7-
def lottieVersion = project.hasProperty("lottieVersion") ? project.lottieVersion : "3.+"
3+
def lottieVersion = project.hasProperty("lottieVersion") ? project.lottieVersion : "4.1.+"
84
implementation "com.airbnb.android:lottie:$lottieVersion"
95
}

src/lottie.android.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,20 +132,20 @@ export class LottieView extends LottieViewBase {
132132
if (!src) {
133133
this.nativeView.setAnimation(null);
134134
} else if (src[0] === '{') {
135-
this.nativeView.setAnimationFromJson(src);
135+
this.nativeView.setAnimationFromJson(src, null);
136136
} else if (src.startsWith(RESOURCE_PREFIX)) {
137137
const resName = src.replace(RESOURCE_PREFIX, '');
138138
this.nativeView.setAnimation(resName);
139139
} else {
140-
if (src[0] === '~') {
141-
src = `${path.join(appPath, src.substring(2))}`;
142-
}
143-
if (!/.(json|zip)$/.test(src)) {
140+
if (!/.(json|zip|lottie)$/.test(src)) {
144141
src += '.json';
145142
}
146-
143+
if (src[0] === '~') {
144+
this.nativeView.setAnimation('app/' + src.substring(2));
145+
return;
146+
}
147147
loadLottieJSON(src).then((r) => {
148-
this.nativeView.setAnimationFromJson(r);
148+
this.nativeView.setAnimationFromJson(r, null);
149149
});
150150
}
151151

src/lottie.ios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export class LottieView extends LottieViewBase {
4949
if (src[0] === '~') {
5050
src = `${path.join(appPath, src.substring(2))}`;
5151
}
52-
if (!/.(json|zip)$/.test(src)) {
52+
if (!/.(json|zip|lottie)$/.test(src)) {
5353
src += '.json';
5454
}
5555
this.nativeView.compatibleAnimation = CompatibleAnimation.alloc().initWithFilepath(src);

0 commit comments

Comments
 (0)