You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RootNavigation.js 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import React from "react";
  2. import AppStack from "./AppStack";
  3. import AuthStack from "./AuthStack";
  4. import { SafeAreaView as SafeArea } from "react-native-safe-area-context";
  5. import { useSelector } from "react-redux";
  6. import { selectCurrentToken } from "@features/auth/authSlice";
  7. import { StatusBar } from "expo-status-bar";
  8. import { useTheme } from "@styles";
  9. import { Platform, SafeAreaView } from "react-native";
  10. const RootNavigation = () => {
  11. const { isDark, colors } = useTheme();
  12. const tokens = useSelector(selectCurrentToken);
  13. return !tokens ? (
  14. <>
  15. <StatusBar
  16. backgroundColor={colors.background}
  17. style={isDark ? "light" : "dark"}
  18. />
  19. <AuthStack />
  20. </>
  21. ) : Platform.OS === "ios" ? (
  22. <SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
  23. <StatusBar
  24. backgroundColor={colors.background}
  25. style={isDark ? "light" : "dark"}
  26. />
  27. <AppStack />
  28. </SafeAreaView>
  29. ) : (
  30. <SafeArea style={{ flex: 1 }} edges={["top"]}>
  31. <StatusBar
  32. backgroundColor={colors.background}
  33. style={isDark ? "light" : "dark"}
  34. />
  35. <AppStack />
  36. </SafeArea>
  37. );
  38. };
  39. export default RootNavigation;