So I recently made an app which uses Expo SQLite package to store items. My goal was obviously to keep the data saved when a user closes the app and then opens it again. It works perfectly fine inside the Expo Go app, but when I ran eas build -p android --profile preview
to build an apk file, the database could not be loaded because I made the app not to load until the database was initialized. Like this:
const [DBIsInitialized, setDBIsInitialized] = useState(false);
useEffect(() => {
async function prepare() {
try {
await createDatabase();
setDBIsInitialized(true);
} catch (error) {
console.warn(error);
}
}
prepare();
}, []);
const onLayoutRootView = useCallback(async () => {
if (DBIsInitialized) {
await SplashScreen.hideAsync();
}
}, [DBIsInitialized]);
if (!DBIsInitialized) {
return null;
}
I've already asked a developer about this and he says that it's probably because the database needs to be stored inside the device storage. Is that right?
Expo SQLite version: ~11.1.1
Any solutions for this? Your help will be appreciated.