11# @nativescript/iqkeyboardmanager
22
33## Contents
4- * [ Intro] ( #intro )
5- * [ Installation] ( #installation )
6- * [ Use @nativescript/iqkeyboardmanager ] ( #use-nativescriptiqkeyboardmanager )
7- * [Core](#core)
8- * [Angular](#angular)
9- * [Vue](#vue)
10- * [Svelte](#svelte)
11- * [React](#react)
12- * [Adding a hint text to the TextView accessory bar](#adding-a-hint-text-to-the-textview-accessory-bar)
13- * [Core](#core-1)
14- * [Angular](#angular-1)
15- * [Vue](#vue-1)
16- * [Svelte](#svelte-1)
17- * [Demo app](#demo-apps)
18- * [Tweaking the appearance and behavior](#tweaking-the-appearance-and-behavior)
19- * [Multi-factor one-time code auto-fill](#multi-factor-one-time-code-auto-fill)
20- * [ Native documentation] ( #native-documentation )
21- * [ Maintainers] ( #maintainers )
22- * [ License] ( #license )
4+ - [ @nativescript/iqkeyboardmanager ] ( #nativescriptiqkeyboardmanager )
5+ - [Contents](#contents)
6+ - [Intro](#intro)
7+ - [Installation](#installation)
8+ - [Use @nativescript/iqkeyboardmanager](#use-nativescriptiqkeyboardmanager)
9+ - [Adding a hint text to the TextView accessory bar](#adding-a-hint-text-to-the-textview-accessory-bar)
10+ - [Core](#core)
11+ - [Angular](#angular)
12+ - [Vue](#vue)
13+ - [Svelte](#svelte)
14+ - [React](#react)
15+ - [Tweaking the appearance and behavior](#tweaking-the-appearance-and-behavior)
16+ - [Multi-factor one-time code auto-fill](#multi-factor-one-time-code-auto-fill)
17+ - [Native documentation](#native-documentation)
18+ - [Maintainers](#maintainers)
19+ - [License](#license)
2320
2421## Intro
2522
@@ -43,107 +40,20 @@ The following sections describe how to use the `@nativescript/iqkeyboardmanager`
4340> ** Note** Make related text fields siblings for the IQKeyboardManager to automatically
4441 add the `previous`(`<`) and `next`(`> `) buttons to the accessory bar. The user can then use those buttons to jump back and forth.
4542
46- ### Core
47- 1 . Register the plugin namespace with Page's ` xmlns ` attribute under a prefix( ` IQKeyboardManager ` for example) that you can use to access the ` PreviousNextView ` .
48-
49- ``` xml
50- <Page xmlns : IQKeyboardManager =" @nativescript-iqkeyboardmanager" >
51- ```
52- 2 . Access the ` PreviousNextView ` using the prefix.
53-
54- ``` xml
55- <IQKeyboardManager : PreviousNextView ><!-- add this 'wrapper' to enable those previous / next buttons -->
56- <StackLayout >
57- <TextField hint =" Email" />
58- <TextField hint =" Password" />
59- </StackLayout >
60- </IQKeyboardManager : PreviousNextView >
6143```
62- The 2 preceding steps result in the code below:
63-
64- ``` xml
65- <Page xmlns =" http://schemas.nativescript.org/tns.xsd" xmlns : IQKeyboardManager =" @nativescript-iqkeyboardmanager" >
66- <ScrollView >
67- <IQKeyboardManager .PreviousNextView><!-- add this 'wrapper' to enable those previous / next buttons -->
68- <StackLayout >
69- <TextField hint =" Email" />
70- <TextField hint =" Password" />
71- </StackLayout >
72- </IQKeyboardManager : PreviousNextView >
73- </ScrollView >
74- </Page >
44+ IQKeyboardToolbarManager.shared.isEnabled = true
7545```
7646
77- ### Angular
78-
79- 1 . Register the ` PreviousNextView ` element in the ` .modules.ts ` file where you want to use this feature (or the ` app.module.ts ` for global access).
80-
81- ``` ts
82- import { registerElement } from ' @nativescript/angular' ;
83- import { PreviousNextView } from ' @nativescript/iqkeyboardmanager' ;
84- registerElement (' PreviousNextView' , () => PreviousNextView );
85- ```
86-
87- 2 . Add ` PreviousNextView ` to the markup as follows:
88-
89- ``` html
90- <ScrollView >
91- <PreviousNextView
92- ><!-- add this 'wrapper' to enable those previous / next buttons -->
93- <StackLayout >
94- <TextField hint =" Email" ></TextField >
95- <TextField hint =" Password" ></TextField >
96- </StackLayout >
97- </PreviousNextView >
98- </ScrollView >
99- ```
100-
101- ### Vue
102-
103- 1 . Register ` PreviousNextView ` by adding the following code to the ` app.ts ` file.
104-
105- ``` ts
106- registerElement (' PreviousNextView' , () => require (' @nativescript/iqkeyboardmanager' ).PreviousNextView );
107- ```
108- 2 . Use ` PreviousNextView ` in markup.
109-
110- ``` xml
111- <ScrollView >
112- <PreviousNextView
113- ><!-- add this 'wrapper' to enable those previous / next buttons -->
114- <StackLayout >
115- <TextField hint =" Email" ></TextField >
116- <TextField hint =" Password" ></TextField >
117- </StackLayout >
118- </PreviousNextView >
119- </ScrollView >
120- ```
121-
122- ### Svelte
123-
124- 1 . Register ` PreviousNextView ` by adding the following code to the ` app.ts ` file.
125-
126- ``` ts
127- registerNativeViewElement (' previousNextView' , () => require (' @nativescript/iqkeyboardmanager' ).PreviousNextView );
128- ```
129- 2 . Add ` previousNextView ` to markup.
130-
131- ``` xml
132- <previousNextView ><!-- add this 'wrapper' to enable those previous / next buttons -->
133- <stackLayout >
134- <textField hint =" Email" />
135- <textField hint =" Password" />
136- </stackLayout >
137- </previousNextView >
138- ```
139- For a demo app, visit [ NativeScript Svelte: IQ Keyboard Manager] ( https://stackblitz.com/edit/nativescript-stackblitz-templates-rygnsk?file=app/components/Home.svelte ) .
140-
14147### Adding a hint text to the TextView accessory bar
14248
14349By default, when a ` TextField ` is focused, the keyboard manager shows the field's hint label in the accessory bar above the keyboard.
14450
14551For a ` TextView ` , however, use the ` TextViewWithHint ` component,
146- provided by this plugin, to add the hint label to the accessory bar.
52+ provided by this plugin, to add the hint label to the accessory bar. Be sure to enable the toolbar:
53+
54+ ``` ts
55+ IQKeyboardToolbarManager .shared .enableAutoToolbar = true ;
56+ ```
14757
14858#### Core
14959
@@ -233,40 +143,34 @@ registerElement("textViewWithHint", ()=> require("@nativescript/iqkeyboardmanage
233143 </stackLayout >
234144</previousNextView >
235145```
236- ### Demo apps
237-
238- The following are links to the plugin demo apps in the different JS flavors.
239-
240- * [ NativeScript TS: IQ Keyboard Manager] ( https://stackblitz.com/edit/nativescript-stackblitz-templates-sia8th?file=app/main-page.xml ) .
241- * [ NativeScript Svelte: IQ Keyboard Manager] ( https://stackblitz.com/edit/nativescript-stackblitz-templates-rygnsk?file=app/components/Home.svelte )
242- * [ NativeScript React: IQ Keyboard Manager] ( https://stackblitz.com/edit/nativescript-stackblitz-templates-5uygfj?file=src/components/ScreenOne.tsx )
243146
244147
245148### Tweaking the appearance and behavior
246149
247- To tweak the appearance and behavior of ` PreviousNextView ` , follow the steps below:
248-
2491501 . Add the following path to your app’s ` references.d.ts ` file.
250151
251152``` xml
252- /// <reference path =" ./node_modules/@nativescript/iqkeyboardmanager/index.d.ts" />
153+ /// <reference path =" ./node_modules/@nativescript/iqkeyboardmanager/typings/ index.d.ts" />
253154```
254155
2551562 . Initialize an instance of ` IQKeyboardManager ` as follows.
256157
257158``` typescript
258- const iqKeyboard = IQKeyboardManager .sharedManager () ;
159+ const iqKeyboard = IQKeyboardManager .shared ;
259160```
260161
261162You now have the full IQKeyboardManager APIs available for you to use. For example, to switch to a dark keyboard you could use the following code.
262163
263164``` typescript
264- const iqKeyboard = IQKeyboardManager .sharedManager ();
265- iqKeyboard .overrideKeyboardAppearance = true ;
266- iqKeyboard .keyboardAppearance = UIKeyboardAppearance .Dark ;
267- ```
165+ const iqKeyboard = IQKeyboardManager .shared ;
166+ const config = IQKeyboardAppearanceConfiguration .new ();
167+ config .appearance = UIKeyboardAppearance .Dark ;
168+ config .overrideAppearance = true ;
169+ iqKeyboard .keyboardConfiguration = config ;
268170
269- <img src =" https://github.com/tjvantoll/nativescript-IQKeyboardManager/raw/master/demo.gif " width =" 320px " />
171+ // Toolbar
172+ iqKeyboard .enableAutoToolbar = true ;
173+ ```
270174
271175#### Multi-factor one-time code auto-fill
272176
0 commit comments