@tastic/shell 0.17.0 → 0.17.1
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/README.md +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +24 -4
- package/dist/index.mjs +26 -6
- package/package.json +1 -1
- package/src/RootLayout.tsx +12 -2
- package/src/screens/HomeScreen.tsx +38 -5
package/README.md
CHANGED
|
@@ -125,7 +125,7 @@ PuckTastic and DuelTastic draw what they always did:
|
|
|
125
125
|
| `Backdrop?` | A table drawn once behind the whole stack (Solitaire's felt). The stack's two layers go transparent (the screens' `contentStyle` and the navigation theme's `colors.background`, which React Navigation paints around every screen), the root window stays dark so light mode doesn't flash white on a push, Android's push and pop crossfade (its default holds the outgoing screen opaque), and Home, each loadout, the stats screen and Profiles draw transparent, with their buttons and tabs on the theme's surface (a loadout's Ready buttons too, filled with the seat's color once ready). |
|
|
126
126
|
| `foreground?` | The color of what those screens draw straight on the background (the hero, the corner buttons, headers), and at half strength a loadout's muted options. Unset is black or white with the theme. |
|
|
127
127
|
| `Provider?` | Mounted once around How to Play and the stack, inside the store, the theme, profiles and every game's `Provider` (one stats context across the pack's games). |
|
|
128
|
-
| `useScreenOptions?` | A hook returning stack screen options (`StackScreenOptions`), merged after the shell's own (a status bar style of the pack's own, Reduce Motion's crossfade). The shell's already follow the app's theme, and stay dark over a `Backdrop`. |
|
|
128
|
+
| `useScreenOptions?` | A hook returning stack screen options (`StackScreenOptions`), merged after the shell's own (a status bar style of the pack's own, Reduce Motion's crossfade). The shell's already follow the app's theme, and stay dark over a `Backdrop`. They also slide a replaced screen in as a pop (`animationTypeForReplace: 'pop'`) on every screen but a play screen, since a replace there is a way back with nothing beneath to pop to (`safeBack`'s fallback to Home, a `dismissTo` whose screen isn't on the stack). |
|
|
129
129
|
| `useFeedbackSounds?` | A hook returning the two sounds every button plays (`FeedbackSounds`: `selection`, `notification`), in place of the shell's two wavs. |
|
|
130
130
|
| `Toaster?` | The pack's own toaster, drawn in a frame over the whole app (inside the safe area) in place of the shell's. The toast provider is given no Paper, so nothing portals it out of the frame. |
|
|
131
131
|
| `edgeGuard?` | `false` leaves Edge Guard out of Settings (no edge controls, no Edge Guard plugin), and out of the play screens' options on Android. |
|
|
@@ -164,7 +164,7 @@ What a game can leave out or add, each optional, so a two-seat game sets none of
|
|
|
164
164
|
| no `'cpu'` in `seatTwo` | A game with no CPU, such as `['nobody', 'person']`. Seat 2's saved choice is the whole pack's and starts on the CPU, so `seatTwoFor` reads a choice a game doesn't offer as the CPU where it has one, and as its first choice where it has none: a fresh install opens this game's loadout on that choice, its How to Play describes it, and `useActiveRound` falls back to it. The saved choice only changes when player 1 picks another. |
|
|
165
165
|
| no `useLoadout` | Nothing to set up first: Home opens its play screen straight away, after its How to Play the first time, and a link to its loadout plays it. Its rule variants go in its play screen's Settings: `<SettingsDialog>` takes `children`. |
|
|
166
166
|
| no `cpuDifficulty` (in `GameLoadout`) | A CPU with no levels: player 1's opponent menu offers one plain CPU. |
|
|
167
|
-
| `resumable` | A cold launch drops the player back into its play screen if they left the app there rather than backing out of it. The shell remembers only which game (`lastActiveGame`); the game saves and restores its own board. |
|
|
167
|
+
| `resumable` | A cold launch drops the player back into its play screen if they left the app there rather than backing out of it, with its loadout (when it has one) and Home beneath it, as if they'd walked there, so every way back is a pop. The shell remembers only which game (`lastActiveGame`); the game saves and restores its own board. |
|
|
168
168
|
| `Preview` | Drawn on Home in place of the icon (`GamePreviewProps`: `width`, `height`, the seats' colors, `dark`), in a box of `PREVIEW_ASPECT` (360:200), a frame after Home first paints. While any game has one, Home shows tiles: rows upright, and on a wide screen a grid beside the hero and seat 1's button. A game without one keeps its icon. |
|
|
169
169
|
| no `icon` | Only with a `Preview`, which Home draws in its place. |
|
|
170
170
|
| no `Provider` | A game whose stats live in the pack's own `Provider`. |
|
package/dist/index.d.mts
CHANGED
|
@@ -386,7 +386,7 @@ declare function EditProfileRoute(): react.JSX.Element;
|
|
|
386
386
|
declare function LoadoutRoute(): react.JSX.Element;
|
|
387
387
|
declare function PlayRoute(): react.JSX.Element;
|
|
388
388
|
|
|
389
|
-
declare function HomeScreen(): react.JSX.Element;
|
|
389
|
+
declare function HomeScreen(): react.JSX.Element | null;
|
|
390
390
|
|
|
391
391
|
declare const PREVIEW_ASPECT: number;
|
|
392
392
|
|
package/dist/index.d.ts
CHANGED
|
@@ -386,7 +386,7 @@ declare function EditProfileRoute(): react.JSX.Element;
|
|
|
386
386
|
declare function LoadoutRoute(): react.JSX.Element;
|
|
387
387
|
declare function PlayRoute(): react.JSX.Element;
|
|
388
388
|
|
|
389
|
-
declare function HomeScreen(): react.JSX.Element;
|
|
389
|
+
declare function HomeScreen(): react.JSX.Element | null;
|
|
390
390
|
|
|
391
391
|
declare const PREVIEW_ASPECT: number;
|
|
392
392
|
|
package/dist/index.js
CHANGED
|
@@ -490,6 +490,8 @@ function useProfiles() {
|
|
|
490
490
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
491
491
|
var PLAY_OPTIONS = { statusBarHidden: true };
|
|
492
492
|
var KEEP_STATUS_BAR_OPTIONS = {};
|
|
493
|
+
var REPLACE_AS_BACK = { animationTypeForReplace: "pop" };
|
|
494
|
+
var REPLACE_AS_FORWARD = { animationTypeForReplace: "push" };
|
|
493
495
|
var TRANSPARENT_CONTENT = { backgroundColor: "transparent" };
|
|
494
496
|
var noScreenOptions = () => ({});
|
|
495
497
|
function AppStack() {
|
|
@@ -508,7 +510,7 @@ function AppStack() {
|
|
|
508
510
|
({ route }) => {
|
|
509
511
|
const id = route.params?.game;
|
|
510
512
|
const statusBarOptions = pack.games.some((g) => g.id === id && g.keepStatusBar) ? KEEP_STATUS_BAR_OPTIONS : PLAY_OPTIONS;
|
|
511
|
-
return { ...statusBarOptions, ...edgeGuardOptions };
|
|
513
|
+
return { ...statusBarOptions, ...edgeGuardOptions, ...REPLACE_AS_FORWARD };
|
|
512
514
|
},
|
|
513
515
|
[pack.games, edgeGuardOptions]
|
|
514
516
|
);
|
|
@@ -517,7 +519,7 @@ function AppStack() {
|
|
|
517
519
|
const base = darkRoot ? import_expo_router.DarkTheme : import_expo_router.DefaultTheme;
|
|
518
520
|
return { ...base, colors: { ...base.colors, background: navigationBackground } };
|
|
519
521
|
}, [darkRoot, navigationBackground]);
|
|
520
|
-
const stack = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.ThemeProvider, { value: navigationTheme, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_expo_router.Stack, { screenOptions: { ...rootBackground, statusBarStyle, ...backdropOptions, ...packOptions }, children: [
|
|
522
|
+
const stack = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.ThemeProvider, { value: navigationTheme, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_expo_router.Stack, { screenOptions: { ...rootBackground, statusBarStyle, ...REPLACE_AS_BACK, ...backdropOptions, ...packOptions }, children: [
|
|
521
523
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.Stack.Screen, { name: "index" }),
|
|
522
524
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_expo_router.Stack.Screen, { name: "play/[game]", options: playOptions })
|
|
523
525
|
] }) });
|
|
@@ -1199,8 +1201,26 @@ function HomeScreen() {
|
|
|
1199
1201
|
(0, import_react16.useEffect)(() => {
|
|
1200
1202
|
if (!resumeGame) autoShowPack();
|
|
1201
1203
|
}, [resumeGame, autoShowPack]);
|
|
1202
|
-
|
|
1203
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(HomeMenu, {});
|
|
1204
|
+
useResume(resumeGame);
|
|
1205
|
+
return useMenuShown(!!resumeGame) ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(HomeMenu, {}) : null;
|
|
1206
|
+
}
|
|
1207
|
+
function useResume(game) {
|
|
1208
|
+
const pack = usePack();
|
|
1209
|
+
const done = (0, import_react16.useRef)(false);
|
|
1210
|
+
(0, import_expo_router9.useFocusEffect)(
|
|
1211
|
+
(0, import_react16.useCallback)(() => {
|
|
1212
|
+
if (!game || done.current) return;
|
|
1213
|
+
done.current = true;
|
|
1214
|
+
if (game.useLoadout) import_expo_router9.router.push(loadoutHref(game.id));
|
|
1215
|
+
import_expo_router9.router.push(pack.resumeHref?.(game.id) ?? playHref(game.id));
|
|
1216
|
+
}, [game, pack])
|
|
1217
|
+
);
|
|
1218
|
+
}
|
|
1219
|
+
function useMenuShown(resuming) {
|
|
1220
|
+
const isFocused = (0, import_expo_router9.useIsFocused)();
|
|
1221
|
+
const [covered, setCovered] = (0, import_react16.useState)(false);
|
|
1222
|
+
if (resuming && !covered && !isFocused) setCovered(true);
|
|
1223
|
+
return (0, import_react16.useDeferredValue)(!resuming || covered);
|
|
1204
1224
|
}
|
|
1205
1225
|
function HomeMenu() {
|
|
1206
1226
|
const pack = usePack();
|
package/dist/index.mjs
CHANGED
|
@@ -411,6 +411,8 @@ function useProfiles() {
|
|
|
411
411
|
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
412
412
|
var PLAY_OPTIONS = { statusBarHidden: true };
|
|
413
413
|
var KEEP_STATUS_BAR_OPTIONS = {};
|
|
414
|
+
var REPLACE_AS_BACK = { animationTypeForReplace: "pop" };
|
|
415
|
+
var REPLACE_AS_FORWARD = { animationTypeForReplace: "push" };
|
|
414
416
|
var TRANSPARENT_CONTENT = { backgroundColor: "transparent" };
|
|
415
417
|
var noScreenOptions = () => ({});
|
|
416
418
|
function AppStack() {
|
|
@@ -429,7 +431,7 @@ function AppStack() {
|
|
|
429
431
|
({ route }) => {
|
|
430
432
|
const id = route.params?.game;
|
|
431
433
|
const statusBarOptions = pack.games.some((g) => g.id === id && g.keepStatusBar) ? KEEP_STATUS_BAR_OPTIONS : PLAY_OPTIONS;
|
|
432
|
-
return { ...statusBarOptions, ...edgeGuardOptions };
|
|
434
|
+
return { ...statusBarOptions, ...edgeGuardOptions, ...REPLACE_AS_FORWARD };
|
|
433
435
|
},
|
|
434
436
|
[pack.games, edgeGuardOptions]
|
|
435
437
|
);
|
|
@@ -438,7 +440,7 @@ function AppStack() {
|
|
|
438
440
|
const base = darkRoot ? DarkTheme : DefaultTheme;
|
|
439
441
|
return { ...base, colors: { ...base.colors, background: navigationBackground } };
|
|
440
442
|
}, [darkRoot, navigationBackground]);
|
|
441
|
-
const stack = /* @__PURE__ */ jsx10(NavigationThemeProvider, { value: navigationTheme, children: /* @__PURE__ */ jsxs2(Stack, { screenOptions: { ...rootBackground, statusBarStyle, ...backdropOptions, ...packOptions }, children: [
|
|
443
|
+
const stack = /* @__PURE__ */ jsx10(NavigationThemeProvider, { value: navigationTheme, children: /* @__PURE__ */ jsxs2(Stack, { screenOptions: { ...rootBackground, statusBarStyle, ...REPLACE_AS_BACK, ...backdropOptions, ...packOptions }, children: [
|
|
442
444
|
/* @__PURE__ */ jsx10(Stack.Screen, { name: "index" }),
|
|
443
445
|
/* @__PURE__ */ jsx10(Stack.Screen, { name: "play/[game]", options: playOptions })
|
|
444
446
|
] }) });
|
|
@@ -1021,8 +1023,8 @@ import { defaultColors as defaultColors3, FadingScrollView, useAutoPaperTheme as
|
|
|
1021
1023
|
import { IconButton, Pressable } from "@rific/feedback-press";
|
|
1022
1024
|
import { PressAwayOverlay as PressAwayOverlay2, usePopoverHost as usePopoverHost2, useWellColors, WELL_SHADOW } from "@tastic/hud/chrome";
|
|
1023
1025
|
import { getProfilePickerContentSize, ProfilePicker } from "@tastic/profile";
|
|
1024
|
-
import {
|
|
1025
|
-
import { useCallback as useCallback10, useEffect as useEffect6, useMemo as useMemo6, useRef as useRef5, useState as useState6 } from "react";
|
|
1026
|
+
import { router as router5, useFocusEffect as useFocusEffect3, useIsFocused } from "expo-router";
|
|
1027
|
+
import { useCallback as useCallback10, useDeferredValue, useEffect as useEffect6, useMemo as useMemo6, useRef as useRef5, useState as useState6 } from "react";
|
|
1026
1028
|
import { AppState as AppState2, StyleSheet as StyleSheet4, View as View4 } from "react-native";
|
|
1027
1029
|
import { Icon, Portal, SegmentedButtons, Text } from "react-native-paper";
|
|
1028
1030
|
|
|
@@ -1120,8 +1122,26 @@ function HomeScreen() {
|
|
|
1120
1122
|
useEffect6(() => {
|
|
1121
1123
|
if (!resumeGame) autoShowPack();
|
|
1122
1124
|
}, [resumeGame, autoShowPack]);
|
|
1123
|
-
|
|
1124
|
-
return /* @__PURE__ */ jsx17(HomeMenu, {});
|
|
1125
|
+
useResume(resumeGame);
|
|
1126
|
+
return useMenuShown(!!resumeGame) ? /* @__PURE__ */ jsx17(HomeMenu, {}) : null;
|
|
1127
|
+
}
|
|
1128
|
+
function useResume(game) {
|
|
1129
|
+
const pack = usePack();
|
|
1130
|
+
const done = useRef5(false);
|
|
1131
|
+
useFocusEffect3(
|
|
1132
|
+
useCallback10(() => {
|
|
1133
|
+
if (!game || done.current) return;
|
|
1134
|
+
done.current = true;
|
|
1135
|
+
if (game.useLoadout) router5.push(loadoutHref(game.id));
|
|
1136
|
+
router5.push(pack.resumeHref?.(game.id) ?? playHref(game.id));
|
|
1137
|
+
}, [game, pack])
|
|
1138
|
+
);
|
|
1139
|
+
}
|
|
1140
|
+
function useMenuShown(resuming) {
|
|
1141
|
+
const isFocused = useIsFocused();
|
|
1142
|
+
const [covered, setCovered] = useState6(false);
|
|
1143
|
+
if (resuming && !covered && !isFocused) setCovered(true);
|
|
1144
|
+
return useDeferredValue(!resuming || covered);
|
|
1125
1145
|
}
|
|
1126
1146
|
function HomeMenu() {
|
|
1127
1147
|
const pack = usePack();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tastic/shell",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
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",
|
package/src/RootLayout.tsx
CHANGED
|
@@ -56,6 +56,16 @@ import type { PackDefinition, PackGameDefinition } from './types'
|
|
|
56
56
|
const PLAY_OPTIONS = { statusBarHidden: true }
|
|
57
57
|
const KEEP_STATUS_BAR_OPTIONS = {}
|
|
58
58
|
|
|
59
|
+
// Which way a replace slides on iOS (react-native-screens: the incoming screen's replaceAnimation picks
|
|
60
|
+
// it; a push unless told otherwise). A replace here is nearly always a way back with nothing beneath to
|
|
61
|
+
// pop to: safeBack's fallback to Home, a dismissTo whose screen isn't on the stack (a game's back to its
|
|
62
|
+
// setup screen after a deep link), a Redirect out of a game the pack doesn't have. So every screen slides
|
|
63
|
+
// a replace in as a pop, from the left, except a play screen, which a replace only ever opens (a loadout
|
|
64
|
+
// link to a game with nothing to set up). Android's crossfade over a backdrop and the web don't animate a
|
|
65
|
+
// direction.
|
|
66
|
+
const REPLACE_AS_BACK = { animationTypeForReplace: 'pop' as const }
|
|
67
|
+
const REPLACE_AS_FORWARD = { animationTypeForReplace: 'push' as const }
|
|
68
|
+
|
|
59
69
|
// The navigation theme is the root background too. React Navigation paints its theme's
|
|
60
70
|
// `colors.background` on the layers around every screen (the ScreenStack's container on native, each
|
|
61
71
|
// screen's wrapper on the web), and expo-router hands its container no theme, so that was always
|
|
@@ -95,7 +105,7 @@ function AppStack() {
|
|
|
95
105
|
({ route }: { route: { params?: object } }) => {
|
|
96
106
|
const id = (route.params as { game?: string } | undefined)?.game
|
|
97
107
|
const statusBarOptions = pack.games.some((g) => g.id === id && g.keepStatusBar) ? KEEP_STATUS_BAR_OPTIONS : PLAY_OPTIONS
|
|
98
|
-
return { ...statusBarOptions, ...edgeGuardOptions }
|
|
108
|
+
return { ...statusBarOptions, ...edgeGuardOptions, ...REPLACE_AS_FORWARD }
|
|
99
109
|
},
|
|
100
110
|
[pack.games, edgeGuardOptions]
|
|
101
111
|
)
|
|
@@ -106,7 +116,7 @@ function AppStack() {
|
|
|
106
116
|
}, [darkRoot, navigationBackground])
|
|
107
117
|
const stack = (
|
|
108
118
|
<NavigationThemeProvider value={navigationTheme}>
|
|
109
|
-
<Stack screenOptions={{ ...rootBackground, statusBarStyle, ...backdropOptions, ...packOptions }}>
|
|
119
|
+
<Stack screenOptions={{ ...rootBackground, statusBarStyle, ...REPLACE_AS_BACK, ...backdropOptions, ...packOptions }}>
|
|
110
120
|
<Stack.Screen name='index' />
|
|
111
121
|
<Stack.Screen name='play/[game]' options={playOptions} />
|
|
112
122
|
</Stack>
|
|
@@ -2,8 +2,8 @@ import { defaultColors, FadingScrollView, useAutoPaperTheme } from '@rific/auto-
|
|
|
2
2
|
import { IconButton, Pressable } from '@rific/feedback-press'
|
|
3
3
|
import { PressAwayOverlay, usePopoverHost, useWellColors, WELL_SHADOW } from '@tastic/hud/chrome'
|
|
4
4
|
import { getProfilePickerContentSize, type Profile, ProfilePicker, type ProfilePickerColorSection } from '@tastic/profile'
|
|
5
|
-
import {
|
|
6
|
-
import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
5
|
+
import { router, useFocusEffect, useIsFocused } from 'expo-router'
|
|
6
|
+
import { type ReactNode, useCallback, useDeferredValue, useEffect, useMemo, useRef, useState } from 'react'
|
|
7
7
|
import { AppState, type AppStateStatus, type LayoutChangeEvent, type NativeScrollEvent, type NativeSyntheticEvent, type ScrollView, StyleSheet, View } from 'react-native'
|
|
8
8
|
import { Icon, Portal, SegmentedButtons, Text } from 'react-native-paper'
|
|
9
9
|
|
|
@@ -28,7 +28,8 @@ import { HOME_GRID_GAP, HOME_LEFT_PANE_PICKER_GAP, HOME_TILE_PADDING, HOME_TOP_B
|
|
|
28
28
|
// (PackDefinition.homeTabs) shows one tab's games at a time, from a switch over the rows.
|
|
29
29
|
//
|
|
30
30
|
// A cold launch that finds the player left the app inside a resumable game's play screen
|
|
31
|
-
// (GameDefinition.resumable) goes straight back there instead, before the menu ever paints
|
|
31
|
+
// (GameDefinition.resumable) goes straight back there instead, before the menu ever paints, with the
|
|
32
|
+
// game's setup screen and this Home beneath it (useResume). The
|
|
32
33
|
// pack's own How to Play (PackDefinition.guide) shows by itself on a first launch, held back while
|
|
33
34
|
// that launch is about to drop into a game: it must never open over a game in progress.
|
|
34
35
|
export function HomeScreen() {
|
|
@@ -47,8 +48,40 @@ export function HomeScreen() {
|
|
|
47
48
|
useEffect(() => {
|
|
48
49
|
if (!resumeGame) autoShowPack()
|
|
49
50
|
}, [resumeGame, autoShowPack])
|
|
50
|
-
|
|
51
|
-
return <HomeMenu />
|
|
51
|
+
useResume(resumeGame)
|
|
52
|
+
return useMenuShown(!!resumeGame) ? <HomeMenu /> : null
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// The resume itself: the game's setup screen (when it has one), then its play screen (or where the pack
|
|
56
|
+
// says, PackDefinition.resumeHref), pushed over this Home, the stack the player had when they left. Every
|
|
57
|
+
// way back from there is then a pop, which slides the right way: the game's back to its setup screen, that
|
|
58
|
+
// one's back to Home, and Android's back the same (with the play screen alone on the stack, it closed the
|
|
59
|
+
// app). A Redirect replaced Home instead, and with nothing beneath the game each of those backs had to
|
|
60
|
+
// replace the screen too, which iOS animates as a push: the screen came in from the right, as if going
|
|
61
|
+
// forward. Run once, on focus, as Redirect runs its own (the stack is ready by then). Both pushes are
|
|
62
|
+
// queued in one go, so the stack takes them in one update and only the play screen slides in.
|
|
63
|
+
function useResume(game: PackGameDefinition | null) {
|
|
64
|
+
const pack = usePack()
|
|
65
|
+
const done = useRef(false)
|
|
66
|
+
useFocusEffect(
|
|
67
|
+
useCallback(() => {
|
|
68
|
+
if (!game || done.current) return
|
|
69
|
+
done.current = true
|
|
70
|
+
if (game.useLoadout) router.push(loadoutHref(game.id))
|
|
71
|
+
router.push(pack.resumeHref?.(game.id) ?? playHref(game.id))
|
|
72
|
+
}, [game, pack])
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Whether Home draws its menu. A Home resuming a game draws nothing until the game covers it (Home no
|
|
77
|
+
// longer focused), so a launch never shows the menu ahead of the game, and then draws it at low priority
|
|
78
|
+
// (useDeferredValue), behind the game's own first renders. From then on it's mounted beneath the game like
|
|
79
|
+
// any Home that opened one, so going back to it is quick.
|
|
80
|
+
function useMenuShown(resuming: boolean): boolean {
|
|
81
|
+
const isFocused = useIsFocused()
|
|
82
|
+
const [covered, setCovered] = useState(false)
|
|
83
|
+
if (resuming && !covered && !isFocused) setCovered(true)
|
|
84
|
+
return useDeferredValue(!resuming || covered)
|
|
52
85
|
}
|
|
53
86
|
|
|
54
87
|
function HomeMenu() {
|