Skip to content

fix(android): size tab bars for their navigation overlap - #596

Draft
houko wants to merge 2 commits into
mainfrom
fix/android-tabbar-insets
Draft

houko wants to merge 2 commits into
mainfrom
fix/android-tabbar-insets

Conversation

@houko

@houko houko commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Android tab bars subtracted the window's entire bottom navigation inset even when placed in the middle of the screen. With three-button navigation this left only 32 points of an 80-point bar, clipping its icons and titles.

Compute the bar's actual overlap with the navigation region, use only that overlap as bottom padding, and report the resulting natural height back to Go through the existing native-component event bridge. The overlap is recalculated from a global layout listener after every layout pass of the window, so a move of the bar or of any ancestor updates it, and a padding change takes effect on the next pass instead of requesting layout from inside onLayout. Explicit heights remain authoritative and IME insets are excluded. Regenerate the prebuilt Android runtime.

Closes #591.

Verification (current revision, rebased onto main at 861c49d):

  • Pixel 3 XL (Android 12), three-button navigation: TestTabBarSVGNativeTint, TestTabBarNativeInsetsFollowPlacement and TestTabBarItemsEncodeCanvasIcons passed. The placement test checks height and icon/label pixels for a bar in the middle, against the bottom, above navigation, partly overlapping navigation, and moved back to the middle.
  • Same device, gesture navigation and two-button navigation: the same 3 tests passed. Negative control on three-button navigation: with main's TabBar.java, tabbar.go, classes.dex and classes.jar, TestTabBarSVGNativeTint and TestTabBarNativeInsetsFollowPlacement fail (icon pixel shows only the bar surface).
  • Earlier revision, Android API 35 emulator (1080x2400, 420 dpi): the same 3 tests passed with three-button (126 px inset) and gesture (63 px inset) navigation. Negative control: with main's classes.dex, classes.jar and tabbar.go, both tab-bar native tests fail on three-button navigation (icon pixel shows only the bar surface), so the tests cover the bug.
  • go build ./..., windows/linux/js-wasm builds, GOOS=android GOARCH=arm64 go vet ./internal/platform/android, go tool nsgo check -target all (Apple targets need Xcode and were skipped on the Linux host), go tool nsgo test ./internal/platform/android (all host tests pass; native tests skip without their target) and go tool nsgo test -run 'Layer|Skills|Doc' . (35 passed).
  • Rebuilt classes.dex and classes.jar with internal/platform/android/runtime/build.sh on top of main's Java runtime; the rebuild is reproducible at the branch head.

The existing SVG regression now fits the actual viewport and uses Scope.Post to change its selection on the engine goroutine. Reviewed iOS's native tab-bar sizing and recorded its separate one-time-measurement limitation in the roadmap; this PR changes no iOS behaviour.

@github-actions github-actions Bot added size/M bug Something isn't working documentation Improvements or additions to documentation Android conflict Conflicts with the base branch; resolve it first labels Nov 17, 2026
@houko
houko force-pushed the fix/android-tabbar-insets branch from 4bd52cf to c988d8b Compare November 17, 2026 17:44
@github-actions github-actions Bot added conflict Conflicts with the base branch; resolve it first and removed conflict Conflicts with the base branch; resolve it first labels Nov 17, 2026
@houko
houko force-pushed the fix/android-tabbar-insets branch from c988d8b to a31c581 Compare November 18, 2026 01:43
@github-actions github-actions Bot added conflict Conflicts with the base branch; resolve it first and removed conflict Conflicts with the base branch; resolve it first labels Nov 18, 2026
@houko
houko force-pushed the fix/android-tabbar-insets branch from 34ec531 to ce3a1a1 Compare November 18, 2026 03:03
@github-actions github-actions Bot removed the conflict Conflicts with the base branch; resolve it first label Nov 18, 2026
@houko
houko force-pushed the fix/android-tabbar-insets branch from ce3a1a1 to db923ff Compare November 18, 2026 03:43

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Android bug Something isn't working documentation Improvements or additions to documentation size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

android: TabBar loses the navigation bar's inset from its fixed 80 pt, so its tabs are clipped with three-button navigation

1 participant