Skip to content

Commit a404273

Browse files
Fix Sheet native blocking issue on iOS and cleanup logic.
1. Refine blocker identification using a client property to avoid accidental removal of other components. 2. Update KotlinUiTest.kt and BrowserComponentScreenshotTest.java to use sheet.show(0) to prevent potential animation-related hangs on iOS. 3. Verify core logic with SheetPeerBlockingTest.
1 parent 98aa2a7 commit a404273

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

CodenameOne/src/com/codename1/ui/Sheet.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ public void paint(Graphics g, Rectangle rect) {
483483
for (Component child : cnt) {
484484
if (child instanceof Sheet) {
485485
foundSheet = true;
486-
} else {
486+
} else if (Boolean.TRUE.equals(child.getClientProperty("SheetBlocker"))) {
487487
blocker = child;
488488
}
489489
}
@@ -492,6 +492,7 @@ public void paint(Graphics g, Rectangle rect) {
492492
if (needsBlocker) {
493493
if (blocker == null) {
494494
blocker = new Button();
495+
blocker.putClientProperty("SheetBlocker", Boolean.TRUE);
495496
blocker.setUIID("Container");
496497
blocker.getAllStyles().setBgTransparency(0);
497498
blocker.setPreferredSize(new com.codename1.ui.geom.Dimension(10000, 10000));

scripts/hellocodenameone/common/src/main/java/com/codenameone/examples/hellocodenameone/tests/BrowserComponentScreenshotTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void onSucess(BrowserComponent.JSRef result) {
6060

6161
Sheet sheet = new Sheet(null, "Overlay Sheet");
6262
sheet.getContentPane().add(new Label("This is a sheet covering part of the browser"));
63-
sheet.show();
63+
sheet.show(0);
6464

6565
UITimer.timer(2000, false, form, readyRunnable);
6666
readyRunnable = null;

scripts/hellocodenameone/common/src/main/kotlin/com/codenameone/examples/hellocodenameone/tests/KotlinUiTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class KotlinUiTest : BaseTest() {
5555

5656
val sheet = Sheet(null, "Overlay Sheet")
5757
sheet.contentPane.add(Label("This is a sheet covering part of the screen"))
58-
sheet.show()
58+
sheet.show(0)
5959

6060
return true
6161
}

0 commit comments

Comments
 (0)