eclipsesource / eclipsesource/tabris-js
Set layout properties get overwritten when using some JSX shorthands
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 171
- PR merge metrics
- No merged PRs in 30d
Description
### Problem description
Some JSX shorthands like `stretch` are translated into a LayoutData overwrite instead of a mutation of the existing `layoutData` of the widget. This has the downside that giving e.g. `stretch` instead of its equivalent properties results into any layout properties set before calling `this.set(constructorProperties)` being overwritten. The pattern of setting individual properties before calling `this.set(constructorProperties)` might be employed as a simple way to implement default values.
### Expected behavior
Merge the LayoutData resulting from shorthands like `stretch` into the existing widget LayoutData when setting it or expand JSX shorthands to individual properties instead.
### Environment
- Tabris.js version: 3.3
### Code snippet
To make the widget render, either swap the lines `this.height = 120;` and `this.set(properties);` or replace `stretchX` by `left` and `right`.
```javascript
import { Composite, contentView, Properties } from 'tabris';
class CustomComponent extends Composite {
constructor(properties: Properties) {
super();
this.height = 120;
this.set(properties);
}
}
contentView.append(
);
```
Contributor guide
Assessment
This issue has not been assessed yet.