You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d4dc1d6
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: src/pages/native/community.md
+76-5Lines changed: 76 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,29 +5,57 @@ tableOfContents: false
5
5
6
6
Community Plugins are a collection of open source Cordova plugins that make it easy to add native functionality to any Ionic app.
7
7
8
-
Community Plugins are submitted and maintained by the Ionic community. While community members are generally quick to find and fix issues, certain plugins may not function properly. For teams that require dedicated native plugin support, please explore Ionic Native and request a free trial.
8
+
Community Plugins are submitted and maintained by the Ionic community. While community members are generally quick to find and fix issues, certain plugins may not function properly. For teams that require dedicated native plugin support, please explore Ionic Native then [request a free trial](https://ionicframework.com/enterprise/contact).
9
9
10
10
> Note: These docs are for apps built with Ionic Framework 4.0.0 and greater. For older Ionic v3 projects, please [see here](/docs/v3/native).
11
11
12
12
## Capacitor Support
13
13
14
-
Ionic Native also works with [Capacitor](https://capacitor.ionicframework.com), Ionic's official native runtime. For details, [see the Capacitor documentation](https://capacitor.ionicframework.com/docs/cordova/using-cordova-plugins).
14
+
In addition to Cordova, Ionic Native also works with [Capacitor](https://capacitor.ionicframework.com), Ionic's official native runtime. Basic usage below. For complete details, [see the Capacitor documentation](https://capacitor.ionicframework.com/docs/cordova/using-cordova-plugins).
15
15
16
16
## Usage
17
17
All plugins have two components - the native code (Cordova) and the TypeScript code (Ionic Native).
18
18
Cordova plugins are also wrapped in a `Promise` or `Observable` in order to provide a common plugin interface and modernized development approach.
19
19
20
20
Using the [Camera plugin](/docs/native/camera) as an example, first install it:
21
21
22
+
<docs-tabs>
23
+
<docs-tabtab="Cordova">
24
+
22
25
```shell
26
+
// Install Cordova plugin
23
27
$ ionic cordova plugin add cordova-plugin-camera
28
+
29
+
// Install Ionic Native TypeScript wrapper
24
30
$ npm install @ionic-native/camera
31
+
32
+
// Install Ionic Native core library (once per project)
33
+
$ npm install @ionic-native/core
25
34
```
26
35
27
-
Next, begin using the plugin, using the various framework usage options below. For FAQ, see [here](/docs/native/faq).
36
+
</docs-tab>
37
+
<docs-tabtab="Capacitor">
38
+
39
+
For complete details, [see the Capacitor documentation](https://capacitor.ionicframework.com/docs/cordova/using-cordova-plugins).
40
+
41
+
```shell
42
+
// Install Ionic Native TypeScript wrapper
43
+
$ npm install @ionic-native/camera
44
+
45
+
// Install Cordova plugin
46
+
$ npm install cordova-plugin-camera
47
+
48
+
// Update native platform project(s) to include newly added plugin
49
+
$ ionic cap sync
50
+
```
51
+
52
+
</docs-tab>
53
+
</docs-tabs>
54
+
55
+
Next, begin using the plugin, following the various framework usage options below. For FAQ, see [here](/docs/native/faq).
28
56
29
57
## Angular
30
-
Import the plugin in a `@NgModule` and add it to the list of Providers. For Angular, the import path should end with `/ngx`. Angular's change detection is automatically handled.
58
+
Angular apps can use either Cordova or Capacitor to build native mobile apps. Import the plugin in a `@NgModule` and add it to the list of Providers. For Angular, the import path should end with `/ngx`. Angular's change detection is automatically handled.
31
59
32
60
```typescript
33
61
// app.module.ts
@@ -80,8 +108,51 @@ export class PhotoService {
80
108
}
81
109
```
82
110
111
+
## React
112
+
113
+
React apps must use Capacitor to build native mobile apps. However, Ionic Native (and therefore, Cordova plugins) can still be used.
114
+
115
+
<command-line>
116
+
<div>// Install Core library (once per project)</div>
Ionic Native can also be used in a vanilla JavaScript app targeting ES2015+ and/or TypeScript. To use any plugin, import the class from the appropriate package and use its static methods:
155
+
Vanilla JavaScript apps, targeting ES2015+ and/or TypeScript, can use either Cordova or Capacitor to build native mobile apps. To use any plugin, import the class from the appropriate package and use its static methods:
0 commit comments