Skip to content

Commit

Permalink
feat: splash screen hiding is synchronized with app setup (#1727)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeharding authored Nov 16, 2024
1 parent 642d2b9 commit 2b9e0d0
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 1 deletion.
3 changes: 3 additions & 0 deletions capacitor.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const config: CapacitorConfig = {
resize: KeyboardResize.Ionic,
resizeOnFullScreen: true,
},
SplashScreen: {
launchShowDuration: 3_000,
},
},
};

Expand Down
1 change: 1 addition & 0 deletions ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def capacitor_pods
pod 'CapacitorKeyboard', :path => '../../node_modules/.pnpm/@[email protected]_patch_hash=2ihcxo2fu55l7b6g5u7feswwlm_@[email protected]/node_modules/@capacitor/keyboard'
pod 'CapacitorNetwork', :path => '../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/network'
pod 'CapacitorShare', :path => '../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/share'
pod 'CapacitorSplashScreen', :path => '../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/splash-screen'
pod 'CapacitorStatusBar', :path => '../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/status-bar'
pod 'CapacitorAndroidNavMode', :path => '../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/capacitor-android-nav-mode'
pod 'CapacitorApplicationContext', :path => '../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/capacitor-application-context'
Expand Down
8 changes: 7 additions & 1 deletion ios/App/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ PODS:
- Capacitor
- CapacitorShare (6.0.2):
- Capacitor
- CapacitorSplashScreen (6.0.2):
- Capacitor
- CapacitorStashMedia (2.0.1):
- Capacitor
- SDWebImage
Expand Down Expand Up @@ -58,6 +60,7 @@ DEPENDENCIES:
- "CapacitorNetwork (from `../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/network`)"
- "CapacitorPluginSafeArea (from `../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/capacitor-plugin-safe-area`)"
- "CapacitorShare (from `../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/share`)"
- "CapacitorSplashScreen (from `../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/splash-screen`)"
- "CapacitorStashMedia (from `../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/capacitor-stash-media`)"
- "CapacitorStatusBar (from `../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/status-bar`)"
- "CapacitorTips (from `../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/capacitor-tips`)"
Expand Down Expand Up @@ -99,6 +102,8 @@ EXTERNAL SOURCES:
:path: "../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/capacitor-plugin-safe-area"
CapacitorShare:
:path: "../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/share"
CapacitorSplashScreen:
:path: "../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/splash-screen"
CapacitorStashMedia:
:path: "../../node_modules/.pnpm/[email protected]_@[email protected]/node_modules/capacitor-stash-media"
CapacitorStatusBar:
Expand All @@ -123,11 +128,12 @@ SPEC CHECKSUMS:
CapacitorNetwork: 8796cf1f1104a00b289957b6150b7c60e1c2a8d3
CapacitorPluginSafeArea: e1eca7f70974f0e270d96f70cd0a5f51523164b1
CapacitorShare: 591ae4693d85686ceb590db8e8b44aa014ec6490
CapacitorSplashScreen: 250df9ef8014fac5c7c1fd231f0f8b1d8f0b5624
CapacitorStashMedia: 10aa96dc5f874c4c27642528a4c327c46792abf2
CapacitorStatusBar: b81d4fb5d4e0064c712018071b3ab4b810b39a63
CapacitorTips: 2087733aea06ec041b210085395ca934c8554907
SDWebImage: 750adf017a315a280c60fde706ab1e552a3ae4e9

PODFILE CHECKSUM: 4bb941cdad3a08d4337f1a3589da9a7a0f40fd60
PODFILE CHECKSUM: 4c9660cfea3867fdae44143cfbe378717ec31aa0

COCOAPODS: 1.16.2
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@capacitor/keyboard": "^6.0.2",
"@capacitor/network": "^6.0.2",
"@capacitor/share": "^6.0.2",
"@capacitor/splash-screen": "^6.0.2",
"@capacitor/status-bar": "^6.0.1",
"@github/markdown-toolbar-element": "^2.2.3",
"@ionic/core": "npm:[email protected]",
Expand Down
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/routes/TabbedRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SplashScreen } from "@capacitor/splash-screen";
import { IonRouterOutletCustomEvent } from "@ionic/core";
import { IonRouterOutlet, IonTabs } from "@ionic/react";
import { useContext, useEffect, useMemo, useRef } from "react";
Expand Down Expand Up @@ -36,6 +37,12 @@ export default function TabbedRoutes({ children }: React.PropsWithChildren) {

const pageContextValue = useMemo(() => ({ pageRef }), []);

useEffect(() => {
if (!ready) return;

SplashScreen.hide();
}, [ready]);

if (!ready) return;

return (
Expand Down

0 comments on commit 2b9e0d0

Please sign in to comment.