From d528858e85c709a02b98d1b46cb41f55f3d14190 Mon Sep 17 00:00:00 2001 From: SkinnnyJay Date: Thu, 2 Oct 2025 02:48:21 -0700 Subject: [PATCH] Fix: TextField gray overlay when iOS app runs on macOS Issue: When the iOS app is downloaded from the Mac App Store and run on Apple Silicon Macs, a gray overlay appears over TextField components when Increase Contrast accessibility setting is disabled. Reproduction: 1. Download bitchat iOS app from Mac App Store 2. Run on Apple Silicon Mac 3. Disable 'Increase Contrast' in System Settings > Accessibility > Display 4. Focus on text input field - gray overlay appears Fix: Use ProcessInfo.processInfo.isiOSAppOnMac runtime detection to disable autocorrection only when iOS app runs on macOS. This targets the exact environment where the issue occurs while preserving normal autocorrection behavior for iPhone/iPad users. Addresses code review feedback about incorrect conditional compilation. --- bitchat/Views/ContentView.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bitchat/Views/ContentView.swift b/bitchat/Views/ContentView.swift index b0d82ffec..09a30fded 100644 --- a/bitchat/Views/ContentView.swift +++ b/bitchat/Views/ContentView.swift @@ -11,6 +11,20 @@ import SwiftUI import UIKit #endif +#if os(iOS) +@available(iOS 14.0, *) +struct IOSOnMacFixModifier: ViewModifier { + func body(content: Content) -> some View { + if ProcessInfo.processInfo.isiOSAppOnMac { + content + .autocorrectionDisabled(true) + } else { + content + } + } +} +#endif + // MARK: - Supporting Types // @@ -815,6 +829,10 @@ struct ContentView: View { .foregroundColor(textColor) .focused($isTextFieldFocused) .padding(.leading, 12) + #if os(iOS) + // Fix for gray overlay issue when iOS app runs on macOS with Increase Contrast disabled + .modifier(IOSOnMacFixModifier()) + #endif // iOS keyboard autocomplete and capitalization enabled by default .onChange(of: messageText) { newValue in // Cancel previous debounce timer