# nativescript-autocomplete-x

> NativeScript autocomplete plugin

Latest version **0.0.4** (published 2020-01-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install nativescript-autocomplete-x
pnpm add nativescript-autocomplete-x
yarn add nativescript-autocomplete-x
bun add nativescript-autocomplete-x
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2020-01-04 |
| First published | 2019-10-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 36.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Chrystian Ruminowicz |
| Maintainers | chrum |
| Keywords | NativeScript, JavaScript, Android, iOS, Suggest, TextField, Autocomplete |

## Links

- npm: https://www.npmjs.com/package/nativescript-autocomplete-x
- Repository: https://github.com/chrum/nativescript-autocomplete-x
- Issues: https://github.com/chrum/nativescript-autocomplete-x/issues
- npm.io page: https://npm.io/package/nativescript-autocomplete-x

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.0.4 (latest) — 2020-01-04
- 0.0.4-next (next) — 2020-01-04
- 0.0.3 — 2019-10-21
- 0.0.2 — 2019-10-20
- 0.0.1 — 2019-10-20

## README

# [WORK - IN - PROGRESS ]
### [ only iOS so far ]
# nativescript-autocomplete-x

***nativescript-autocomplete-x*** is a NativeScript plugin for autocompleting (suggesting) text field content

##### On ***iOS*** 
 we are using:
[SearchTextField](https://github.com/apasccon/SearchTextField)
or actually my ***[sweet fork](https://github.com/chrum/SearchTextField)*** ;)

##### On Android
that is not available yet

## Demo apps

#### NativeScript-Core (XML)
Check out the [demo](/demo) folder. This is how to clone and run it:

```bash
git clone https://github.com/chrum/nativescript-autocomplete-x
cd nativescript-autocomplete-x/src
npm run demo.ios
```

#### NativeScript-Angular
Check out the [demo-angular](/demo-angular) folder. This is how to clone and run it:

```bash
git clone https://github.com/chrum/nativescript-autocomplete-x
cd nativescript-autocomplete-x/src
npm run demo-angular.ios
```
## Installation
```javascript
tns plugin add nativescript-autocomplete-x
```

## Usage 

# Core
***IMPORTANT !!!*** Make sure you include `xmlns:acx="nativescript-autocomplete-x"` on the Page element
```xml
<Page class="page" xmlns:acx="nativescript-autocomplete-x">
    <StackLayout>
        <acx:AutocompleteX placeholder="check autocomplete..."
                           currentTextInResultsPrefix="Use: "
                           items="{{ ['First', 'Second', 'Third'] }}"
                           selected="onSelected"></acx:AutocompleteX>
    </StackLayout>
</Page>

```

# Angular
Include AutocompleteXModule in your @NgModule  
***IMPORTANT !!!*** you need to do it for every module that will be autocompleting things ;)
```typescript
import { AutocompleteXModule } from 'nativescript-autocomplete-x/angular';

@NgModule({
    imports: [
        AutocompleteXModule,
        ...
    ],
    ...
})
```

```html
<AutocompleteX [placeholder]="'Placeholder...'"
               [items]="items"
               [currentTextInResultsPrefix]="'Use: '"
               (selected)="onSelected($event)">
</AutocompleteX>
```

## API [ TODO ]
### Properties    
| Property | Default | Type | Description |
| --- | --- | --- | --- |
| text |  | `string` | Gets or sets the text |
| items | [ ] | `Array<string>` | array with strings that should be used as autocomplete source |
| hint |  | `string` | Placeholder |
| editable | false | `boolean` | |
| currentTextInResultsPrefix |  | `string` | If set then typed text will appear as the first item on the suggestions list prefixed with this value. <br><br>***Example*** <br>if this one is set to  `'Use:'`<br> then first item on the suggestions list will be `'Use: {typed text}'`  |

### Events    
| Property | Type | Description |
| --- | --- | --- |
| selected | (args: { text: string}): void | fired when selected suggestion gets tapped |


# Troubleshooting
### iOS



## TODO
* **Android** support
* expose clear button mode
* font configuration
* theming, bg color
* more compatibility features with {N} TextField

## Authors

[Chrystian Ruminowicz](http://chrum.it)

## License

This project is licensed under the MIT license

---
_Source: https://npm.io/package/nativescript-autocomplete-x · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
