The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 02:00 UTC
fix(mobile): Android navigation bar follows the app theme (#27576)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Vincent Guillebaud committed
Nov 9, 2026 at 06:32 UTC
42b2df9995c0d42db8cae70609a1e282270ddc50
2 files changed
+21
-1
apps/mobile/modules/t3-native-controls/android/src/main/java/expo/modules/t3nativecontrols/T3NativeControlsModule.kt
+11
@@ -10,7 +10,9 @@ import android.provider.MediaStore
10
import android.text.format.DateFormat
11
import androidx.annotation.RequiresApi
12
import androidx.core.content.FileProvider
13
+import androidx.core.view.WindowCompat
14
import expo.modules.kotlin.Promise
15
+import expo.modules.kotlin.functions.Queues
16
import expo.modules.kotlin.modules.Module
17
import expo.modules.kotlin.modules.ModuleDefinition
18
import java.io.File
@@ -23,6 +25,15 @@ class T3NativeControlsModule : Module() {
25
override fun definition() = ModuleDefinition {
26
Name("T3NativeControls")
27
28
+ // React Native sets this once, at launch, from the system theme rather than the app's.
29
+ AsyncFunction("setNavigationBarStyle") { light: Boolean ->
30
+ // Below Android 10, React Native paints the navigation bar color itself.
31
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) return@AsyncFunction
32
+ val window = appContext.currentActivity?.window ?: return@AsyncFunction
33
+ val controller = WindowCompat.getInsetsController(window, window.decorView)
34
+ controller.isAppearanceLightNavigationBars = light
35
+ }.runOnQueue(Queues.MAIN)
36
+
37
Function("is24HourFormat") {
38
val context = appContext.reactContext ?: error("The app is not active.")
39
DateFormat.is24HourFormat(context)
apps/mobile/src/App.tsx
+10
-1
@@ -3,8 +3,9 @@ import { installComposerAttachmentUploads } from "./state/composer-attachment-up
3
import { installThreadOutboxDelivery } from "./state/threadOutboxDelivery";
4
import * as Linking from "expo-linking";
5
import * as SplashScreen from "expo-splash-screen";
6
+import { requireNativeModule } from "expo";
7
import { useEffect } from "react";
7
-import { StatusBar } from "react-native";
8
+import { Platform, StatusBar } from "react-native";
9
import { GestureHandlerRootView } from "react-native-gesture-handler";
10
import { KeyboardProvider } from "react-native-keyboard-controller";
11
import { SafeAreaProvider } from "react-native-safe-area-context";
@@ -229,6 +230,14 @@ function AppContent() {
230
const { themeAppearance } = useAppearancePreferences();
231
const navigationTheme = useMobileNavigationTheme();
232
233
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- matches the Android navigation bar to the app theme, as StatusBar does for the status bar
234
+ useEffect(() => {
235
+ if (Platform.OS !== "android") return;
236
+ void requireNativeModule<{ setNavigationBarStyle(light: boolean): Promise<void> }>(
237
+ "T3NativeControls",
238
+ ).setNavigationBarStyle(themeAppearance === "light");
239
+ }, [themeAppearance]);
240
+
241
return (
242
<>
243
<SplashScreenCoordinator />