Socket
Book a DemoInstallSign in
Socket

@schoolsquirrel/emoji-picker

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@schoolsquirrel/emoji-picker

Add a plugin description

1.1.0
latest
Source
npmnpm
Version published
Maintainers
3
Created
Source

@schoolsquirrel/emoji-picker😃

Build GitHub license Maintenance

There are many emoji pickers for Angular and the web, but no one for NativeScript?! Let's change this!

How it looks like

Keyboard viewEmoji picker view
screenshot 1screenshot 2

Limitation

The emoji picker currently only supports Android and NativeScript 7 or higher. In case you need to use an older NativeScript version, have a look at the old branch.

Installation

Install the plugin using ns plugin add @schoolsquirrel/emoji-picker

Usage

How does it work?

This plugin will give you two elements, EmojiPicker and EmojiLabel. The first one will give you an editable textfield (very similar to the NativeScript TextView) and the second one is a label (similar to NativeScript Label), which will display your text with emojis correctly.

NativeScript Core:

Define the namespace

<Page class="page"
    loaded="pageLoaded"
    navigatingTo="onNavigatingTo"
    xmlns="http://schemas.nativescript.org/tns.xsd"
    xmlns:ns="@schoolsquirrel/emoji-picker">

Use the plugin:

<ns:EmojiPicker id="myEmojiPicker"></ns:EmojiPicker>
<ns:EmojiLabel id="myEmojiLabel"></ns:EmojiLabel>

On the JS / TS Side you can toggle the keyboard or the popup window of the edit text field like this:

const page = frame.Frame.topmost().currentPage;
page.getViewById('myEmojiPicker').togglePopup();

The <EmojiPicker> class extends the TextField NativeScript class, which means that all of TextField's properties and methods are supported. It is the same with <EmojiLabel> and the Label class.

You can add custom styles by using ids, classes or the tag selector in (s)css:

EmojiLabel {
	background-color: rgba(14, 190, 221, 0.233);
	padding: 10;
	text-align: center;
	font-size: 20;
}

EmojiPicker {
	padding: 30;
	color: green;
	margin: 20;
}

For more info and examples check out the demo folder.

Angular Version:

In your app.module.ts include the library like so:

import { EmojiPickerModule } from '@schoolsquirrel/emoji-picker/angular';

and add it to the imports array:

@NgModule({
    bootstrap:  [
        ...
    ],
    declarations: [
        ...
    ],
    imports: [
        ...
        EmojiPickerModule, // <--- add this here
    ],
    schemas: [
        ...
    ],
})
export class AppModule { }

The use it in your .html file:

<EmojiPicker #myEmojiPicker></EmojiPicker> <EmojiLabel #myEmojiLabel text="Have fun with @schoolsquirrel/emoji-picker"></EmojiLabel>

On the TS Side you can toggle the keyboard or the popup window of the edit text field like this:

export class HomeComponent {
	@ViewChild('myEmojiPicker', { static: false }) public myEmojiPicker: EmojiPicker;
	@ViewChild('myEmojiLabel', { static: true }) public myEmojiLabel: EmojiLabel;

	public onButtonTap(): void {
		this.myEmojiPicker.nativeElement.togglePopup();
	}

	public onCopyBtnTap(): void {
		console.log('pressed!');
		this.myEmojiLabel.nativeElement.text = this.myEmojiPicker.nativeElement.text;
	}
}

The <EmojiPicker> class extends the TextField NativeScript class, which means that all of TextField's properties and methods are supported. It is the same with <EmojiLabel> and the Label class.

You can add custom styles by using ids, classes or the tag selector in (s)css:

EmojiLabel {
	background-color: rgba(14, 190, 221, 0.233);
	padding: 10;
	text-align: center;
	font-size: 20;
}

EmojiPicker {
	padding: 30;
	color: green;
	margin: 20;
}

For more info and examples check out the demo and the demo-angular folder.

License

MIT

Keywords

NativeScript

FAQs

Package last updated on 10 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.