diff --git a/navigation/index.js b/navigation/index.js index e273c36..e465044 100644 --- a/navigation/index.js +++ b/navigation/index.js @@ -3,6 +3,7 @@ import { Restart } from "fiction-expo-restart"; import { I18nManager, StatusBar, Dimensions } from "react-native"; import * as Linking from "expo-linking"; import Svg, { G, Path } from "react-native-svg"; +import {asyncAwesomeAlert} from "../src/utils/AsyncWrappers"; import { NavigationContainer } from "@react-navigation/native"; import { createNativeStackNavigator } from "@react-navigation/native-stack"; import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; @@ -610,6 +611,7 @@ const Navigation = ({ ); }, []); + Dimensions.addEventListener("change", () => { const dim = Dimensions.get("window"); setOrientation(dim.height > dim.width ? "portrait" : "landscape"); diff --git a/package.json b/package.json index 778c348..83398bb 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "dependencies": { "@expo-google-fonts/noto-sans": "^0.2.0", "@react-native-async-storage/async-storage": "~1.15.0", + "@react-native-community/netinfo": "7.1.3", "@react-native-community/slider": "4.1.12", "@react-navigation/bottom-tabs": "^6.0.9", "@react-navigation/drawer": "^6.1.8", diff --git a/src/redux/actions/public.js b/src/redux/actions/public.js index 9bd7d7f..aa98eb9 100644 --- a/src/redux/actions/public.js +++ b/src/redux/actions/public.js @@ -1,5 +1,7 @@ import proxy from "../proxy"; const publicApi = { + setOffline : (data) => async (dispatch) => + await dispatch({ type: "public/setOffline", data }), setOrientation: (data) => async (dispatch) => await dispatch({ type: "public/setOrientation", data }), setLTR: (data) => async (dispatch) => diff --git a/src/redux/reducers/public.js b/src/redux/reducers/public.js index 2a788c1..84be686 100644 --- a/src/redux/reducers/public.js +++ b/src/redux/reducers/public.js @@ -9,6 +9,7 @@ const initialState = { mobile: width < 720, orientation: height > width ? "portrait" : "landscape", homeData: [], + offline: false, newProducts: [], levels: [], loading: false, @@ -79,6 +80,8 @@ const grades = [ const publicApi = (state = initialState, action) => { let { type, data } = action; switch (type) { + case "public/setOffline": + return { ...state, offline: data, error: null, loading: false }; case "public/setOrientation": return { ...state, orientation: data, error: null, loading: false }; case "public/setLtr": diff --git a/src/screens/Splash/index.js b/src/screens/Splash/index.js index 71f2a32..f4a6a4d 100644 --- a/src/screens/Splash/index.js +++ b/src/screens/Splash/index.js @@ -16,8 +16,12 @@ import Logo from "../../assets/images/logo.png"; const { width } = Dimensions.get("window"); +//style +import Colors from "../../constants/Colors"; + function Splash({ navigation, + theme, isLogin, blogs, getBlogs, @@ -26,7 +30,6 @@ function Splash({ userProducts, getUserProducts, setIsDark, - theme, }) { const isFocused = useIsFocused(); const [out, setOut] = React.useState(false); @@ -40,7 +43,7 @@ function Splash({ const getTheme = async () => { const theme = await AsyncStorage.getItem("theme"); - setIsDark(theme); + setIsDark(!theme ? "light" : theme); }; const setOutHandler = React.useCallback( @@ -121,7 +124,11 @@ function Splash({ }} /> - + ); } diff --git a/yarn.lock b/yarn.lock index 51434c0..1aecdfd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1519,6 +1519,11 @@ sudo-prompt "^9.0.0" wcwidth "^1.0.1" +"@react-native-community/netinfo@7.1.3": + version "7.1.3" + resolved "https://registry.yarnpkg.com/@react-native-community/netinfo/-/netinfo-7.1.3.tgz#518d753a9ac08f1e59562c5d4168193584fd7329" + integrity sha512-E8q3yuges6NYhrXBDQdzwCnG0bBQXATRjs6fpTjRJ37nURmdpe4HLq1awvooG4ymGTpZhrx4elcs/aUM7PTgrA== + "@react-native-community/slider@4.1.12": version "4.1.12" resolved "https://registry.yarnpkg.com/@react-native-community/slider/-/slider-4.1.12.tgz#279ff7bbe487af92ad95ec758a029a54569e2a62"