Skip to content

Commit

Permalink
feat: show splash-screen
Browse files Browse the repository at this point in the history
- install package @capacitor/[email protected]
- update capcitor configuration
- update ios podfile
  • Loading branch information
SimonGolms committed Jan 28, 2021
1 parent ecce884 commit c8a8954
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 2 deletions.
17 changes: 16 additions & 1 deletion capacitor.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,20 @@
"bundledWebRuntime": false,
"npmClient": "npm",
"webDir": "build",
"cordova": {}
"cordova": {},
"plugins": {
"SplashScreen": {
"launchShowDuration": 3000,
"launchAutoHide": true,
"backgroundColor": "#ffffffff",
"androidSplashResourceName": "splash",
"androidScaleType": "CENTER_CROP",
"androidSpinnerStyle": "large",
"iosSpinnerStyle": "small",
"spinnerColor": "#999999",
"showSpinner": false,
"splashFullScreen": true,
"splashImmersive": true
}
},
}
17 changes: 16 additions & 1 deletion ios/App/App/capacitor.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,20 @@
"bundledWebRuntime": false,
"npmClient": "npm",
"webDir": "build",
"cordova": {}
"cordova": {},
"plugins": {
"SplashScreen": {
"launchShowDuration": 3000,
"launchAutoHide": true,
"backgroundColor": "#ffffffff",
"androidSplashResourceName": "splash",
"androidScaleType": "CENTER_CROP",
"androidSpinnerStyle": "large",
"iosSpinnerStyle": "small",
"spinnerColor": "#999999",
"showSpinner": false,
"splashFullScreen": true,
"splashImmersive": true
}
},
}
1 change: 1 addition & 0 deletions ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ install! 'cocoapods', :disable_input_output_paths => true
def capacitor_pods
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen'
pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
pod 'CapacitorStorage', :path => '../../node_modules/@capacitor/storage'
end
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@capacitor/android": "^3.0.0-beta.1",
"@capacitor/core": "^3.0.0-beta.1",
"@capacitor/ios": "^3.0.0-beta.1",
"@capacitor/splash-screen": "^0.3.1",
"@capacitor/status-bar": "^0.4.0",
"@capacitor/storage": "^0.3.0",
"@ionic/react": "^5.5.2",
Expand Down
7 changes: 7 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { StatusBar, Style } from '@capacitor/status-bar';
import { SplashScreen } from '@capacitor/splash-screen';
import {
getPlatforms,
IonApp,
Expand Down Expand Up @@ -48,6 +49,12 @@ const App: React.FC = () => {
if (platforms.includes('capacitor')) {
setStatusBarStyleDark();
}

// NOTE: Current workaround to still show splash-screen until app is finally rendered
SplashScreen.show({
showDuration: 750,
autoHide: true,
});
}, []);

return (
Expand Down

0 comments on commit c8a8954

Please sign in to comment.