fix(mobile): reserve the bottom safe area on Android surfaces #6003
ClosedPollyGlot(GitHub profile, opens in a new tab)wants to merge 6 commits into
main fromrefs/pull/6003/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- oxlint-plugin-t3code/rules/require-bottom-safe-area-inset.ts line 187Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +93,21 @@93+94+ const reset = () => {95+ isReactNativeFile = false;96+ readsSafeAreaInset = false;97+ candidates.length = 0;98+ };99+100+ return {101+ before: reset,102+ ImportDeclaration(node) {103+ const source = getLiteralValue(node.source);104+ if (105+ Option.exists(106+ source,107+ (value) => typeof value === "string" && REACT_NATIVE_MODULE.test(value),108+ )109+ ) {110+ isReactNativeFile = true;111+ }112+ },113+ Identifier(node) {
- apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx line 653Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -629,3 +630,3 @@629630 <LegendList630631 className="flex-1"631632 contentContainerStyle={{oxlint-plugin-t3code/rules/require-bottom-safe-area-inset.ts line 148OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +128,21 @@128+ },129+ ObjectExpression(node) {130+ const properties = getObjectProperties(node);131+ if (!isAbsolutelyPositioned(properties)) return;132+133+ const bottom = findProperty(properties, "bottom");134+ if (Option.isNone(bottom)) return;135+136+ // `bottom: 0` is how a keyboard-synced overlay attaches to the very137+ // edge while its child owns the padding; only a fixed non-zero gap138+ // claims to have measured the bottom edge itself.139+ const value = getLiteralValue(bottom.value.value);140+ if (Option.exists(value, (literal) => typeof literal === "number" && literal !== 0)) {141+ candidates.push(bottom.value);142+ }143+ },144+ JSXAttribute(node) {145+ const name = getJsxAttributeName(node);146+ if (Option.isNone(name) || !SCROLL_CONTENT_ATTRIBUTES.has(name.value)) return;147+148+ const properties = getObjectProperties(getJsxAttributeExpression(node));
- apps/mobile/src/features/files/FileTreeBrowser.tsx line 261Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -255,4 +262,10 @@255262 maxToRenderPerBatch={FILE_TREE_RENDER_BATCH_SIZE}256263 updateCellsBatchingPeriod={16}257264 windowSize={5}258- contentContainerStyle={{ paddingTop: 8, paddingBottom: 8 }}265+ contentContainerStyle={{266+ paddingTop: 8,267+ // On iOS the list runs under a native header with automatic content268+ // insets, which already reserve the bottom safe area; Android gets269+ // nothing from that prop and needs the inset here.270+ paddingBottom: Platform.OS === "android" ? Math.max(insets.bottom, 8) + 8 : 8,271+ }}
t3dotgg(GitHub profile, opens in a new tab) added labelsvouch:trusted
t3dotgg(GitHub profile, opens in a new tab) removed labelsvouch:unvouched
- oxlint-plugin-t3code/rules/require-bottom-safe-area-inset.ts line 243Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +179,21 @@179+180+ // `bottom: 0` is how a keyboard-synced overlay attaches to the very181+ // edge while its child owns the padding; only a fixed non-zero gap182+ // claims to have measured the bottom edge itself.183+ const value = getLiteralValue(bottom.value.value);184+ if (Option.exists(value, (literal) => typeof literal === "number" && literal !== 0)) {185+ candidates.push({ node: bottom.value, componentId: currentComponentId });186+ }187+ },188+ JSXAttribute(node) {189+ const name = getJsxAttributeName(node);190+ if (Option.isNone(name) || !SCROLL_CONTENT_ATTRIBUTES.has(name.value)) return;191+192+ const properties = getObjectProperties(getJsxAttributeExpression(node));193+ for (const propertyName of SCROLL_BOTTOM_PROPERTIES) {194+ const property = findProperty(properties, propertyName);195+ if (Option.isNone(property)) continue;196+ if (Option.isSome(getLiteralValue(property.value.value))) {197+ candidates.push({ node: property.value, componentId: currentComponentId });198+ }199+ }
- oxlint-plugin-t3code/rules/require-bottom-safe-area-inset.ts line 210Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +157,21 @@157+ ) {158+ isReactNativeFile = true;159+ }160+ },161+ Identifier(node) {162+ if (typeof node.name !== "string") return;163+ if (SAFE_AREA_BOTTOM_IDENTIFIERS.has(node.name)) {164+ componentsReadingInset.add(currentComponentId);165+ }166+ },167+ MemberExpression(node) {168+ const property = getPropertyName(node.property);169+ if (Option.isNone(property) || property.value !== "bottom") return;170+171+ const object = unwrapExpression(node.object);172+ if (Option.isNone(object) || object.value.type !== "Identifier") return;173+ if (INSET_HOLDER_NAMES.has(object.value.name)) {174+ componentsReadingInset.add(currentComponentId);175+ }176+ },177+ ObjectExpression(node) {
- oxlint-plugin-t3code/rules/require-bottom-safe-area-inset.ts line 209OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +189,21 @@189+ candidates.push({ node: bottom.value, componentId: currentComponentId });190+ }191+ },192+ JSXOpeningElement(node) {193+ const attributes = Array.isArray(node.attributes) ? node.attributes : [];194+ const attributeProperties = new Map<string, ReadonlyArray<unknown>>();195+ for (const attribute of attributes) {196+ const name = getJsxAttributeName(attribute);197+ if (Option.isNone(name)) continue;198+ attributeProperties.set(199+ name.value,200+ getObjectProperties(getJsxAttributeExpression(attribute)),201+ );202+ }203+204+ const style = attributeProperties.get("style") ?? [];205+ for (const propertyName of INLINE_SCROLL_SIZE_PROPERTIES) {206+ const property = findProperty(style, propertyName);207+ if (Option.isSome(property) && Option.isSome(getLiteralValue(property.value.value))) {208+ return;209+ }
- oxlint-plugin-t3code/rules/require-bottom-safe-area-inset.ts line 210OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -0,0 +190,21 @@190+ }191+ },192+ MemberExpression(node) {193+ const property = getPropertyName(node.property);194+ if (Option.isNone(property) || property.value !== "bottom") return;195+196+ const object = unwrapExpression(node.object);197+ if (Option.isNone(object) || object.value.type !== "Identifier") return;198+ if (INSET_HOLDER_NAMES.has(object.value.name)) {199+ componentsReadingInset.add(currentComponentId);200+ }201+ },202+ ArrayExpression(node) {203+ arrayDepth += 1;204+ if (arrayDepth === 1) checkAbsoluteAnchor(node);205+ },206+ "ArrayExpression:exit"() {207+ arrayDepth -= 1;208+ },209+ ObjectExpression(node) {210+ if (arrayDepth === 0) checkAbsoluteAnchor(node);
- @@ -0,0 +170,21 @@170+ FunctionDeclaration: enterFunction,171+ "FunctionDeclaration:exit": exitFunction,172+ FunctionExpression: enterFunction,173+ "FunctionExpression:exit": exitFunction,174+ ArrowFunctionExpression: enterFunction,175+ "ArrowFunctionExpression:exit": exitFunction,176+ ImportDeclaration(node) {177+ const source = getLiteralValue(node.source);178+ if (179+ Option.exists(180+ source,181+ (value) => typeof value === "string" && REACT_NATIVE_MODULE.test(value),182+ )183+ ) {184+ isReactNativeFile = true;185+ }186+ },187+ Identifier(node) {188+ if (typeof node.name !== "string") return;189+ if (SAFE_AREA_BOTTOM_IDENTIFIERS.has(node.name)) {190+ componentsReadingInset.add(currentComponentId);
juliusmarminge closed this
Sign in to join this conversation.






📝 Walkthrough
Walkthrough#
The change adds bottom safe-area handling to several mobile layouts and introduces an oxlint rule that detects bottom-anchored React Native surfaces without inset handling. The rule is registered, enabled, and covered by valid and invalid cases.
Changes#
Mobile safe-area layouts
apps/mobile/src/components/AndroidAnchoredMenu.tsx,apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx,apps/mobile/src/features/files/FileTreeBrowser.tsx,apps/mobile/src/features/review/ReviewSheet.tsx,apps/mobile/src/features/terminal/ThreadTerminalRouteScreen.tsxSafe-area inset linting
oxlint-plugin-t3code/rules/require-bottom-safe-area-inset.tsoxlint-plugin-t3code/index.ts,vite.config.ts,oxlint-plugin-t3code/rules/require-bottom-safe-area-inset.test.tsEstimated code review effort: 4 (Complex) | ~45 minutes
Merge Risk: 🟡 Moderate · up to
7cc3cUnused safe-area imports or bindings can suppress the new Android safe-area check, allowing bottom-pinned UI to ship without gesture-area spacing. Add regression coverage and restrict detection to actual inset use before merging.
Suggested reviewers:
juliusmarminge🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
✅ Passed checks (4 passed)
✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands.