Sign in to follow this  
toruk

[Typescript + NativeUI] - Help with integration

Recommended Posts

Would anyone be able to help me with integrating NativeUI menu. I have tried  but I just get an error.

My setup is setup using typescript.

I seem to get an error saying the following `TypeError: Point is not a constructor`

import NativeUI from '../../libs/nativeui/index'

const Menu = NativeUI.Menu;
const UIMenuItem = NativeUI.UIMenuItem;
const UIMenuListItem = NativeUI.UIMenuListItem;
const UIMenuCheckboxItem = NativeUI.UIMenuCheckboxItem;
const UIMenuSliderItem = NativeUI.UIMenuSliderItem;
const BadgeStyle = NativeUI.BadgeStyle;
const Point = NativeUI.Point;
const ItemsCollection = NativeUI.ItemsCollection;
const Color = NativeUI.Color;
const ListItem = NativeUI.ListItem;

mp.events.add({
    'player-creator': () => {
        init()
    }
})

function init() {
    const ui = new Menu("Test UI", "Test UI Subtitle", new Point(50, 50));
    ui.AddItem(new UIMenuListItem(
        "List Item",
        "Fugiat pariatur consectetur ex duis magna nostrud et dolor laboris est do pariatur amet sint.",
        new ItemsCollection(["Item 1", "Item 2", "Item 3"])
    ));

    mp.keys.bind(0x71, false, () => {
        if (ui.Visible) ui.Close();
        else ui.Open();
    });
}

 

Share this post


Link to post
Share on other sites

It would seem when Im importing NativeUI anything within that file returns undefined. Not sure why 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.