Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 Corrige l'erreur Sentry : Current activity not found #1718

Merged
merged 1 commit into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions front/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as Font from "expo-font";
import * as SplashScreen from "expo-splash-screen";
import { StatusBar } from "expo-status-bar";
import type { FC } from "react";
import * as React from "react";
Expand Down Expand Up @@ -30,6 +31,9 @@ import {
TrackerUtils,
} from "./src/utils";

// Keep the splash screen visible while we fetch resources
void SplashScreen.preventAutoHideAsync();

setNotificationHandler();
initLocales();
initMonitoring();
Expand Down Expand Up @@ -138,17 +142,24 @@ const MainAppContainer: FC = () => {

void init();
// Permet de détecter lorsque l'app change d'état ('active' | 'background' | 'inactive' | 'unknown' | 'extension')
AppState.addEventListener("change", handleAppStateChange);
const subscription = AppState.addEventListener(
"change",
handleAppStateChange
);

return () => {
AppState.removeEventListener("change", handleAppStateChange);
subscription.remove();
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

useEffect(() => {
if (isLoadingComplete && fontsLoaded && appCounterIsLoaded) {
setScreenCanBeDisplayed(true);
const hideSplashScreen = async () => {
await SplashScreen.hideAsync();
setScreenCanBeDisplayed(true);
};
void hideSplashScreen();
}
}, [isLoadingComplete, fontsLoaded, appCounterIsLoaded]);

Expand Down
4 changes: 0 additions & 4 deletions front/src/hooks/useCachedResources.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Ionicons } from "@expo/vector-icons";
import * as Font from "expo-font";
import * as SplashScreen from "expo-splash-screen";
import { useEffect, useState } from "react";

const useCachedResources = (): boolean => {
Expand All @@ -10,8 +9,6 @@ const useCachedResources = (): boolean => {
useEffect(() => {
async function loadResourcesAndDataAsync() {
try {
void SplashScreen.preventAutoHideAsync();

// Load fonts
await Font.loadAsync({
...Ionicons.font,
Expand All @@ -34,7 +31,6 @@ const useCachedResources = (): boolean => {
console.warn(error);
} finally {
setLoadingComplete(true);
void SplashScreen.hideAsync();
}
}

Expand Down
Loading