reza fixed soemthing

master
Reza_ashrafi 3 years ago
parent e9ab15b696
commit 7505ab4ee0
  1. 14
      src/screens/AR/index.js
  2. 7
      src/screens/Activation/index.js
  3. 7
      src/screens/Address/index.js
  4. 19
      src/screens/Blog/index.js
  5. 11
      src/screens/Blogs/index.js
  6. 26
      src/screens/Contact/index.js
  7. 2
      src/screens/Contact/layouts/TicketStatus.js
  8. 24
      src/screens/DeliveryForm/index.js
  9. 22
      src/screens/Faq/index.js
  10. 2
      src/screens/Home/components/Videos.js
  11. 6
      src/screens/Home/index.js
  12. 8
      src/screens/Login/index.js
  13. 9
      src/screens/OrderDetails/index.js
  14. 10
      src/screens/OrdersFollowUp/index.js
  15. 36
      src/screens/Otp/index.js
  16. 6
      src/screens/Profile/components/Trophy.js
  17. 4
      src/screens/QR/index.js
  18. 13
      src/screens/QR/layouts/Scan/index.js
  19. 17
      src/screens/QRContent/Content/Links.js
  20. 19
      src/screens/QRContent/Content/PDF.js
  21. 13
      src/screens/QRContent/Content/PPT.js
  22. 17
      src/screens/QRContent/Content/Video.js
  23. 15
      src/screens/QRContent/Content/Voice.js
  24. 47
      src/screens/QRContent/Content/index.js
  25. 180
      src/screens/QRContent/Tab/index.js
  26. 17
      src/screens/QRContent/index.js
  27. 27
      src/screens/Splash/index.js

@ -23,13 +23,24 @@ import tw from "tailwind-rn";
const { height } = Dimensions.get("window"); const { height } = Dimensions.get("window");
const ios = Platform.OS === "ios"; const ios = Platform.OS === "ios";
function AR({ getArList, arList, mobile }) { function AR({ getArList, arList, mobile, theme }) {
const [position, setPosition] = useState("100%"); const [position, setPosition] = useState("100%");
useEffect(() => { useEffect(() => {
getArList(); getArList();
StatusBar.setBarStyle(
`${theme === "light" ? "dark" : "light"}-content`,
true
);
}, []); }, []);
useEffect(() => {
StatusBar.setBarStyle(
`${theme === "light" ? "dark" : "light"}-content`,
true
);
}, [theme]);
const setBoxPosition = () => { const setBoxPosition = () => {
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
setPosition(position === "100%" ? "0%" : "100%"); setPosition(position === "100%" ? "0%" : "100%");
@ -90,6 +101,7 @@ function AR({ getArList, arList, mobile }) {
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
arList: state.publicApi.arList, arList: state.publicApi.arList,
mobile: state.publicApi.mobile, mobile: state.publicApi.mobile,
theme: state.publicApi.theme
}); });
const mapDispatchToProps = { const mapDispatchToProps = {

@ -40,6 +40,13 @@ function Activation({ add, mobile, theme, route }) {
const navigation = useNavigation(); const navigation = useNavigation();
const insets = useSafeAreaInsets(); const insets = useSafeAreaInsets();
React.useEffect(() => {
StatusBar.setBarStyle(
`${theme === "light" ? "dark" : "light"}-content`,
true
);
}, [theme]);
return ( return (
<SafeAreaView <SafeAreaView
style={[ style={[

@ -90,6 +90,13 @@ const Address = ({
}); });
}, []); }, []);
useEffect(() => {
StatusBar.setBarStyle(
`${theme === "light" ? "dark" : "light"}-content`,
true
);
}, [theme]);
useEffect(() => { useEffect(() => {
if (addressFields?.provinceId) { if (addressFields?.provinceId) {
getCity({ getCity({

@ -51,6 +51,13 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
} }
}, []); }, []);
useEffect(() => {
StatusBar.setBarStyle(
`${theme === "light" ? "dark" : "light"}-content`,
true
);
}, [theme]);
return ( return (
<SafeAreaView <SafeAreaView
style={{ style={{
@ -186,8 +193,8 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
? Colors.theme1.gray20 ? Colors.theme1.gray20
: Colors.theme1.grayF9, : Colors.theme1.grayF9,
textAlign: "right", textAlign: "right",
fontFamily : 'light', fontFamily: "light",
lineHeight: 25 lineHeight: 25,
}, },
strong: { strong: {
color: color:
@ -195,8 +202,8 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
? Colors.theme1.gray20 ? Colors.theme1.gray20
: Colors.theme1.grayF9, : Colors.theme1.grayF9,
textAlign: "right", textAlign: "right",
fontFamily : 'light', fontFamily: "light",
lineHeight: 25 lineHeight: 25,
}, },
ul: { ul: {
textAlign: "right", textAlign: "right",
@ -207,8 +214,8 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
? Colors.theme1.gray20 ? Colors.theme1.gray20
: Colors.theme1.grayF9, : Colors.theme1.grayF9,
textAlign: "right", textAlign: "right",
fontFamily : 'light', fontFamily: "light",
lineHeight: 25 lineHeight: 25,
}, },
}} }}
/> />

@ -10,7 +10,7 @@ import {
Dimensions, Dimensions,
Image, Image,
Text, Text,
Pressable Pressable,
} from "react-native"; } from "react-native";
import { connect } from "react-redux"; import { connect } from "react-redux";
@ -42,6 +42,13 @@ function Blogs({ getList, blogs, hashtag, setHashtag, theme }) {
setHashtag(null); setHashtag(null);
}, []); }, []);
useEffect(() => {
StatusBar.setBarStyle(
`${theme === "light" ? "dark" : "light"}-content`,
true
);
}, [theme]);
const setBoxPosition = () => { const setBoxPosition = () => {
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
setPosition(position === "100%" ? "0%" : "100%"); setPosition(position === "100%" ? "0%" : "100%");
@ -146,7 +153,7 @@ const HashtagBlog = ({ blog, theme }) => {
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
blogs: state.blog.list, blogs: state.blog.list,
hashtag: state.blog.hashtag, hashtag: state.blog.hashtag,
theme : state.publicApi.theme theme: state.publicApi.theme,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {

@ -6,7 +6,7 @@ import {
SafeAreaView, SafeAreaView,
Platform, Platform,
StatusBar, StatusBar,
Linking Linking,
} from "react-native"; } from "react-native";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { faq } from "../../redux/actions"; import { faq } from "../../redux/actions";
@ -32,6 +32,13 @@ const { width, height } = Dimensions.get("window");
function Contact({ theme }) { function Contact({ theme }) {
const navigation = useNavigation(); const navigation = useNavigation();
React.useEffect(() => {
StatusBar.setBarStyle(
`${theme === "light" ? "dark" : "light"}-content`,
true
);
}, [theme]);
const info = React.useMemo(() => { const info = React.useMemo(() => {
return { return {
onlineSupport: { onlineSupport: {
@ -39,45 +46,44 @@ function Contact({ theme }) {
title: { text: "پشتیبانی آنلاین", color: "#D3B702" }, title: { text: "پشتیبانی آنلاین", color: "#D3B702" },
description: { description: {
text: "همکاران ما در قسمت فروش و پشتیبانی، پاسخگوی شما هستند هر سوالی در مورد کتابهای ما داشتید بپرسید", text: "همکاران ما در قسمت فروش و پشتیبانی، پاسخگوی شما هستند هر سوالی در مورد کتابهای ما داشتید بپرسید",
color: theme === 'light' ? "#766600" : "#D3B702", color: theme === "light" ? "#766600" : "#D3B702",
}, },
link: { link: {
title: "ارتباط با بخش پشتیبانی", title: "ارتباط با بخش پشتیبانی",
link: "/support", link: "/support",
color: theme === 'light' ? "#766600" : "#D3B702", color: theme === "light" ? "#766600" : "#D3B702",
}, },
bg: "#D3B70233", bg: "#D3B70233",
borderColor: "#D3B70255", borderColor: "#D3B70255",
onPress : () => navigation.push("Tickets") onPress: () => navigation.push("Tickets"),
}, },
call: { call: {
icon: callIcon, icon: callIcon,
title: { text: "شماره تماس", color: "#06A02A" }, title: { text: "شماره تماس", color: "#06A02A" },
description: { description: {
text: "در صورت هرگونه سوال شما میتوانید در ساعات اداری 9 الی 17 با شماره 021۸۸۸۱۴۶۳۷ تماس حاصل فرمایید", text: "در صورت هرگونه سوال شما میتوانید در ساعات اداری 9 الی 17 با شماره 021۸۸۸۱۴۶۳۷ تماس حاصل فرمایید",
color: theme === 'light' ? "#025816" : "#06A02A", color: theme === "light" ? "#025816" : "#06A02A",
}, },
link: null, link: null,
bg: "#69FF5F33", bg: "#69FF5F33",
borderColor: "#69FF5F55", borderColor: "#69FF5F55",
onPress : () => Linking.openURL(`tel:02188814637`) onPress: () => Linking.openURL(`tel:02188814637`),
}, },
address: { address: {
icon: addressIcon, icon: addressIcon,
title: { text: "نشانی", color: "#0EAD98" }, title: { text: "نشانی", color: "#0EAD98" },
description: { description: {
text: "نشانی دفتر مرکزی: تهران میدان فردوسی خیابان عباس موسوی پلاک 30", text: "نشانی دفتر مرکزی: تهران میدان فردوسی خیابان عباس موسوی پلاک 30",
color: theme === 'light' ? "#066A5C" : "#0EAD98", color: theme === "light" ? "#066A5C" : "#0EAD98",
}, },
link: { link: {
title: "لیست نمایندگیهای فروش", title: "لیست نمایندگیهای فروش",
link: "/sell", link: "/sell",
color: theme === 'light' ? "#0A7769" : "#0EAD98", color: theme === "light" ? "#0A7769" : "#0EAD98",
}, },
bg: "#0A776933", bg: "#0A776933",
borderColor: "#0A776955", borderColor: "#0A776955",
onPress : () => {} onPress: () => {},
}, },
}; };
}, [theme]); }, [theme]);

@ -33,8 +33,6 @@ export const TicketStatus = ({ theme }) => {
} }
}; };
}, [theme]); }, [theme]);
return ( return (
<SafeAreaView <SafeAreaView

@ -23,12 +23,28 @@ import CustomPressable from "../../components/Pressable";
import tw from "tailwind-rn"; import tw from "tailwind-rn";
import Colors from "../../constants/Colors"; import Colors from "../../constants/Colors";
const DeliveryForm = ({ list, form, getList, getFactorInfo, userId, payFactor, factorInfo, theme }) => { const DeliveryForm = ({
list,
form,
getList,
getFactorInfo,
userId,
payFactor,
factorInfo,
theme,
}) => {
useEffect(() => { useEffect(() => {
getFactorInfo({ userId }); getFactorInfo({ userId });
getList(); getList();
}, []); }, []);
React.useEffect(() => {
StatusBar.setBarStyle(
`${theme === "light" ? "dark" : "light"}-content`,
true
);
}, [theme]);
return ( return (
<SafeAreaView <SafeAreaView
style={{ style={{
@ -72,7 +88,7 @@ const DeliveryForm = ({ list, form, getList, getFactorInfo, userId, payFactor, f
? payFactor({ userId }) ? payFactor({ userId })
: asyncAwesomeAlert("خطا", "آدرس یا نحوه ارسال را وارد کنید", { : asyncAwesomeAlert("خطا", "آدرس یا نحوه ارسال را وارد کنید", {
showCancelButton: false, showCancelButton: false,
confirmText: "باشه" confirmText: "باشه",
}) })
} }
/> />
@ -96,13 +112,13 @@ const mapStateToProps = (state) => ({
factorInfo: state.userFactor.info, factorInfo: state.userFactor.info,
userId: state.user.status?.id, userId: state.user.status?.id,
list: state.userAddress.list, list: state.userAddress.list,
theme: state.publicApi.theme theme: state.publicApi.theme,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {
getFactorInfo: userFactor.info, getFactorInfo: userFactor.info,
getList: userAddress.list, getList: userAddress.list,
payFactor : userFactor.payment payFactor: userFactor.payment,
}; };
export default connect(mapStateToProps, mapDispatchToProps)(DeliveryForm); export default connect(mapStateToProps, mapDispatchToProps)(DeliveryForm);

@ -2,7 +2,6 @@ import React, { useEffect } from "react";
import { import {
View, View,
Dimensions, Dimensions,
ScrollView,
SafeAreaView, SafeAreaView,
Platform, Platform,
StatusBar, StatusBar,
@ -27,13 +26,28 @@ import bgFaq from "./assets/faq.png";
const { width, height } = Dimensions.get("window"); const { width, height } = Dimensions.get("window");
function Faq({ list, getFaq, searchResult, search, selectFaq, searchFaq, theme }) { function Faq({
list,
getFaq,
searchResult,
search,
selectFaq,
searchFaq,
theme,
}) {
useEffect(() => { useEffect(() => {
if (list.length === 0) { if (list.length === 0) {
getFaq(); getFaq();
} }
}, [list]); }, [list]);
useEffect(() => {
StatusBar.setBarStyle(
`${theme === "light" ? "dark" : "light"}-content`,
true
);
}, [theme]);
return list.length > 0 ? ( return list.length > 0 ? (
<SafeAreaView <SafeAreaView
style={{ style={{
@ -84,7 +98,7 @@ function Faq({ list, getFaq, searchResult, search, selectFaq, searchFaq, theme }
<Text <Text
style={[ style={[
tw("w-full px-4 mt-10 text-center"), tw("w-full px-4 mt-10 text-center"),
{ fontFamily: "bold", color : Colors.theme1.gray20 + '77' }, { fontFamily: "bold", color: Colors.theme1.gray20 + "77" },
]} ]}
> >
موردی یافت نشد. موردی یافت نشد.
@ -112,7 +126,7 @@ const mapStateToProps = (state) => ({
list: state.faq.list, list: state.faq.list,
searchResult: state.faq.searchResult, searchResult: state.faq.searchResult,
search: state.faq.search, search: state.faq.search,
theme : state.publicApi.theme theme: state.publicApi.theme,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {

@ -15,7 +15,7 @@ const ios = Platform.OS === "ios";
function Videos({ videos, grades, mobile, theme }) { function Videos({ videos, grades, mobile, theme }) {
return ( return (
<View style={[tw("w-full mb-5")]}> <View style={[tw("w-full mb-0")]}>
<View style={[tw("w-full flex rounded-md pt-2 overflow-hidden")]}> <View style={[tw("w-full flex rounded-md pt-2 overflow-hidden")]}>
<View style={tw("flex px-4")}> <View style={tw("flex px-4")}>
<Header title="دورههای ویدئویی شما" route={"VOD"} /> <Header title="دورههای ویدئویی شما" route={"VOD"} />

@ -10,6 +10,7 @@ import {
Platform, Platform,
StatusBar, StatusBar,
LayoutAnimation, LayoutAnimation,
Dimensions
} from "react-native"; } from "react-native";
//components //components
@ -24,7 +25,8 @@ import Header from "./components/Header";
//style //style
import tw from "tailwind-rn"; import tw from "tailwind-rn";
// Within your render function const {width, height} = Dimensions.get("window");
const Home = ({ const Home = ({
route, route,
blogs, blogs,
@ -91,7 +93,7 @@ const styles = StyleSheet.create({
flex: 1, flex: 1,
}, },
contentContainerStyle: { contentContainerStyle: {
// paddingBottom: 40, paddingBottom: height / 10,
// flex : 1, // flex : 1,
// alignItems: "", // alignItems: "",
}, },

@ -10,6 +10,7 @@ import {
Platform, Platform,
KeyboardAvoidingView, KeyboardAvoidingView,
ScrollView, ScrollView,
StatusBar
} from "react-native"; } from "react-native";
import Svg, { Defs, Pattern, Image, Path } from "react-native-svg"; import Svg, { Defs, Pattern, Image, Path } from "react-native-svg";
import onInput from "../../utils/onInput"; import onInput from "../../utils/onInput";
@ -34,6 +35,13 @@ function Login(props) {
const [phone, setPhone] = useState(""); const [phone, setPhone] = useState("");
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
React.useEffect(() => {
StatusBar.setBarStyle(
`${theme === "light" ? "dark" : "light"}-content`,
true
);
}, [props.theme]);
const onChangePhone = (name, value) => { const onChangePhone = (name, value) => {
setPhone(() => value); setPhone(() => value);
}; };

@ -46,6 +46,13 @@ function OrderDetails({ mobile, route, theme }) {
const { order } = route.params; const { order } = route.params;
const [position, setPosition] = useState("100%"); const [position, setPosition] = useState("100%");
React.useEffect(() => {
StatusBar.setBarStyle(
`${theme === "light" ? "dark" : "light"}-content`,
true
);
}, [theme]);
const setBoxPosition = () => { const setBoxPosition = () => {
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
setPosition(position === "100%" ? "0%" : "100%"); setPosition(position === "100%" ? "0%" : "100%");
@ -244,7 +251,7 @@ function OrderDetails({ mobile, route, theme }) {
backgroundColor: backgroundColor:
theme === "light" ? Colors.theme1.greenFF1 + "aa" : null, theme === "light" ? Colors.theme1.greenFF1 + "aa" : null,
borderWidth: theme === "light" ? 0 : 1, borderWidth: theme === "light" ? 0 : 1,
borderColor : Colors.theme1.greenFF1 borderColor: Colors.theme1.greenFF1,
}, },
]} ]}
> >

@ -23,9 +23,16 @@ import b1Image from "./assets/b1.png";
const width = Dimensions.get("window").width; const width = Dimensions.get("window").width;
function OrdersFollowUp({ orders, getList }) { function OrdersFollowUp({ orders, getList, theme }) {
const [position, setPosition] = useState("100%"); const [position, setPosition] = useState("100%");
React.useEffect(() => {
StatusBar.setBarStyle(
`${theme === "light" ? "dark" : "light"}-content`,
true
);
}, [theme]);
const setBoxPosition = () => { const setBoxPosition = () => {
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
setPosition(position === "100%" ? "0%" : "100%"); setPosition(position === "100%" ? "0%" : "100%");
@ -89,6 +96,7 @@ const styles = StyleSheet.create({
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
orders: state.userFactor.fullList, orders: state.userFactor.fullList,
theme: state.publicApi.theme,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {

@ -9,6 +9,7 @@ import {
KeyboardAvoidingView, KeyboardAvoidingView,
ScrollView, ScrollView,
Platform, Platform,
StatusBar
} from "react-native"; } from "react-native";
import tw from "tailwind-rn"; import tw from "tailwind-rn";
import { connect } from "react-redux"; import { connect } from "react-redux";
@ -39,6 +40,13 @@ function Otp(props) {
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [timeEnd, setTimeEnd] = useState(false); const [timeEnd, setTimeEnd] = useState(false);
React.useEffect(() => {
StatusBar.setBarStyle(
`${theme === "light" ? "dark" : "light"}-content`,
true
);
}, [props.theme]);
const onChangeCode = (value, key) => { const onChangeCode = (value, key) => {
if (onInput.numberOnly(value) || value === "") { if (onInput.numberOnly(value) || value === "") {
switch (key) { switch (key) {
@ -245,12 +253,15 @@ function Otp(props) {
{ {
fontSize: fontSize.xl5, fontSize: fontSize.xl5,
fontFamily: "bold", fontFamily: "bold",
color: props.theme === 'light' ? Colors.theme1.green79 : Colors.theme1.white, color:
props.theme === "light"
? Colors.theme1.green79
: Colors.theme1.white,
width: fontSize.xl5 + 40, width: fontSize.xl5 + 40,
backgroundColor: backgroundColor:
props.theme === "light" ? Colors.theme1.grayE3 : null, props.theme === "light" ? Colors.theme1.grayE3 : null,
borderWidth: props.theme === "light" ? 0 : 1, borderWidth: props.theme === "light" ? 0 : 1,
borderColor : Colors.theme1.grayE3 + 'aa' borderColor: Colors.theme1.grayE3 + "aa",
}, },
]} ]}
underlineColorAndroid={"transparent"} underlineColorAndroid={"transparent"}
@ -268,12 +279,15 @@ function Otp(props) {
{ {
fontSize: fontSize.xl5, fontSize: fontSize.xl5,
fontFamily: "bold", fontFamily: "bold",
color: props.theme === 'light' ? Colors.theme1.green79 : Colors.theme1.white, color:
props.theme === "light"
? Colors.theme1.green79
: Colors.theme1.white,
width: fontSize.xl5 + 40, width: fontSize.xl5 + 40,
backgroundColor: backgroundColor:
props.theme === "light" ? Colors.theme1.grayE3 : null, props.theme === "light" ? Colors.theme1.grayE3 : null,
borderWidth: props.theme === "light" ? 0 : 1, borderWidth: props.theme === "light" ? 0 : 1,
borderColor : Colors.theme1.grayE3 + 'aa' borderColor: Colors.theme1.grayE3 + "aa",
}, },
]} ]}
underlineColorAndroid={"transparent"} underlineColorAndroid={"transparent"}
@ -291,12 +305,15 @@ function Otp(props) {
{ {
fontSize: fontSize.xl5, fontSize: fontSize.xl5,
fontFamily: "bold", fontFamily: "bold",
color: props.theme === 'light' ? Colors.theme1.green79 : Colors.theme1.white, color:
props.theme === "light"
? Colors.theme1.green79
: Colors.theme1.white,
width: fontSize.xl5 + 40, width: fontSize.xl5 + 40,
backgroundColor: backgroundColor:
props.theme === "light" ? Colors.theme1.grayE3 : null, props.theme === "light" ? Colors.theme1.grayE3 : null,
borderWidth: props.theme === "light" ? 0 : 1, borderWidth: props.theme === "light" ? 0 : 1,
borderColor : Colors.theme1.grayE3 + 'aa' borderColor: Colors.theme1.grayE3 + "aa",
}, },
]} ]}
underlineColorAndroid={"transparent"} underlineColorAndroid={"transparent"}
@ -314,12 +331,15 @@ function Otp(props) {
{ {
fontSize: fontSize.xl5, fontSize: fontSize.xl5,
fontFamily: "bold", fontFamily: "bold",
color: props.theme === 'light' ? Colors.theme1.green79 : Colors.theme1.white, color:
props.theme === "light"
? Colors.theme1.green79
: Colors.theme1.white,
width: fontSize.xl5 + 40, width: fontSize.xl5 + 40,
backgroundColor: backgroundColor:
props.theme === "light" ? Colors.theme1.grayE3 : null, props.theme === "light" ? Colors.theme1.grayE3 : null,
borderWidth: props.theme === "light" ? 0 : 1, borderWidth: props.theme === "light" ? 0 : 1,
borderColor : Colors.theme1.grayE3 + 'aa' borderColor: Colors.theme1.grayE3 + "aa",
}, },
]} ]}
underlineColorAndroid={"transparent"} underlineColorAndroid={"transparent"}

@ -15,11 +15,11 @@ const Trophy = ({ theme }) => {
return ( return (
<View <View
style={[ style={[
tw(`w-full flex py-3 px-3 justify-between flex-row-reverse`), tw(`w-full flex py-3 px-3 justify-between flex-row-reverse mt-4`),
{ {
backgroundColor: theme === "light" ? Colors.theme1.yellow2 : null, backgroundColor: theme === "light" ? Colors.theme1.yellow2 : null,
borderWidth: theme === "light" ? 0 : 1, borderWidth: theme === "light" ? 0 : 1,
borderColor: Colors.theme1.yellow2, borderColor: Colors.theme1.yellow2 + (theme === "light" ? "" : "77"),
}, },
]} ]}
> >
@ -68,7 +68,7 @@ const Trophy = ({ theme }) => {
<Pressable <Pressable
onPress={() => onPress={() =>
asyncAwesomeAlert("نتیجه", "این قابلیت در حال توسعه است.", { asyncAwesomeAlert("نتیجه", "این قابلیت در حال توسعه است.", {
confirmText : 'باشه', confirmText: "باشه",
showCancelButton: false, showCancelButton: false,
}) })
} }

@ -9,7 +9,7 @@ import {
import Scan from "./layouts/Scan"; import Scan from "./layouts/Scan";
const width = Dimensions.get("window").width; const width = Dimensions.get("window").width;
function QR({ }) { function QR({ route }) {
return ( return (
<SafeAreaView <SafeAreaView
style={{ style={{
@ -20,7 +20,7 @@ function QR({ }) {
contentContainerStyle={styles.contentContainerStyle} contentContainerStyle={styles.contentContainerStyle}
style={styles.container} style={styles.container}
> >
<Scan /> <Scan page={route?.params?.page} />
</ScrollView> </ScrollView>
</SafeAreaView> </SafeAreaView>
); );

@ -21,7 +21,7 @@ const { width, height } = Dimensions.get("screen");
//assets //assets
import laptopImage from "../../assets/laptop.png"; import laptopImage from "../../assets/laptop.png";
function Scan({ theme, route }) { function Scan({ theme, page }) {
const navigation = useNavigation(); const navigation = useNavigation();
const [hasPermission, setHasPermission] = React.useState(null); const [hasPermission, setHasPermission] = React.useState(null);
const [scanned, setScanned] = React.useState(false); const [scanned, setScanned] = React.useState(false);
@ -31,18 +31,21 @@ function Scan({ theme, route }) {
const { status } = await BarCodeScanner.requestPermissionsAsync(); const { status } = await BarCodeScanner.requestPermissionsAsync();
setHasPermission(status === "granted"); setHasPermission(status === "granted");
})(); })();
if (page === "book") {
navigation.push("QRContent", { data : "zist10-13" });
}
}, []); }, []);
const handleBarCodeScanned = React.useCallback( const handleBarCodeScanned = React.useCallback(
({ type, data }) => { ({ type, data }) => {
setScanned(true); setScanned(true);
if (route?.params?.page === "activation") { if (page === "activation") {
navigation.push("QRContent", { data });
} else {
navigation.push("Activation", { data }); navigation.push("Activation", { data });
} else {
navigation.push("QRContent", { data });
} }
}, },
[route, scanned] [page, scanned]
); );
return ( return (

@ -1,8 +1,14 @@
import React from "react"; import React from "react";
import { View, Text, Image, Pressable, Dimensions } from "react-native"; import { View, Text, Image, Pressable, Dimensions } from "react-native";
import tw from "tailwind-rn";
//assets
import linkIcon from "../../../assets/icons/link.png"; import linkIcon from "../../../assets/icons/link.png";
//styles
import tw from "tailwind-rn";
import fontSize from "../../../constants/fontSize";
import Colors from "../../../constants/Colors";
const { width } = Dimensions.get("window"); const { width } = Dimensions.get("window");
export default function Links({ links }) { export default function Links({ links }) {
@ -13,7 +19,14 @@ export default function Links({ links }) {
)} )}
> >
<View style={tw("flex items-end")}> <View style={tw("flex items-end")}>
<Text style={{ fontSize: width / 31, fontFamily: "bold" }}> <Text
style={{
fontSize: fontSize.tiny,
fontFamily: "bold",
color:
theme === "light" ? Colors.theme1.gray2077 : Colors.theme1.white,
}}
>
لینک ها لینک ها
</Text> </Text>
{links.map((link, i) => ( {links.map((link, i) => (

@ -1,8 +1,13 @@
import React from "react"; import React from "react";
import { View, Text, Image, Dimensions, TouchableOpacity } from "react-native"; import { View, Text, Image, Dimensions, TouchableOpacity } from "react-native";
import * as OpenAnything from "react-native-openanything";
//style
import fontSize from "../../../constants/fontSize";
import Colors from "../../../constants/Colors";
import tw from "tailwind-rn"; import tw from "tailwind-rn";
import * as OpenAnything from 'react-native-openanything';
//assets
import pdfIcon from "../../../assets/icons/pdf.png"; import pdfIcon from "../../../assets/icons/pdf.png";
const { width } = Dimensions.get("window"); const { width } = Dimensions.get("window");
@ -13,12 +18,20 @@ export default function PDF({ data }) {
style={tw( style={tw(
"w-full flex-row-reverse justify-between items-center rounded-md bg-red-100 py-3 px-2 mt-5" "w-full flex-row-reverse justify-between items-center rounded-md bg-red-100 py-3 px-2 mt-5"
)} )}
onPress={() => OpenAnything.Pdf(`https://dnvn.ir/api/v1/file/${data.fileIds}`)} onPress={() =>
OpenAnything.Pdf(`https://dnvn.ir/api/v1/file/${data.fileIds}`)
}
> >
<Text <Text
style={[ style={[
tw("text-right text-red-900"), tw("text-right text-red-900"),
{ fontSize: width / 34, fontFamily: "regular" }, {
fontSize: fontSize.tiny,
fontFamily: "bold",
color:
theme === "light" ? Colors.theme1.gray2077 : Colors.theme1.white,
},
,
]} ]}
> >
{data.name} {data.name}

@ -1,6 +1,12 @@
import React from "react"; import React from "react";
import { View, Text, Image, Dimensions } from "react-native"; import { View, Text, Image, Dimensions } from "react-native";
//style
import tw from "tailwind-rn"; import tw from "tailwind-rn";
import fontSize from "../../../constants/fontSize";
import Colors from "../../../constants/Colors";
//assets
import pptIcon from "../../../assets/icons/ppt.png"; import pptIcon from "../../../assets/icons/ppt.png";
const { width } = Dimensions.get("window"); const { width } = Dimensions.get("window");
@ -15,7 +21,12 @@ export default function PPT({ name, file }) {
<Text <Text
style={[ style={[
tw("text-right text-green-900"), tw("text-right text-green-900"),
{ fontSize: width / 34, fontFamily: "regular" }, {
fontSize: fontSize.tiny,
fontFamily: "bold",
color:
theme === "light" ? Colors.theme1.gray2077 : Colors.theme1.white,
},
]} ]}
> >
{name} {name}

@ -1,11 +1,15 @@
import React from "react"; import React from "react";
import { View, Text, Dimensions } from "react-native"; import { View, Text, Dimensions } from "react-native";
import tw from "tailwind-rn";
import { Video } from "expo-av"; import { Video } from "expo-av";
//style
import fontSize from "../../../constants/fontSize";
import Colors from "../../../constants/Colors";
import tw from "tailwind-rn";
const { width } = Dimensions.get("window"); const { width } = Dimensions.get("window");
export default function VideoContent({ data }) { export default function VideoContent({ data, theme }) {
const [status, setStatus] = React.useState({}); const [status, setStatus] = React.useState({});
const video = React.useRef(null); const video = React.useRef(null);
return ( return (
@ -13,10 +17,15 @@ export default function VideoContent({ data }) {
<Text <Text
style={[ style={[
tw("w-full text-right text-green-900 mb-4"), tw("w-full text-right text-green-900 mb-4"),
{ fontSize: width / 34, fontFamily: "bold" }, {
fontSize: fontSize.tiny,
fontFamily: "bold",
color:
theme === "light" ? Colors.theme1.gray2077 : Colors.theme1.white,
},
]} ]}
> >
{'موضوع:' + ' ' + data.name} {"موضوع:" + " " + data.name}
</Text> </Text>
<View style={tw("flex ")}> <View style={tw("flex ")}>
<Video <Video

@ -1,8 +1,15 @@
import React from "react"; import React from "react";
import { View, Text, Dimensions } from "react-native"; import { View, Text, Dimensions } from "react-native";
//style
import tw from "tailwind-rn"; import tw from "tailwind-rn";
import fontSize from "../../../constants/fontSize";
import Colors from "../../../constants/Colors";
//components
import MusicPlayer from "../../../components/MusicPlayer"; import MusicPlayer from "../../../components/MusicPlayer";
const { width } = Dimensions.get("window"); const { width } = Dimensions.get("window");
export default function Voice({ data }) { export default function Voice({ data }) {
@ -11,7 +18,13 @@ export default function Voice({ data }) {
<Text <Text
style={[ style={[
tw("w-full text-right text-xs text-green-900"), tw("w-full text-right text-xs text-green-900"),
{ fontSize: width / 34, fontFamily: "regular" }, {
fontSize: fontSize.tiny,
fontFamily: "bold",
color:
theme === "light" ? Colors.theme1.gray2077 : Colors.theme1.white,
},
,
]} ]}
> >
{data.name} {data.name}

@ -1,27 +1,35 @@
import React from "react"; import React from "react";
import { View, Text, Image, Dimensions } from "react-native"; import { View, Text, Image, Dimensions } from "react-native";
import tw from "tailwind-rn";
import Tab from "../Tab"; import Tab from "../Tab";
//style
import tw from "tailwind-rn";
import Colors from "../../../constants/Colors"; import Colors from "../../../constants/Colors";
import fontSize from "../../../constants/fontSize";
const { width} = Dimensions.get("window"); const { height, width } = Dimensions.get("window");
export default function Content({ data, grades }) { export default function Content({ data, grades, theme }) {
const light = React.useMemo(() => {
return theme === 'light';
},[theme]);
return ( return (
<View style={tw("flex-1 flex px-4 pb-20")}> <View style={tw("flex-1 flex px-4 pb-20")}>
<View style={tw("flex flex-1 ")}> <View style={tw("flex flex-1 ")}>
<View style={tw("flex w-full flex-row-reverse justify-between")}> <View style={tw("flex w-full flex-row-reverse justify-between")}>
<View style={tw("flex flex-row-reverse")}> <View style={tw("flex flex-row-reverse flex-1")}>
<Image <Image
source={{ uri: "https://dnvn.ir/api/v1/file/2105" }} source={{ uri: "https://dnvn.ir/api/v1/file/2105" }}
style={[{ width: 80, height: 120 }, tw("rounded-md")]} style={[{ height: height / 4.5, flex: 1 }, tw("rounded-md")]}
resizeMode="contain"
/> />
<View style={tw("flex items-end mr-3")}> <View style={tw("flex pr-2")}>
<Text <Text
style={{ style={{
fontFamily: "bold", fontFamily: "bold",
fontSize: width / 27, fontSize: fontSize.lg,
color: Colors.theme1.light.blue6, color: light ? Colors.theme1.green79 : Colors.theme1.white,
textAlign: "right",
}} }}
> >
{data.book.name} {data.book.name}
@ -31,20 +39,22 @@ export default function Content({ data, grades }) {
tw("mt-1"), tw("mt-1"),
{ {
fontFamily: "regular", fontFamily: "regular",
fontSize: width / 34, fontSize: fontSize.tiny,
color: Colors.theme1.light.blue5, color: light ? Colors.theme1.green79 : Colors.theme1.white,
textAlign: "right",
}, },
]} ]}
> >
{ 'پایه' + ' ' + grades[data.book.gradeId]} {"پایه" + " " + grades[data.book.gradeId]}
</Text> </Text>
<Text <Text
style={[ style={[
tw("mt-1"), tw("mt-1"),
{ {
fontFamily: "regular", fontFamily: "regular",
fontSize: width / 34, fontSize: fontSize.tiny,
color: Colors.theme1.light.blue5, color: light ? Colors.theme1.green79 : Colors.theme1.white,
textAlign: "right",
}, },
]} ]}
>{`شما در حال مشاهده صفحه ${data.qr.pageNumber} هستید.`}</Text> >{`شما در حال مشاهده صفحه ${data.qr.pageNumber} هستید.`}</Text>
@ -54,12 +64,13 @@ export default function Content({ data, grades }) {
</View> </View>
<Tab <Tab
data={{ data={{
voice: data.qr.content.filter((obj) => obj.type === 'voice')[0], voice: data.qr.content.filter((obj) => obj.type === "voice")[0],
video: data.qr.content.filter((obj) => obj.type === 'video')[0], video: data.qr.content.filter((obj) => obj.type === "video")[0],
pdf: data.qr.content.filter((obj) => obj.type === 'pdf')[0], pdf: data.qr.content.filter((obj) => obj.type === "pdf")[0],
ppt: data.qr.content.filter((obj) => obj.type === 'ppt')[0], ppt: data.qr.content.filter((obj) => obj.type === "ppt")[0],
links: data.qr.content.filter((obj) => obj.type === 'links')[0], links: data.qr.content.filter((obj) => obj.type === "links")[0],
}} }}
theme={theme}
/> />
</View> </View>
); );

@ -12,41 +12,52 @@ import Links from "../Content/Links";
//assets //assets
import tw from "tailwind-rn"; import tw from "tailwind-rn";
import Colors from "../../../constants/Colors"; import Colors from "../../../constants/Colors";
import fontSize from "../../../constants/fontSize";
const { width } = Dimensions.get("window"); const { width } = Dimensions.get("window");
function Tab({ data, theme }) { function Tab({ data, theme }) {
const [dataType, setDataType] = useState("all"); const [dataType, setDataType] = useState("all");
const light = React.useMemo(() => {
return theme === "light";
}, [theme]);
return ( return (
<View <View
style={[ style={[
tw("w-full flex rounded-md overflow-hidden mt-4"), tw("w-full flex rounded-md overflow-hidden mt-4"),
{ borderWidth: 1, borderColor: Colors.theme1.blue5 }, { borderWidth: 1, borderColor: Colors.theme1.greenBA + "aa" },
]} ]}
> >
<View style={tw("w-full flex flex-row-reverse justify-between px-0.5")}> <View style={tw("w-full flex flex-row-reverse justify-between")}>
<TouchableOpacity <TouchableOpacity
onPress={() => setDataType("all")} onPress={() => setDataType("all")}
style={[ style={[
tw("py-2 w-1/6"), tw("py-2 w-1/6"),
{ {
borderBottomWidth: 1, borderBottomWidth: dataType === "all" ? 0 : 1,
borderColor: borderColor: Colors.theme1.greenBA + "aa",
dataType === "all"
? Colors.theme1.blue3
: Colors.theme1.blue5,
backgroundColor: backgroundColor:
dataType === "all" ? Colors.theme1.blue3 : "white", dataType === "all"
? Colors.theme1.greenCF
: light
? Colors.theme1.white
: Colors.theme1.dark,
}, },
]} ]}
> >
<Text <Text
style={{ style={{
fontSize: width / 38, fontSize: fontSize.xs,
fontFamily: dataType === "all" ? "bold" : "light", fontFamily: dataType === "all" ? "regular" : "light",
textAlign: "center", textAlign: "center",
color: Colors.theme1.blue5, color:
dataType === "all"
? Colors.theme1.white
: light
? Colors.theme1.gray20
: Colors.theme1.white,
}} }}
> >
تمامی محتوا تمامی محتوا
@ -57,22 +68,28 @@ function Tab({ data, theme }) {
style={[ style={[
tw("py-2 w-1/6"), tw("py-2 w-1/6"),
{ {
borderBottomWidth: 1, borderBottomWidth: dataType === "voice" ? 0 : 1,
borderColor: borderColor: Colors.theme1.greenBA + "aa",
dataType === "voice"
? Colors.theme1.blue3
: Colors.theme1.blue5,
backgroundColor: backgroundColor:
dataType === "voice" ? Colors.theme1.blue3 : "white", dataType === "voice"
? Colors.theme1.greenCF
: light
? Colors.theme1.white
: Colors.theme1.dark,
}, },
]} ]}
> >
<Text <Text
style={{ style={{
fontSize: width / 38, fontSize: fontSize.xs,
fontFamily: dataType === "voice" ? "bold" : "light", fontFamily: dataType === "voice" ? "bold" : "light",
textAlign: "center", textAlign: "center",
color: Colors.theme1.blue5, color:
dataType === "voice"
? Colors.theme1.white
: light
? Colors.theme1.gray20
: Colors.theme1.white,
}} }}
> >
صوت صوت
@ -84,21 +101,27 @@ function Tab({ data, theme }) {
tw("py-2 w-1/6"), tw("py-2 w-1/6"),
{ {
borderBottomWidth: 1, borderBottomWidth: 1,
borderColor: borderColor: Colors.theme1.greenBA + "aa",
dataType === "video"
? Colors.theme1.blue3
: Colors.theme1.blue5,
backgroundColor: backgroundColor:
dataType === "video" ? Colors.theme1.blue3 : "white", dataType === "video"
? Colors.theme1.greenCF
: light
? Colors.theme1.white
: Colors.theme1.dark,
}, },
]} ]}
> >
<Text <Text
style={{ style={{
fontSize: width / 38, fontSize: fontSize.xs,
fontFamily: dataType === "video" ? "bold" : "light", fontFamily: dataType === "video" ? "bold" : "light",
textAlign: "center", textAlign: "center",
color: Colors.theme1.blue5, color:
dataType === "video"
? Colors.theme1.white
: light
? Colors.theme1.gray20
: Colors.theme1.white,
}} }}
> >
ویدئو ویدئو
@ -110,21 +133,27 @@ function Tab({ data, theme }) {
tw("py-2 w-1/6"), tw("py-2 w-1/6"),
{ {
borderBottomWidth: 1, borderBottomWidth: 1,
borderColor: borderColor: Colors.theme1.greenBA + "aa",
dataType === "pdf"
? Colors.theme1.blue3
: Colors.theme1.blue5,
backgroundColor: backgroundColor:
dataType === "pdf" ? Colors.theme1.blue3 : "white", dataType === "pdf"
? Colors.theme1.greenCF
: light
? Colors.theme1.white
: Colors.theme1.dark,
}, },
]} ]}
> >
<Text <Text
style={{ style={{
fontSize: width / 38, fontSize: fontSize.xs,
fontFamily: dataType === "pdf" ? "bold" : "light", fontFamily: dataType === "pdf" ? "bold" : "light",
textAlign: "center", textAlign: "center",
color: Colors.theme1.blue5, color:
dataType === "pdf"
? Colors.theme1.white
: light
? Colors.theme1.gray20
: Colors.theme1.white,
}} }}
> >
پی دی اف پی دی اف
@ -136,21 +165,27 @@ function Tab({ data, theme }) {
tw("py-2 w-1/6"), tw("py-2 w-1/6"),
{ {
borderBottomWidth: 1, borderBottomWidth: 1,
borderColor: borderColor: Colors.theme1.greenBA + "aa",
dataType === "ppt"
? Colors.theme1.blue3
: Colors.theme1.blue5,
backgroundColor: backgroundColor:
dataType === "ppt" ? Colors.theme1.blue3 : "white", dataType === "ppt"
? Colors.theme1.greenCF
: light
? Colors.theme1.white
: Colors.theme1.dark,
}, },
]} ]}
> >
<Text <Text
style={{ style={{
fontSize: width / 38, fontSize: fontSize.xs,
fontFamily: dataType === "ppt" ? "bold" : "light", fontFamily: dataType === "ppt" ? "bold" : "light",
textAlign: "center", textAlign: "center",
color: Colors.theme1.blue5, color:
dataType === "ppt"
? Colors.theme1.white
: light
? Colors.theme1.gray20
: Colors.theme1.white,
}} }}
> >
پاور پوینت پاور پوینت
@ -162,21 +197,27 @@ function Tab({ data, theme }) {
tw("py-2 w-1/6"), tw("py-2 w-1/6"),
{ {
borderBottomWidth: 1, borderBottomWidth: 1,
borderColor: borderColor: Colors.theme1.greenBA + "aa",
dataType === "links"
? Colors.theme1.blue3
: Colors.theme1.blue5,
backgroundColor: backgroundColor:
dataType === "links" ? Colors.theme1.blue3 : "white", dataType === "links"
? Colors.theme1.greenCF
: light
? Colors.theme1.white
: Colors.theme1.dark,
}, },
]} ]}
> >
<Text <Text
style={{ style={{
fontSize: width / 38, fontSize: fontSize.xs,
fontFamily: dataType === "links" ? "bold" : "light", fontFamily: dataType === "links" ? "bold" : "light",
textAlign: "center", textAlign: "center",
color: Colors.theme1.blue5, color:
dataType === "links"
? Colors.theme1.white
: light
? Colors.theme1.gray20
: Colors.theme1.white,
}} }}
> >
لینک ها لینک ها
@ -186,23 +227,24 @@ function Tab({ data, theme }) {
<View style={tw("flex w-full p-4")}> <View style={tw("flex w-full p-4")}>
{dataType === "all" ? ( {dataType === "all" ? (
<> <>
{data.voice ? <Voice data={data.voice} /> : null} {data.voice ? <Voice data={data.voice} theme={theme} /> : null}
{data.video ? <Video data={data.video} /> : null} {data.video ? <Video data={data.video} theme={theme} /> : null}
{data.ppt ? <PPT data={data.ppt} /> : null} {data.ppt ? <PPT data={data.ppt} theme={theme} /> : null}
{data.pdf ? <PDF data={data.pdf} /> : null} {data.pdf ? <PDF data={data.pdf} theme={theme} /> : null}
{data.links ? <Links data={data.links} /> : null} {data.links ? <Links data={data.links} theme={theme} /> : null}
</> </>
) : null} ) : null}
{dataType === "voice" ? ( {dataType === "voice" ? (
<> <>
{data.voice ? ( {data.voice ? (
<Voice data={data.voice} /> <Voice data={data.voice} theme={theme} />
) : ( ) : (
<Text <Text
style={{ style={{
fontSize: width / 31, fontSize: fontSize.tiny,
color: "#707070", color: light ? Colors.theme1.gray2077 : Colors.theme1.white,
fontFamily: "light", fontFamily: "light",
textAlign: "right",
}} }}
> >
فایل صدا یافت نشد. فایل صدا یافت نشد.
@ -213,13 +255,14 @@ function Tab({ data, theme }) {
{dataType === "video" ? ( {dataType === "video" ? (
<> <>
{data.video ? ( {data.video ? (
<Video data={data.video} /> <Video data={data.video} theme={theme} />
) : ( ) : (
<Text <Text
style={{ style={{
fontSize: width / 31, fontSize: fontSize.tiny,
color: "#707070", color: light ? Colors.theme1.gray2077 : Colors.theme1.white,
fontFamily: "light", fontFamily: "light",
textAlign: "right",
}} }}
> >
فایل تصویری یافت نشد. فایل تصویری یافت نشد.
@ -230,13 +273,14 @@ function Tab({ data, theme }) {
{dataType === "ppt" ? ( {dataType === "ppt" ? (
<> <>
{data.ppt ? ( {data.ppt ? (
<PPT data={data.ppt} /> <PPT data={data.ppt} theme={theme} />
) : ( ) : (
<Text <Text
style={{ style={{
fontSize: width / 31, fontSize: fontSize.tiny,
color: "#707070", color: light ? Colors.theme1.gray2077 : Colors.theme1.white,
fontFamily: "light", fontFamily: "light",
textAlign: "right",
}} }}
> >
فایل پاورپوینت یافت نشد. فایل پاورپوینت یافت نشد.
@ -247,13 +291,14 @@ function Tab({ data, theme }) {
{dataType === "pdf" ? ( {dataType === "pdf" ? (
<> <>
{data.pdf ? ( {data.pdf ? (
<PDF data={data.pdf} /> <PDF data={data.pdf} theme={theme} />
) : ( ) : (
<Text <Text
style={{ style={{
fontSize: width / 31, fontSize: fontSize.tiny,
color: "#707070", color: light ? Colors.theme1.gray2077 : Colors.theme1.white,
fontFamily: "light", fontFamily: "light",
textAlign: "right",
}} }}
> >
فایل پی دی اف یافت نشد. فایل پی دی اف یافت نشد.
@ -264,13 +309,14 @@ function Tab({ data, theme }) {
{dataType === "links" ? ( {dataType === "links" ? (
<> <>
{data.links ? ( {data.links ? (
<Links data={data.links} /> <Links data={data.links} theme={theme} />
) : ( ) : (
<Text <Text
style={{ style={{
fontSize: width / 31, fontSize: fontSize.tiny,
color: "#707070", color: light ? Colors.theme1.gray2077 : Colors.theme1.white,
fontFamily: "light", fontFamily: "light",
textAlign: "right",
}} }}
> >
لینکی پیدا نشد. لینکی پیدا نشد.

@ -6,30 +6,26 @@ import {
Dimensions, Dimensions,
StatusBar, StatusBar,
} from "react-native"; } from "react-native";
import tw from 'tailwind-rn';
import { connect } from "react-redux"; import { connect } from "react-redux";
import { qr } from "../../redux/actions"; import { qr } from "../../redux/actions";
import Content from "./Content"; import Content from "./Content";
import Navbar from "../../components/Navbar"; import Navbar from "../../components/Navbar";
//style
import tw from 'tailwind-rn';
const {height} = Dimensions.get("window"); const {height} = Dimensions.get("window");
function QRContent({ route, getQrData, data, grades }) { function QRContent({ route, getQrData, data, grades, theme }) {
useEffect(() => { useEffect(() => {
getQrData({ tail: route.params.data }); getQrData({ tail: route.params.data });
}, []); }, []);
useEffect(() => {
if (data) {
// (data.qr.content);
}
}, [data]);
return ( return (
<SafeAreaView <SafeAreaView
style={{ style={{
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0, paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0,
height: height, height: height,
backgroundColor: 'white'
}} }}
> >
<Navbar <Navbar
@ -45,7 +41,7 @@ function QRContent({ route, getQrData, data, grades }) {
/> />
<ScrollView <ScrollView
> >
{data ? <Content data={data} grades={grades} /> : null} {data ? <Content data={data} grades={grades} theme={theme} /> : null}
</ScrollView> </ScrollView>
</SafeAreaView> </SafeAreaView>
); );
@ -53,7 +49,8 @@ function QRContent({ route, getQrData, data, grades }) {
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
data: state.qr.list, data: state.qr.list,
grades : state.publicApi.grades grades : state.publicApi.grades,
theme: state.publicApi.theme,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {

@ -1,9 +1,16 @@
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { View, Image, ActivityIndicator, Dimensions, BackHandler } from "react-native"; import {
View,
Image,
ActivityIndicator,
Dimensions,
BackHandler,
StatusBar,
} from "react-native";
import AsyncStorage from "@react-native-async-storage/async-storage"; import AsyncStorage from "@react-native-async-storage/async-storage";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { blog, book, userProduct, publicApi } from "../../redux/actions"; import { blog, book, userProduct, publicApi } from "../../redux/actions";
import { useIsFocused } from '@react-navigation/native'; import { useIsFocused } from "@react-navigation/native";
import Logo from "../../assets/images/logo.png"; import Logo from "../../assets/images/logo.png";
@ -19,9 +26,17 @@ function Splash({
userProducts, userProducts,
getUserProducts, getUserProducts,
setIsDark, setIsDark,
theme,
}) { }) {
const isFocused = useIsFocused(); const isFocused = useIsFocused();
const [out, setOut] = React.useState(false); const [out, setOut] = React.useState(false);
React.useEffect(() => {
StatusBar.setBarStyle(
`${theme === "light" ? "dark" : "light"}-content`,
true
);
}, [theme]);
useEffect(async () => { useEffect(async () => {
//set theme //set theme
const theme = await AsyncStorage.getItem("theme"); const theme = await AsyncStorage.getItem("theme");
@ -39,7 +54,7 @@ function Splash({
} else if (userProducts.length === 0) { } else if (userProducts.length === 0) {
getUserProducts(); getUserProducts();
} else { } else {
setOut(true) setOut(true);
navigation.navigate("Root"); navigation.navigate("Root");
} }
} }
@ -51,7 +66,6 @@ function Splash({
BackHandler.exitApp(); BackHandler.exitApp();
} }
if (isFocused && !out) { if (isFocused && !out) {
if (isLogin !== null) { if (isLogin !== null) {
if (isLogin === false) { if (isLogin === false) {
@ -65,7 +79,7 @@ function Splash({
} else if (userProducts.length === 0) { } else if (userProducts.length === 0) {
getUserProducts(); getUserProducts();
} else { } else {
setOut(true) setOut(true);
navigation.navigate("Root"); navigation.navigate("Root");
} }
} }
@ -101,13 +115,14 @@ const mapStateToProps = (state) => ({
blogs: state.blog.list, blogs: state.blog.list,
books: state.book.list, books: state.book.list,
userProducts: state.userProduct.list, userProducts: state.userProduct.list,
theme: state.publicApi.theme,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {
getBlogs: blog.list, getBlogs: blog.list,
getBooks: book.list, getBooks: book.list,
getUserProducts: userProduct.list, getUserProducts: userProduct.list,
setIsDark: publicApi.setIsDark setIsDark: publicApi.setIsDark,
}; };
export default connect(mapStateToProps, mapDispatchToProps)(Splash); export default connect(mapStateToProps, mapDispatchToProps)(Splash);

Loading…
Cancel
Save