Skip to content

Commit

Permalink
fix: reload app if direction is not RTL
Browse files Browse the repository at this point in the history
  • Loading branch information
obeim committed Feb 4, 2024
1 parent 1153e71 commit 7f5086e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 217 deletions.
8 changes: 4 additions & 4 deletions app/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { useCallback, type ReactNode } from "react";
import { SplashScreen, Stack } from "expo-router";
import { SafeAreaView, StatusBar, StyleSheet, I18nManager } from "react-native";
import { SafeAreaView, StyleSheet, I18nManager } from "react-native";
import { useFonts } from "expo-font";
import * as Updates from "expo-updates";
import { openDatabase } from "@/db/utils";
import { QueryClient, QueryClientProvider } from "react-query";
import { useColorScheme } from "nativewind";
import RNAppRestart from "@brandingbrand/react-native-app-restart";

SplashScreen.preventAutoHideAsync();
export default function RootLayout(): ReactNode {
const queryClient = new QueryClient();
const { colorScheme, toggleColorScheme } = useColorScheme();
const { colorScheme } = useColorScheme();

const [fontsLoaded, fontError] = useFonts({
"HelveticaNeueLTArabic-Bold": require("../assets/fonts/HelveticaNeueLTArabic-Bold.ttf"),
Expand All @@ -22,7 +22,7 @@ export default function RootLayout(): ReactNode {

I18nManager.allowRTL(true);
I18nManager.forceRTL(true);
if (!I18nManager.isRTL) Updates.reloadAsync();
if (!I18nManager.isRTL) RNAppRestart.restartApplication();

const onLayoutRootView = useCallback(async () => {
if (fontsLoaded || fontError) {
Expand Down
228 changes: 16 additions & 212 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"preset": "jest-expo"
},
"dependencies": {
"@brandingbrand/react-native-app-restart": "^0.4.0",
"@expo/vector-icons": "^13.0.0",
"@react-navigation/native": "^6.0.2",
"expo": "49.0.21",
Expand All @@ -28,7 +29,6 @@
"expo-sqlite-orm": "^2.1.0",
"expo-status-bar": "~1.6.0",
"expo-system-ui": "~2.4.0",
"expo-updates": "~0.18.19",
"expo-web-browser": "~12.3.2",
"nativewind": "^2.0.11",
"react": "18.2.0",
Expand Down

0 comments on commit 7f5086e

Please sign in to comment.