Skip to content
Merged
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
15 changes: 14 additions & 1 deletion src/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import * as SplashScreen from 'expo-splash-screen';
import { StatusBar } from 'expo-status-bar';
import { useEffect } from 'react';
import { Appearance, Pressable, View, useColorScheme as useRNColorScheme } from 'react-native';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import FlashMessage from 'react-native-flash-message';
import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-context';

SplashScreen.preventAutoHideAsync().catch(() => {});

Expand All @@ -38,6 +39,17 @@ function BackHeader({ onBack }: { onBack: () => void }) {
);
}

/**
* Global mount for `showMessage()` (update checks, download notifications,
* domain switch). Without a <FlashMessage /> in the tree those toasts are
* silently dropped. Must live inside SafeAreaProvider; `statusBarHeight`
* keeps top-positioned messages below the status bar.
*/
function GlobalFlashMessage() {
const insets = useSafeAreaInsets();
return <FlashMessage position="top" statusBarHeight={insets.top} />;
}

export default function RootLayout() {
const [theme] = useThemeConfig();
const systemScheme = useRNColorScheme();
Expand Down Expand Up @@ -111,6 +123,7 @@ export default function RootLayout() {
</ErrorBoundary>
</GluestackUIProvider>
</BottomSheetModalProvider>
<GlobalFlashMessage />
</SafeAreaProvider>
</FlexGestureHandlerRootView>
);
Expand Down