✅ This repository is test repository, and not release @nativescript-community/capacitor-plugins now.
Please clone, and npm link in your local.
% git clone git@github.com:nativescript-community/capacitor-plugins.git
% cd capacitor-plugins && npm install
% npm link
% npm install @capacitor/cli@next --save-dev
% npm install @capacitor/core@next --save
% npm install @nativescript/capacitor
% npm install --save @nativescript-community/capacitor-plugins
Add the following code:
import '@nativescript/capacitor/bridge';
+ import * as Plugins from '@nativescript-community/capacitor-plugins';
+ native = Object.assign(native, Plugins);
...
Replace the following code:
+ import type { pluginsGlobal } from '@nativescript-community/capacitor-plugins/src/interfaces';
declare module '@nativescript/capacitor' {
export interface customNativeAPI extends nativeCustom {}
}
/**
* Define your own custom strongly typed native helpers here.
*/
- export interface nativeCustom {
+ export interface nativeCustom extends pluginsGlobal {
You can change device brightness (1〜10). This is official example code.
import { native } from '@nativescript/capacitor';
native.brightness(1);
You can allow users to rate the app from inside the application.
No additional configurations are required for iOS. However, for now it supports iOS version 10.3 and later.
Before start using this function add next lines to the dependencies
section of your android/app/build.gradle
implementation "androidx.appcompat:appcompat:1.2.0"
implementation 'com.google.android.play:core:1.10.0'
You can read more about how to import Google Play Core Library into your project here
In-app reviews only work on Android devices (phones and tablets) running Android 5.0 (API level 21) or higher that have the Google Play Store installed and on Chrome OS devices that have the Google Play Store installed.
Important: your app should be published for at least internal testing. Read more about it in this SO answer
import { native } from '@nativescript/capacitor';
native.rateMyApp();
You can check Native Console Log. This is official example code.
import { native } from '@nativescript/capacitor';
native.dreamBig();
And Launch Native Modal View. This is official example code.
import { native } from '@nativescript/capacitor';
native.openNativeModalView();
You should select plugin and import.
src/nativescript/index.ts
:
import { brightness } from '@nativescript-community/capacitor-plugins';
native = Object.assign(native, {
brightness,
});
src/native-custom.d.ts
:
import type { IBrightness } from '@nativescript-community/capacitor-plugins/src/interfaces';
export interface nativeCustom extends IBrightness {
dreamBig: () => NativeProperty<string>;
openNativeModalView: () => void;
}
Thanks goes to these wonderful people (emoji key):
Sergey Mell 💻 |