Browse Source

FIX | Fix the language storage| Loading-screen file

merge-requests/7/head
JetUp 2 years ago
parent
commit
1405ffa7a9
  1. 1
      src/module/package/atoms/create-custom-package.atom.tsx
  2. 18
      src/module/root/navigations-groups/on-boardings-group.tsx
  3. 35
      src/module/root/screens/loading-screen.tsx

1
src/module/package/atoms/create-custom-package.atom.tsx

@ -1,3 +1,4 @@ @@ -1,3 +1,4 @@
import AsyncStorage from '@react-native-async-storage/async-storage';
import React from 'react';
import {StyleSheet, TouchableOpacity, View, Text} from 'react-native';
import {colors, Icon} from '../../shared';

18
src/module/root/navigations-groups/on-boardings-group.tsx

@ -9,14 +9,24 @@ import {Questions} from '../screens/questions'; @@ -9,14 +9,24 @@ import {Questions} from '../screens/questions';
import {PrivacyPolicy} from '../../privacy-policy/screens/privacy-policy';
import {UseOfTerms} from '../../terms-of-use/screens/use-of-terms';
import firestore from '@react-native-firebase/firestore';
import { useAppDispatch, useAppSelector } from '../../../store/hooks';
import { fetchPostsAsync, selectPosts } from '../../services/game-items/game-items-slice';
// console.log(usersCollection);
import AsyncStorage from '@react-native-async-storage/async-storage';
const Stack = createNativeStackNavigator();
export const OnboardingGroup: FC = () => {
// const fetchAllItems = async () => {
// try {
// AsyncStorage.clear();
// const keys = await AsyncStorage.getAllKeys()
// const items = await AsyncStorage.multiGet(keys)
// return items
// } catch (error) {
// console.log(error, "problemo")
// }
// }
// fetchAllItems()
const submitPost = async () => {
firestore()
.collection('GameItems')

35
src/module/root/screens/loading-screen.tsx

@ -10,9 +10,9 @@ import {ScreenLayout, colors, RouteKey} from '../../shared'; @@ -10,9 +10,9 @@ import {ScreenLayout, colors, RouteKey} from '../../shared';
import AsyncStorage from '@react-native-async-storage/async-storage';
import {useNavigation, CommonActions} from '@react-navigation/native';
import {StorageKey, storageService} from '../../services/async-storage.service';
import { useTranslation } from 'react-i18next';
import { useAppDispatch } from '../../../store/hooks';
import { fetchPostsAsync } from '../../services/game-items/game-items-slice';
import {useTranslation} from 'react-i18next';
import {useAppDispatch} from '../../../store/hooks';
import {fetchPostsAsync} from '../../services/game-items/game-items-slice';
export const LoadingScreen = () => {
const {i18n} = useTranslation();
@ -35,25 +35,36 @@ export const LoadingScreen = () => { @@ -35,25 +35,36 @@ export const LoadingScreen = () => {
const isOnBoard = await getOnboardEnd();
dispatch(fetchPostsAsync());
console.log(language);
if (language) {
i18n.changeLanguage(language);
}
if (isOnBoard && language) {
navigate.navigate(RouteKey.Game as any);
navigate.dispatch(
CommonActions.reset({
index: 0,
routes: [{name: RouteKey.Game}],
}),
);
} else if (language && !isOnBoard) {
navigate.navigate(RouteKey.Onboarding as any);
navigate.dispatch(
CommonActions.reset({
index: 0,
routes: [{name: RouteKey.Onboarding}],
}),
);
} else if (!language) {
navigate.navigate(RouteKey.LanguageSelect as any);
navigate.dispatch(
CommonActions.reset({
index: 0,
routes: [{name: RouteKey.LanguageSelect}],
}),
);
}
navigate.dispatch(CommonActions.reset({
index: 0,
routes: [{name: RouteKey.Game}]
}));
};
useEffect(() => {
init();
}, []);

Loading…
Cancel
Save