Skip to content

Commit

Permalink
fix: fix splash screen aspect ratio issue
Browse files Browse the repository at this point in the history
  • Loading branch information
akmalhisyammm committed Dec 7, 2021
1 parent c3498f9 commit c558d7e
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 10 deletions.
10 changes: 10 additions & 0 deletions capacitor.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ const config: CapacitorConfig = {
appName: 'KlikDarurat',
webDir: 'build',
bundledWebRuntime: false,
plugins: {
SplashScreen: {
launchAutoHide: false,
androidSplashResourceName: 'splash',
androidScaleType: 'CENTER_CROP',
splashFullScreen: true,
splashImmersive: false,
backgroundColor: '#384e78',
},
},
};

export default config;
15 changes: 15 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 @@ -20,6 +20,7 @@
"@capacitor/geolocation": "^1.1.3",
"@capacitor/haptics": "1.1.3",
"@capacitor/keyboard": "1.1.3",
"@capacitor/splash-screen": "^1.1.6",
"@capacitor/status-bar": "1.0.6",
"@ionic/pwa-elements": "^3.0.2",
"@ionic/react": "^5.5.0",
Expand Down
30 changes: 20 additions & 10 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { useEffect } from 'react';
import { IonApp, IonSplitPane } from '@ionic/react';
import { IonReactRouter } from '@ionic/react-router';
import { SplashScreen } from '@capacitor/splash-screen';

import Routes from 'components/routes/Routes';
import SideMenu from 'components/SideMenu';
Expand All @@ -24,15 +26,23 @@ import '@ionic/react/css/display.css';
import 'theme/variables.css';
import 'theme/customTheme.css';

const App: React.FC = () => (
<IonApp>
<IonReactRouter>
<IonSplitPane contentId="main">
<SideMenu />
<Routes />
</IonSplitPane>
</IonReactRouter>
</IonApp>
);
const App: React.FC = () => {
useEffect(() => {
setTimeout(() => {
SplashScreen.hide({ fadeOutDuration: 300 });
}, 100);
}, []);

return (
<IonApp>
<IonReactRouter>
<IonSplitPane contentId="main">
<SideMenu />
<Routes />
</IonSplitPane>
</IonReactRouter>
</IonApp>
);
};

export default App;

0 comments on commit c558d7e

Please sign in to comment.