@tastic/shell 0.8.2 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tastic/shell",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "description": "The app around a pack of React Native games, two-seat or for one player: Home, the loadout, the stats screen, Profiles and Settings, the pack's Redux store and its root providers, driven by one PackDefinition",
5
5
  "keywords": [
6
6
  "react-native",
@@ -152,7 +152,7 @@
152
152
  "react-native-gesture-handler": ">=3.3.0",
153
153
  "react-native-paper": ">=5.15.3",
154
154
  "react-native-reanimated": ">=4.7.1",
155
- "react-native-safe-area-context": ">=5.10.1",
155
+ "react-native-safe-area-context": ">=5.11.0",
156
156
  "react-redux": ">=9.3.0",
157
157
  "redux": ">=5.0.1",
158
158
  "redux-persist": ">=6.0.0"
@@ -18,6 +18,7 @@ import { GuideHost } from './components/GuideHost'
18
18
  import { Providers } from './components/Providers'
19
19
  import { Theme } from './components/Theme'
20
20
  import { UpdateDialog } from './components/UpdateDialog'
21
+ import { WindowControlsInsets } from './components/WindowControlsInsets'
21
22
  import { LastActiveGameProvider } from './hooks/useLastActiveGame'
22
23
  import { ProfilesProvider, useProfiles } from './hooks/useProfiles'
23
24
  import { PackProvider, usePack } from './PackContext'
@@ -196,41 +197,43 @@ export function RootLayout({ pack, store, persistor }: RootLayoutProps) {
196
197
  return (
197
198
  <GestureHandlerRootView style={styles.root}>
198
199
  <SafeAreaProvider>
199
- <PackProvider pack={pack}>
200
- <Fonts>
201
- <Providers store={store} persistor={persistor}>
202
- <Theme>
203
- <ProfilesProvider>
204
- {/* Inside Providers' PersistGate, so the game a cold launch resumes (read once, as
205
- it mounts) is the saved one. */}
206
- <LastActiveGameProvider>
207
- <GameProviders games={pack.games}>
208
- <PackRoot pack={pack}>
209
- <GatedApp>
210
- <HapticGatedToastProvider>
211
- {/* Wraps the stack (rather than sitting beside it like UpdateDialog)
212
- because Home's tiles and the loadout's How to Play row reach it through
213
- context (see GuideHost). Inside the toast provider because the card renders
214
- through a Portal, and inside the gate so it mounts together with Home rather
215
- than before it. */}
216
- <GuideHost>
217
- <AppStack />
218
- </GuideHost>
219
- {/* historyButton/clearButton off: there's no toast history to open, and a
220
- control row for it above the toast stack would go nowhere. limit pins the
221
- package's current default (3) so a future toaster release can't change it. */}
222
- {pack.Toaster ? <PackToaster Toaster={pack.Toaster} /> : <RotatingToaster />}
223
- <UpdateDialog />
224
- </HapticGatedToastProvider>
225
- </GatedApp>
226
- </PackRoot>
227
- </GameProviders>
228
- </LastActiveGameProvider>
229
- </ProfilesProvider>
230
- </Theme>
231
- </Providers>
232
- </Fonts>
233
- </PackProvider>
200
+ <WindowControlsInsets>
201
+ <PackProvider pack={pack}>
202
+ <Fonts>
203
+ <Providers store={store} persistor={persistor}>
204
+ <Theme>
205
+ <ProfilesProvider>
206
+ {/* Inside Providers' PersistGate, so the game a cold launch resumes (read once, as
207
+ it mounts) is the saved one. */}
208
+ <LastActiveGameProvider>
209
+ <GameProviders games={pack.games}>
210
+ <PackRoot pack={pack}>
211
+ <GatedApp>
212
+ <HapticGatedToastProvider>
213
+ {/* Wraps the stack (rather than sitting beside it like UpdateDialog)
214
+ because Home's tiles and the loadout's How to Play row reach it through
215
+ context (see GuideHost). Inside the toast provider because the card renders
216
+ through a Portal, and inside the gate so it mounts together with Home rather
217
+ than before it. */}
218
+ <GuideHost>
219
+ <AppStack />
220
+ </GuideHost>
221
+ {/* historyButton/clearButton off: there's no toast history to open, and a
222
+ control row for it above the toast stack would go nowhere. limit pins the
223
+ package's current default (3) so a future toaster release can't change it. */}
224
+ {pack.Toaster ? <PackToaster Toaster={pack.Toaster} /> : <RotatingToaster />}
225
+ <UpdateDialog />
226
+ </HapticGatedToastProvider>
227
+ </GatedApp>
228
+ </PackRoot>
229
+ </GameProviders>
230
+ </LastActiveGameProvider>
231
+ </ProfilesProvider>
232
+ </Theme>
233
+ </Providers>
234
+ </Fonts>
235
+ </PackProvider>
236
+ </WindowControlsInsets>
234
237
  </SafeAreaProvider>
235
238
  </GestureHandlerRootView>
236
239
  )
@@ -0,0 +1,19 @@
1
+ import type { ReactNode } from 'react'
2
+ import { Platform } from 'react-native'
3
+ import { SafeAreaInsetsContext, useSafeAreaInsets } from 'react-native-safe-area-context'
4
+
5
+ // iPadOS 26 draws a window's controls (close, minimize, tile) over the app's top-left corner whenever the app runs
6
+ // in a window (resized, tiled beside another app, Slide Over), and the regular safe area makes no room for them, so
7
+ // every screen's top-left button (a game's Home, Home's trophy, a Back) sat under them and a tap opened the controls
8
+ // instead. UIKit's corner-adapted safe area does make room: the vertical one is the regular insets with the top
9
+ // lowered below the controls in a window, and the same as the regular ones in full screen. Measured on the iPad 13"
10
+ // simulator: top 32 both ways full screen, in portrait and landscape; in a 375x667 window, top 10 regular and 53
11
+ // vertical. So on iPad every screen below gets the vertical insets, and in a window the whole app sits below the
12
+ // controls, like under a title bar. Not on iPhone: it has no window controls, and its vertical inset grows by 18pt in
13
+ // landscape for the rounded corners, which would push every landscape screen down.
14
+ /** Inside the SafeAreaProvider: on iPad, hands every screen the safe area with room for the window controls. */
15
+ export function WindowControlsInsets({ children }: { children: ReactNode }) {
16
+ const vertical = useSafeAreaInsets({ cornerAdaptation: 'vertical' })
17
+ if (Platform.OS !== 'ios' || !Platform.isPad) return <>{children}</>
18
+ return <SafeAreaInsetsContext.Provider value={vertical}>{children}</SafeAreaInsetsContext.Provider>
19
+ }