Jump to content

Pixi TextInput: how to use


renathy
 Share

Recommended Posts

I have installed Pixi.TextInput (https://github.com/Mwni/PIXI.TextInput). 

npm install pixi-text-input

It seems that it doesn't contain Types definitions for typescript. And when I am trying to use it, it gives me errors.

 

 

In my index.ts I am importing it and I am trying to use it like this:

import TextInput from 'pixi-text-input';

...

var input = new TextInput({
                    input: {
                        fontSize: '25pt',
                        padding: '14px',
                        width: '500px',
                        color: '#26272E'
                    }, 
                    box: {default: {fill: 0xE8E9F3rounded: 16stroke: {color: 0xCBCEE0width: 4}},
                    focused: {fill: 0xE1E3EErounded: 16stroke: {color: 0xABAFC6width: 4}},
                    disabled: {fill: 0xDBDBDBrounded: 16}}
                });
                //input.placeholder = 'Enter your Text...';
                input.x = 500;
                input.y = 300;
                input.pivot.x = input.width/2;
                input.pivot.y = input.height/2;
                this.app.stage.addChild(input);

But when I run application it says that 
Uncaught TypeError: pixi_text_input_1.default is not a constructor
 

Edited by renathy
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...