eclipsesource / tabris-js

Create native mobile apps in JavaScript or TypeScript.
https://tabrisjs.com
BSD 3-Clause "New" or "Revised" License
1.4k stars 170 forks source link

Property 'contentView' doesn't exist on type 'Popover'. #1718

Open erykmol opened 6 years ago

erykmol commented 6 years ago

Problem description

In popover.js snippet Popover widget, contentView is not existing as a property of the widget.

Expected behavior

Programmer should be able to attach provided widgets to Popover.contentView similarly to tabris.ui.contentView.

Environment

Code snippet

import { Action, NavigationView, Page, Popover, Button, TextView, ui, device } from 'tabris';

const button = new Button({
  left: 16, right: 16, top: 24,
  text: 'Show Popover'
}).on({select: () => showPopover})
  .appendTo(ui.contentView);

function showPopover() {
  const popover = new Popover({width: 300, height: 400, anchor: button})
    .on({close: () => console.log('Popover closed')})
    .open();
  const navigationView = new NavigationView({
    layoutData: {left: 0, right: 0, top: 0, bottom: 0},
    navigationAction: new Action({
      title: 'Close',
      image: {
        src: device.platform === 'iOS' ? 'resources/close-black-24dp@3x.png' : 'resources/close-white-24dp@3x.png',
        scale: 3
      }
    }).on('select', () => popover.close())
  }).appendTo(popover.contentView);
  const page = new Page({title: 'Popover'}).appendTo(navigationView);
  new TextView({centerX: 0, centerY: 0, text: 'Hello popover'}).appendTo(page);
}
mpost commented 6 years ago

Could you clarify the type of problem your are describing? In the snippet above popover.contentView is used to attach widgets to it.

erykmol commented 6 years ago

The problem is that attaching any widget to popover.contentView is not possible because there is no existing contentView property in the Popover widget.

mpost commented 6 years ago

In the popover snippet you can see that the contentView is available and used as expected.

erykmol commented 6 years ago

Here is a screenshot of the error from vscode. screen shot 2018-08-16 at 15 36 56

mpost commented 6 years ago

ok thanks. @tbuschto Could you have a look?

cpetrov commented 5 years ago

We should backport this to 2.x