Title: `androidOverflowInset` applies padding even when insets are marked as consumed · Issue #11019 · NativeScript/NativeScript · GitHub
Open Graph Title: `androidOverflowInset` applies padding even when insets are marked as consumed · Issue #11019 · NativeScript/NativeScript
X Title: `androidOverflowInset` applies padding even when insets are marked as consumed · Issue #11019 · NativeScript/NativeScript
Description: Issue Description Bug: androidOverflowInset applies padding even when insets are marked as consumed When using androidOverflowEdge="dont-apply" and listening to the androidOverflowInset event, NativeScript automatically applies padding e...
Open Graph Description: Issue Description Bug: androidOverflowInset applies padding even when insets are marked as consumed When using androidOverflowEdge="dont-apply" and listening to the androidOverflowInset event, Nati...
X Description: Issue Description Bug: androidOverflowInset applies padding even when insets are marked as consumed When using androidOverflowEdge="dont-apply" and listening to the androidOverflowInset e...
Opengraph URL: https://github.com/NativeScript/NativeScript/issues/11019
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`androidOverflowInset` applies padding even when insets are marked as consumed","articleBody":"### Issue Description\n\n**Bug:** `androidOverflowInset` applies padding even when insets are marked as consumed\n\nWhen using `androidOverflowEdge=\"dont-apply\"` and listening to the `androidOverflowInset` event, NativeScript automatically applies padding even when insets are marked as consumed. This is a runtime issue.\n\n**Expected behavior:**\n\nWhen `inset.topConsumed = true` (and similar for other edges) is set in the `androidOverflowInset` event handler, NativeScript should not apply padding, regardless of the original inset values.\n\n**Actual behavior:**\n\nNativeScript applies padding based on whether the original inset values were 0 (`leftPreviouslyConsumed`), not based on whether the insets are marked as consumed (`leftConsumed`). This happens in `LayoutBase.java` line 280:\n\n```java\nbase.setPadding(leftPreviouslyConsumed ? 0 : leftInset, topPreviouslyConsumed ? 0 : topInset, rightPreviouslyConsumed ? 0 : rightInset, bottomPreviouslyConsumed ? 0 : bottomInset);\n```\n\nThe code checks `leftPreviouslyConsumed` (whether the original value was 0) instead of `leftConsumed` (whether it was marked as consumed by the event handler).\n\n**Workaround:**\n\nThe current workaround is to set inset values to 0 AND mark them as consumed:\n\n```typescript\ninset.top = 0;\ninset.bottom = 0;\ninset.left = 0;\ninset.right = 0;\ninset.topConsumed = true;\ninset.bottomConsumed = true;\ninset.leftConsumed = true;\ninset.rightConsumed = true;\n```\n\nThis is counterintuitive because marking as consumed should be sufficient.\n\n**Proposed fix:**\n\nIn `LayoutBase.java` line 280, the code should check `leftConsumed` instead of (or in addition to) `leftPreviouslyConsumed`:\n\n```java\n// Current (buggy):\nbase.setPadding(leftPreviouslyConsumed ? 0 : leftInset, ...);\n\n// Should be:\nbase.setPadding((leftPreviouslyConsumed || leftConsumed) ? 0 : leftInset, ...);\n```\n\n**Related file:**\n- `packages/ui-mobile-base/android/widgets/src/main/java/org/nativescript/widgets/LayoutBase.java` (line 280)\n\n\n### Reproduction\n\n1. Create a Frame with `androidOverflowEdge=\"dont-apply\"`:\n\n```xml\n\u003cFrame id=\"rootFrame\" androidOverflowEdge=\"dont-apply\" loaded=\"onLoaded\" /\u003e\n```\n\n2. Listen to the `androidOverflowInset` event and mark insets as consumed without setting their values to 0:\n\n```typescript\nexport function onLoaded(args: EventData) {\n const rootFrame = args.object as Frame;\n \n rootFrame.on(\"androidOverflowInset\", (event: any) =\u003e {\n const { inset } = event;\n \n // Store values for CSS variables\n const values = { \n top: inset.top, \n bottom: inset.bottom, \n left: inset.left, \n right: inset.right \n };\n \n // Mark as consumed (this should prevent padding, but doesn't)\n inset.topConsumed = true;\n inset.bottomConsumed = true;\n inset.leftConsumed = true;\n inset.rightConsumed = true;\n });\n}\n```\n\n3. Run the app on an Android device/emulator\n4. Observe that padding is still applied automatically, even though insets are marked as consumed\n\n**Expected:** No padding should be applied when insets are marked as consumed.\n\n**Actual:** Padding is applied based on the original inset values.\n\n### Relevant log output (if applicable)\n\n```shell\nNo error messages, but the behavior can be observed visually as unwanted padding is applied to the view.\n```\n\n### Environment\n\n```yaml\nOS: Linux 6.17 Fedora Linux 43 (Workstation Edition)\nCPU: (20) x64 Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz\nShell: /usr/bin/zsh\nnode: 22.14.0\nnpm: 10.9.2\nnativescript: 9.0.1\n\n# android\njava: 17.0.16\nndk: Not Found\napis: Not Found\nbuild_tools: Not Found\nsystem_images: Not Found\n\n# ios\nxcode: Not Found\ncocoapods: Not Found\npython: 3.14.2\npython3: 3.14.2\nruby: 3.4.7\nplatforms: Not Found\n```\n\n### Dependencies\n\n```json\n\"dependencies\": {\n \"@learn6502/6502\": \"workspace:^\",\n \"@learn6502/common-ui\": \"workspace:^\",\n \"@nativescript/core\": \"~9.0.10\",\n \"@nativescript/localize\": \"^5.2.0\",\n \"@nativescript/tailwind\": \"^4.0.7\",\n \"tailwindcss\": \"^4.1.18\"\n},\n\"devDependencies\": {\n \"@nativescript/android\": \"9.0.1\",\n \"@nativescript/types\": \"~9.0.0\",\n \"@nativescript/webpack\": \"^5.0.29\",\n \"@tailwindcss/postcss\": \"^4.1.18\",\n \"autoprefixer\": \"^10.4.23\",\n \"nativescript\": \"^9.0.1\",\n \"postcss\": \"^8.5.6\",\n \"postcss-cli\": \"^11.0.1\",\n \"postcss-discard-empty\": \"^7.0.1\",\n \"postcss-import\": \"^16.1.1\",\n \"postcss-nested\": \"^7.0.2\",\n \"string-replace-loader\": \"^3.3.0\",\n \"typescript\": \"^5.9.3\"\n}\n```\n\n### Please accept these terms\n\n- [x] I have searched the [existing issues](https://github.com/NativeScript/NativeScript/issues) as well as [StackOverflow](https://stackoverflow.com/questions/tagged/nativescript) and this has not been posted before\n- [x] This is a bug report\n- [x] I agree to follow this project's [Code of Conduct](https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#coc)","author":{"url":"https://github.com/JumpLink","@type":"Person","name":"JumpLink"},"datePublished":"2025-12-31T12:29:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/11019/NativeScript/issues/11019"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:62ea1f52-52ec-2125-efeb-8ad2ca03f36c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9C7E:35369E:321150E:420C6AE:6964A165 |
| html-safe-nonce | 64319632f3c43f13ccdc82b17e50ed8d3d9f6015375ddde62650e40fd04242d1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QzdFOjM1MzY5RTozMjExNTBFOjQyMEM2QUU6Njk2NEExNjUiLCJ2aXNpdG9yX2lkIjoiMjA2MjkzODQwMzk1NzQxNjI5MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1554a8452914b5a7d150ab26db3ffea493974c02d1dc2f483da2d8ddced810e6 |
| hovercard-subject-tag | issue:3772702975 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/NativeScript/11019/issue_layout |
| twitter:image | https://opengraph.githubassets.com/334531bf55aa2d1a193525253ae7c8db12916ef0ffa944d3bbaab0424e0097c9/NativeScript/NativeScript/issues/11019 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/334531bf55aa2d1a193525253ae7c8db12916ef0ffa944d3bbaab0424e0097c9/NativeScript/NativeScript/issues/11019 |
| og:image:alt | Issue Description Bug: androidOverflowInset applies padding even when insets are marked as consumed When using androidOverflowEdge="dont-apply" and listening to the androidOverflowInset event, Nati... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JumpLink |
| hostname | github.com |
| expected-hostname | github.com |
| None | baa7d9900fdf7b27d604f36887af878d569cfbdcf97126832a5f4f0caf0c6ba5 |
| turbo-cache-control | no-preview |
| go-import | github.com/NativeScript/NativeScript git https://github.com/NativeScript/NativeScript.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 31492490 |
| octolytics-dimension-repository_nwo | NativeScript/NativeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31492490 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/NativeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 842eff1d11f899d02b6b3b98fa3ea4860e64b34e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width