From 96411033a04667220db8b75ab63b6d6d2b0a5298 Mon Sep 17 00:00:00 2001 From: Aman Mittal Date: Thu, 3 Oct 2024 23:41:39 +0530 Subject: [PATCH] Render StatusBar before app loads in StickerSmash app (#518) ## Why Using the `StatusBar` component in the child component or root layout of Expo Router does not affect the status bar style changes (applied through code) every time the app is re-rendered in the dev mode. Using `setStatusBar` with a `useEffect` ensures that any time the app loads, the status bar style is applied before app loads. --- stickersmash/app/(tabs)/index.tsx | 80 +++++++++++++++---------------- stickersmash/app/_layout.tsx | 9 +++- 2 files changed, 46 insertions(+), 43 deletions(-) diff --git a/stickersmash/app/(tabs)/index.tsx b/stickersmash/app/(tabs)/index.tsx index ff6498dd..fad14e07 100644 --- a/stickersmash/app/(tabs)/index.tsx +++ b/stickersmash/app/(tabs)/index.tsx @@ -5,7 +5,6 @@ import { GestureHandlerRootView } from "react-native-gesture-handler"; import * as MediaLibrary from "expo-media-library"; import { captureRef } from "react-native-view-shot"; import domtoimage from "dom-to-image"; -import { StatusBar } from "expo-status-bar"; import Button from "@/components/Button"; import ImageViewer from "@/components/ImageViewer"; @@ -92,50 +91,47 @@ export default function Index() { }; return ( - <> - - - - - {pickedEmoji && ( - - )} - + + + + + {pickedEmoji && ( + + )} - {showAppOptions ? ( - - - - - - - - ) : ( - -