From da80bde03849730e55079651b8d49804d3db760a Mon Sep 17 00:00:00 2001 From: Joseph Hale Date: Fri, 15 Aug 2025 22:40:54 -0700 Subject: [PATCH] feat: Load settings before dismissing splash screen Avoid the jump that occurs between the initial application of default settings while waiting for the actual customizations to load from persistent storage. --- src/App.tsx | 14 ++++++++------ src/init.js | 13 +++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 src/init.js diff --git a/src/App.tsx b/src/App.tsx index 4102bd2..a963d45 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,16 +2,18 @@ // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. +// file, You can obtain one at https://mozilla.org/MPL/2.0/. import BinaryClockScreen from './pages/BinaryClockScreen'; -import BootSplash from 'react-native-bootsplash'; import { KeepAwake } from '@thehale/react-native-keep-awake'; +import { useState } from 'react'; import { StatusBar } from 'react-native'; +import { init } from './init'; -const App = () => { - BootSplash.hide({fade: true}); - return ( +function App() { + const [initialized, setInitialized] = useState(false); + init().then(() => setInitialized(true)) + return initialized && ( <>