Skip to content

Commit 994bbe5

Browse files
committed
Merge branch 'master' of github.com:nativescript-community/ui-lottie
2 parents c8e6963 + e0457f2 commit 994bbe5

File tree

13 files changed

+96
-30
lines changed

13 files changed

+96
-30
lines changed

README.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,21 @@ public yourLoadedEvent(args) {
6969

7070
### NativeScript Angular
7171

72+
#### Module
73+
74+
First you need to include the `NativeScriptLottieModule` in your `app.module.ts`
75+
76+
```typescript
77+
import { NativeScriptLottieModule} from '@nativescript-community/ui-lottie/angular';
78+
79+
@NgModule({
80+
imports: [
81+
NativeScriptLottieModule
82+
],
83+
...
84+
})
85+
```
86+
7287
#### XML
7388

7489
```xml
@@ -81,11 +96,8 @@ public yourLoadedEvent(args) {
8196

8297
```typescript
8398
import { Component } from '@angular/core';
84-
import { registerElement } from 'nativescript-angular';
8599
import { LottieView } from '@nativescript-community/ui-lottie';
86100

87-
registerElement('LottieView', () => LottieView);
88-
89101
@Component({
90102
templateUrl: 'home.component.html',
91103
moduleId: module.id
@@ -118,15 +130,18 @@ export class HomeComponent {
118130

119131
## NativeScript Vue
120132

121-
### Bootstrap (probably in app.js)
133+
### Bootstrap
122134

123-
```typescript
124-
Vue.registerElement(
125-
'LottieView',
126-
() => require('@nativescript-community/ui-lottie').LottieView
127-
);
135+
If you want to use this plugin with Vue, do this in your `app.js` or `main.js`:
136+
137+
```javascript
138+
import LottieView from '@nativescript-community/ui-lottie/vue';
139+
140+
Vue.use(LottieView);
128141
```
129142

143+
This will install and register `LottieView` component to your `Vue` instance and now you can use the plugin.
144+
130145
### Component
131146

132147
```xml

demo-angular/App_Resources/Android/app.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
// implementation 'com.android.support:recyclerview-v7:+'
66
//}
77

8-
android {
9-
defaultConfig {
8+
android {
9+
defaultConfig {
1010
generatedDensities = []
11-
}
12-
aaptOptions {
13-
additionalParameters "--no-version-vectors"
14-
}
15-
}
11+
}
12+
aaptOptions {
13+
additionalParameters "--no-version-vectors"
14+
}
15+
}

demo-angular/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"nativescript": {
77
"id": "org.nativescript.demotemp",
88
"tns-android": {
9-
"version": "6.0.0"
9+
"version": "6.5.0"
1010
}
1111
},
1212
"dependencies": {
@@ -24,8 +24,8 @@
2424
"nativescript-theme-core": "~1.0.4",
2525
"reflect-metadata": "~0.1.8",
2626
"rxjs": "~6.4.0",
27-
"@nativescript/core": "6.0.1",
28-
"zone.js": "0.9.1"
27+
"@nativescript/core": "6.5.0",
28+
"zone.js": "0.10.2"
2929
},
3030
"devDependencies": {
3131
"jasmine-core": "3.3.0",

demo-angular/src/app/app.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import {
22
NgModule,
3-
NgModuleFactoryLoader,
43
NO_ERRORS_SCHEMA
54
} from '@angular/core';
65
import { NativeScriptModule } from 'nativescript-angular/nativescript.module';
6+
import { NativeScriptLottieModule } from '@nativescript-community/ui-lottie/angular';
77
import { AppRoutingModule } from './app-routing.module';
88
import { AppComponent } from './app.component';
99
import { HomeModule } from './home/home.module';
1010

1111
@NgModule({
1212
bootstrap: [AppComponent],
13-
imports: [NativeScriptModule, AppRoutingModule, HomeModule],
13+
imports: [NativeScriptModule, NativeScriptLottieModule, AppRoutingModule, HomeModule],
1414
declarations: [AppComponent],
1515
schemas: [NO_ERRORS_SCHEMA]
1616
})

demo-angular/src/app/home/home.component.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { Component } from '@angular/core';
2-
import { registerElement } from 'nativescript-angular';
32
import { LottieView } from '@nativescript-community/ui-lottie';
43
import { Color } from '@nativescript/core/color';
54

6-
registerElement('LottieView', () => LottieView);
7-
85
const ANDROID_WAVE_KEYPATHS = [
96
['Shirt', 'Group 5', 'Fill 1'],
107
['LeftArmWave', 'LeftArm', 'Group 6', 'Fill 1'],

demo-vue/app/app.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import Vue from 'nativescript-vue';
2+
import LottieView from '@nativescript-community/ui-lottie/vue';
23

34
import Home from './components/Home.vue';
45

5-
// register LottieView component for the plugin
6-
Vue.registerElement(
7-
'lottie-view',
8-
() => require('@nativescript-community/ui-lottie').LottieView
9-
);
6+
Vue.use(LottieView);
107

118
new Vue({
129
template: `

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@
7979
"precommit": "lint-staged"
8080
},
8181
"devDependencies": {
82+
"@angular/core": "^13.1.3",
8283
"@commitlint/cli": "^13.2.1",
8384
"@commitlint/config-conventional": "^13.2.0",
85+
"@nativescript/angular": "^13.0.1",
8486
"@nativescript/core": "8.1.5",
8587
"@nativescript/types-android": "8.1.0",
8688
"@nativescript/types-ios": "8.1.1",
@@ -104,4 +106,4 @@
104106
"dependencies": {
105107
"ts-node": "^10.4.0"
106108
}
107-
}
109+
}

plugin/angular/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export declare class LottieViewDirective {
2+
}
3+
export declare class NativeScriptLottieModule {
4+
}

plugin/vue/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare const _default: {
2+
install(Vue: any): void;
3+
};
4+
export default _default;

src/angular/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Directive, NgModule } from '@angular/core';
2+
import { registerElement } from '@nativescript/angular';
3+
import { LottieView } from '..';
4+
5+
@Directive({ selector: 'LottieView' })
6+
export class LottieViewDirective {}
7+
8+
@NgModule({
9+
declarations: [LottieViewDirective],
10+
exports: [LottieViewDirective]
11+
})
12+
export class NativeScriptLottieModule {}
13+
14+
registerElement('LottieView', () => LottieView);

0 commit comments

Comments
 (0)