From 37efeaf5298d689d3985fe00e83d3143adee27b8 Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Tue, 24 May 2022 12:41:29 +0430 Subject: [PATCH] update Pressable.js, MyBooks.js and Videos.js --- src/components/Pressable.js | 1 + src/screens/Home/components/MyBooks.js | 117 ++++++++++++++++++++++++- src/screens/Home/components/Videos.js | 13 ++- 3 files changed, 128 insertions(+), 3 deletions(-) diff --git a/src/components/Pressable.js b/src/components/Pressable.js index c028fd0..5f750d7 100644 --- a/src/components/Pressable.js +++ b/src/components/Pressable.js @@ -45,6 +45,7 @@ function Pressable1({ : fontSize.base, color: color, fontFamily: "bold", + textAlign: "center", }} > {title} diff --git a/src/screens/Home/components/MyBooks.js b/src/screens/Home/components/MyBooks.js index b0dc6dc..8ac3bf8 100644 --- a/src/screens/Home/components/MyBooks.js +++ b/src/screens/Home/components/MyBooks.js @@ -1,3 +1,4 @@ +import React from "react"; import { View, Text, @@ -9,9 +10,13 @@ import { Dimensions, } from "react-native"; import { connect } from "react-redux"; +import { useNavigation } from "@react-navigation/native"; +import { AntDesign } from "@expo/vector-icons"; //components import Progress from "../../../components/Progress"; +import Modal from "../../../components/Modal"; +import CustomPressable from "../../../components/Pressable"; //Color import Colors from "../../../constants/Colors"; @@ -20,6 +25,7 @@ import fontSize from "../../../constants/fontSize"; const ios = Platform.OS === "ios"; const { width, height } = Dimensions.get("window"); + function MyBooks({ books, grades, theme, mobile }) { return books?.filter( (book) => @@ -72,6 +78,9 @@ function MyBooks({ books, grades, theme, mobile }) { } const Book = ({ book, grades, theme, mobile }) => { + const [openModal, setOpenModal] = React.useState(false); + const navigation = useNavigation(); + const actions = { 3: () => Linking.openURL(`https://ar.dnvn.ir/lunch?id=${book?.product?.ARId}`), @@ -82,7 +91,7 @@ const Book = ({ book, grades, theme, mobile }) => { return ( setOpenModal(true)} > { resizeMode="contain" style={[ { - width: mobile ? 110 : height / 5 * 3 / 4, + width: mobile ? 110 : ((height / 5) * 3) / 4, flex: 1, }, ]} @@ -125,6 +134,110 @@ const Book = ({ book, grades, theme, mobile }) => { {"پایه" + " " + grades[book?.product?.book?.gradeId]} + + setOpenModal(!openModal)} + > + e.stopPropagation()} + style={[ + tw("flex flex-col items-center p-4 rounded-md relative"), + { + backgroundColor: + theme === "light" ? Colors.theme1.white : Colors.theme1.dark, + }, + ]} + > + setOpenModal(!openModal)} + /> + + + navigation.push("QR", { page: "activation" })} + style={{ + backgroundColor: Colors.theme1.greenD9, + color: "white", + width: width / 2, + paddingVertical: 10, + borderRadius: 5, + }} + > + + QR اسکن کد + + + + Linking.openURL( + `https://ar.dnvn.ir/lunch?id=${book?.product?.ARId}` + ) + } + style={{ + backgroundColor: Colors.theme1.gray2077, + color: "white", + width: width / 2, + paddingVertical: 10, + borderRadius: 5, + marginTop: 12, + }} + > + + واقعیت افزوده + + + + + ); }; diff --git a/src/screens/Home/components/Videos.js b/src/screens/Home/components/Videos.js index 59118e4..1809ddc 100644 --- a/src/screens/Home/components/Videos.js +++ b/src/screens/Home/components/Videos.js @@ -1,4 +1,13 @@ -import { View, Text, Image, Pressable, FlatList, Platform } from "react-native"; +import React from "react"; +import { + View, + Text, + Image, + Pressable, + FlatList, + Platform, + Dimensions, +} from "react-native"; import { useNavigation } from "@react-navigation/native"; import tw from "tailwind-rn"; import { connect } from "react-redux"; @@ -47,6 +56,7 @@ function Videos({ videos, grades, mobile, theme }) { const Video = ({ video, mobile, grades, theme }) => { const navigation = useNavigation(); + return ( { + ); };