diff --git a/App.js b/App.js
index 63161bd..c6f222f 100644
--- a/App.js
+++ b/App.js
@@ -21,10 +21,10 @@ const App = () => {
}
return (
-
+ {/* */}
-
+ {/* */}
);
};
diff --git a/navigation/index.js b/navigation/index.js
index 083a22b..0b00378 100644
--- a/navigation/index.js
+++ b/navigation/index.js
@@ -1,6 +1,6 @@
import React, { useEffect } from "react";
import { Restart } from "fiction-expo-restart";
-import { I18nManager } from "react-native";
+import { I18nManager, StatusBar } from "react-native";
import * as Linking from "expo-linking";
import Svg, { G, Path } from "react-native-svg";
import { NavigationContainer } from "@react-navigation/native";
@@ -57,7 +57,7 @@ const BottomTabNavigator = ({ theme, userProducts }) => {
setHeaderShown(false);
}, 600);
}, []);
-
+
return (
{
case "public/setLtr":
return { ...state, ltr : true };
case "public/setIsDark":
- // AsyncStorage.setItem("isDark", data);
return { ...state, location: false, error: null, theme: data };
case "active/video":
return {
diff --git a/src/screens/AR/components/Book.js b/src/screens/AR/components/Book.js
index eabc780..94cd025 100644
--- a/src/screens/AR/components/Book.js
+++ b/src/screens/AR/components/Book.js
@@ -1,7 +1,6 @@
import { Pressable, Text, Image, Dimensions } from "react-native";
import React from "react";
import { connect } from "react-redux";
-import { useNavigation } from "@react-navigation/native";
import * as Linking from "expo-linking";
//style
@@ -12,7 +11,6 @@ import Colors from "../../../constants/Colors";
const { width, height } = Dimensions.get("window");
const Book = ({ book, mobile, theme }) => {
- const navigation = useNavigation();
return (
book.condition >= 2).length ? (
@@ -43,14 +38,12 @@ function Scroll({ books, mobile }) {
- {books.slice(0,14).map((book, index) => (
+ {books.slice(0, 14).map((book, index) => (
))}
@@ -58,21 +51,23 @@ function Scroll({ books, mobile }) {
};
return (
- }
- keyExtractor={(item) => item.id}
- />
+ {books?.length ? (
+ }
+ keyExtractor={(item) => item.id}
+ />
+ ) : null}
);
}
const mapStateToProps = (state) => ({
- mobile : state.publicApi.mobile
+ mobile: state.publicApi.mobile,
});
export default connect(mapStateToProps, {})(Scroll);
diff --git a/src/screens/Home/components/Videos.js b/src/screens/Home/components/Videos.js
index 89725f1..c929ece 100644
--- a/src/screens/Home/components/Videos.js
+++ b/src/screens/Home/components/Videos.js
@@ -20,17 +20,24 @@ function Videos({ videos, grades, mobile, theme }) {
- (
-
- )}
- keyExtractor={(item) => item.id}
- />
+ {videos.length ? (
+ (
+
+ )}
+ keyExtractor={(item) => item.id}
+ />
+ ) : null}
);
@@ -50,7 +57,7 @@ const Video = ({ video, mobile, grades, theme }) => {
source={{ uri: `https://dnvn.ir/api/v1/file/${video.fileIds}` }}
// resizeMode="contain"
style={[
- tw('bg-gray-100'),
+ tw("bg-gray-100"),
{
height: mobile ? 130 : 130,
},
@@ -60,7 +67,8 @@ const Video = ({ video, mobile, grades, theme }) => {
style={[
tw("mt-2 px-1"),
{
- color: theme === 'light' ? Colors.theme1.gray20 : Colors.theme1.white,
+ color:
+ theme === "light" ? Colors.theme1.gray20 : Colors.theme1.white,
fontFamily: "bold",
fontSize: mobile ? fontSize.sm : fontSize.xl,
textAlign: ios ? "right" : "auto",
@@ -73,7 +81,8 @@ const Video = ({ video, mobile, grades, theme }) => {
style={[
tw("mt-1 pr-1"),
{
- color: theme === 'light' ? Colors.theme1.gray20 : Colors.theme1.white,
+ color:
+ theme === "light" ? Colors.theme1.gray20 : Colors.theme1.white,
fontFamily: "regular",
fontSize: mobile ? fontSize.xs : fontSize.base,
textAlign: ios ? "right" : "auto",
diff --git a/src/screens/Home/index.js b/src/screens/Home/index.js
index 25fd251..6925975 100644
--- a/src/screens/Home/index.js
+++ b/src/screens/Home/index.js
@@ -1,6 +1,7 @@
import React, { useState } from "react";
import { connect } from "react-redux";
-import { useNavigation } from "@react-navigation/native";
+import { blog, book, userProduct } from "../../redux/actions";
+
import {
View,
StyleSheet,
@@ -24,7 +25,16 @@ import Header from "./components/Header";
import tw from "tailwind-rn";
// Within your render function
-const Home = ({ route, blogs, books, userProducts, mobile }) => {
+const Home = ({
+ route,
+ blogs,
+ books,
+ userProducts,
+ mobile,
+ getBlogs,
+ getBooks,
+ getUserProducts,
+}) => {
const [position, setPosition] = useState("100%");
const setBoxPosition = () => {
@@ -32,6 +42,16 @@ const Home = ({ route, blogs, books, userProducts, mobile }) => {
setPosition(position === "100%" ? "0%" : "100%");
};
+ React.useEffect(() => {
+ if (blogs.length === 0) {
+ getBlogs();
+ } else if (books.length === 0) {
+ getBooks({ vod: true });
+ } else if (userProducts.length === 0) {
+ getUserProducts();
+ }
+ }, [books, userProducts, blogs]);
+
return (
({
});
const mapDispatchToProps = {
- // getVideos: product.listVOD
+ getBlogs: blog.list,
+ getBooks: book.list,
+ getUserProducts: userProduct.list,
};
export default connect(mapStateToProps, mapDispatchToProps)(Home);
diff --git a/src/screens/Product/components/Comments.js b/src/screens/Product/components/Comments.js
index 096e42e..14bc800 100644
--- a/src/screens/Product/components/Comments.js
+++ b/src/screens/Product/components/Comments.js
@@ -22,7 +22,7 @@ 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");
const ios = Platform.OS === "ios";
function Commnets({
@@ -31,7 +31,7 @@ function Commnets({
productId,
getFullList,
orderFullList,
- theme
+ theme,
}) {
React.useEffect(() => {
if (!orderFullList.length) {
@@ -50,11 +50,7 @@ function Commnets({
renderItem={({ item }) => }
keyExtractor={(item) => item.id}
/>
-
+
);
}
@@ -150,53 +146,70 @@ const AddComment = ({ addComment, productId, theme, ...props }) => {
style={[
tw("w-full mt-4 px-2 rounded-md"),
{
- backgroundColor: theme === 'light' ? Colors.theme1.grayF9 : null,
- color: theme === 'light' ? Colors.theme1.gray20 : Colors.theme1.white,
+ backgroundColor: theme === "light" ? Colors.theme1.grayF9 : null,
+ color:
+ theme === "light" ? Colors.theme1.gray20 : Colors.theme1.white,
fontSize: fontSize.base,
textAlign: "right",
fontFamily: "light",
borderWidth: 1,
- borderColor: theme === 'light' ? Colors.theme1.grayE3 : Colors.theme1.white + '55',
- height : fontSize.base + 30
+ borderColor:
+ theme === "light"
+ ? Colors.theme1.grayE3
+ : Colors.theme1.white + "55",
+ height: fontSize.base + 30,
},
]}
value={comment.title}
placeholder="عنوان نظر ..."
- onChangeText={(text) => setCommentForm({...commentForm, title : text})}
- placeholderTextColor={theme === 'light' ? Colors.theme1.gray2077 : Colors.theme1.white + 'aa'}
+ onChangeText={(text) => setCommentForm({ ...commentForm, title: text })}
+ placeholderTextColor={
+ theme === "light"
+ ? Colors.theme1.gray2077
+ : Colors.theme1.white + "aa"
+ }
/>
setCommentForm({...commentForm, text})}
- placeholderTextColor={theme === 'light' ? Colors.theme1.gray2077 : Colors.theme1.white + 'aa'}
+ onChangeText={(text) => setCommentForm({ ...commentForm, text })}
+ placeholderTextColor={
+ theme === "light"
+ ? Colors.theme1.gray2077
+ : Colors.theme1.white + "aa"
+ }
/>
-
- addComment(commentForm)}
- />
-
+ {commentForm.title && commentForm.text ? (
+
+ addComment(commentForm)}
+ />
+
+ ) : null}
);
};