diff --git a/app.config.js b/app.config.js index 47b1d5304..0a0d577d9 100644 --- a/app.config.js +++ b/app.config.js @@ -406,6 +406,7 @@ module.exports = function (_config) { './plugins/withAndroidNoJitpackPlugin.js', './plugins/withAndroidPreparedTextLayoutPlugin.js', './plugins/withAndroidComposeVersion.js', + './plugins/withIOSWindowingControlStyle.js', './plugins/shareExtension/withShareExtensions.js', './plugins/notificationsExtension/withNotificationsExtension.js', [ diff --git a/plugins/withIOSWindowingControlStyle.js b/plugins/withIOSWindowingControlStyle.js new file mode 100644 index 000000000..9a1a935ca --- /dev/null +++ b/plugins/withIOSWindowingControlStyle.js @@ -0,0 +1,52 @@ +/* eslint-disable import/no-nodejs-modules -- Expo config plugins run in Node. */ +const fs = require('node:fs') +const path = require('node:path') +const {withDangerousMod, CodeGenerator} = require('expo/config-plugins') + +/** + * On iPadOS 26+, windowed apps get close/minimize/arrange controls in the + * top-leading corner. The default style draws them inline with the app's + * toolbar and expects the app to lay out around them, which our JS headers + * can't do, so they end up covering the menu/back button. The minimal style + * draws them in a strip above the app instead, and that strip counts toward + * the top safe area, which every screen already respects. + */ +module.exports = config => + withDangerousMod(config, [ + 'ios', + config => { + const file = path.join( + config.modRequest.platformProjectRoot, + config.modRequest.projectName, + 'SceneDelegate.swift', + ) + let contents = fs.readFileSync(file, 'utf8') + + contents = CodeGenerator.mergeContents({ + src: contents, + anchor: /internal import Expo/, + newSrc: 'import UIKit', + offset: 1, + tag: 'windowing control style import', + comment: '//', + }).contents + + contents = CodeGenerator.mergeContents({ + src: contents, + anchor: /\/\/ Extension point for config plugins\./, + newSrc: ` @available(iOS 26.0, *) + @objc(preferredWindowingControlStyleForScene:) + func preferredWindowingControlStyle( + for windowScene: UIWindowScene + ) -> UIWindowScene.WindowingControlStyle { + return .minimal + }`, + offset: 1, + tag: 'windowing control style', + comment: '//', + }).contents + + fs.writeFileSync(file, contents) + return config + }, + ]) diff --git a/src/Splash.tsx b/src/Splash.tsx index 56f29e69b..a84c5e462 100644 --- a/src/Splash.tsx +++ b/src/Splash.tsx @@ -19,7 +19,7 @@ import {Image} from 'expo-image' import * as SplashScreen from 'expo-splash-screen' import {Logotype} from '#/view/icons/Logotype' -import {atoms as a} from '#/alf' +import {atoms as a, useBreakpoints} from '#/alf' // @ts-expect-error import splashImagePointer from '../assets/splash/splash.png' // @ts-expect-error @@ -55,6 +55,7 @@ type Props = { export function Splash(props: React.PropsWithChildren) { 'use no memo' const insets = useSafeAreaInsets() + const {gtMobile} = useBreakpoints() const intro = useSharedValue(0) const outroLogo = useSharedValue(0) const outroApp = useSharedValue(0) @@ -114,13 +115,16 @@ export function Splash(props: React.PropsWithChildren) { /** * Keep the app opaque so iOS blur/glass effects can initialize while the - * splash hides it. + * splash hides it. No scale on tablet layouts, where it leaves the top of + * the sidebar blurred by its scroll edge effect after launch. */ const appAnimation = useAnimatedStyle(() => { return { transform: [ { - scale: interpolate(outroApp.get(), [0, 1], [1.1, 1], 'clamp'), + scale: gtMobile + ? 1 + : interpolate(outroApp.get(), [0, 1], [1.1, 1], 'clamp'), }, ], }