tabris-js
tabris-js copied to clipboard
Dispose operation executed prematurely when requested after reparenting
Problem description
When disposing a container right after its children have been moved to another container, those children will not be laid out.
It seems that the dispose operation is executed right away, before the children update is flushed.
From _removeChild(child):
https://github.com/eclipsesource/tabris-js/blob/7bd6a864a0c600a0d360724ef902c94bf7fd1626/src/tabris/widgets/Composite.js#L152
From dispose():
https://github.com/eclipsesource/tabris-js/blob/7bd6a864a0c600a0d360724ef902c94bf7fd1626/src/tabris/NativeObject.js#L346
Environment
- Tabris.js version: 3.3
Code snippet
import { Composite, TextView, contentView } from 'tabris';
let container = <Composite stretch />;
let thing = <TextView center text='Hello world!' />;
contentView.append(
container.append(
thing
)
);
setTimeout(() => {
thing.detach();
thing.appendTo(contentView);
container.dispose(); // does not work
// setTimeout(() => container.dispose()); // works
}, 2000);
Thanks for the hint. We will look into it. 👍