reza fixed some error

master
Reza_ashrafi 3 years ago
parent 6415649000
commit e0c8e500b2
  1. 4
      App.js
  2. 6
      navigation/index.js
  3. 5
      src/redux/reducers/public.js
  4. 2
      src/screens/AR/components/Book.js
  5. 1
      src/screens/Home/components/MyBooks.js
  6. 21
      src/screens/Home/components/Scroll.js
  7. 17
      src/screens/Home/components/Videos.js
  8. 28
      src/screens/Home/index.js
  9. 45
      src/screens/Product/components/Comments.js

@ -21,10 +21,10 @@ const App = () => {
}
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
{/* <PersistGate loading={null} persistor={persistor}> */}
<Navigation />
<AlertModal />
</PersistGate>
{/* </PersistGate> */}
</Provider>
);
};

@ -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";
@ -580,6 +580,10 @@ const Navigation = ({
Restart();
}
getStatus();
StatusBar.setBarStyle(
`${theme === "light" ? "dark" : "light"}-content`,
true
);
}, []);
return (

@ -1,10 +1,10 @@
import { Dimensions } from "react-native";
import { Dimensions, AsyncStorage } from "react-native";
const width = Dimensions.get("window").width;
const initialState = {
ltr: false,
theme: 'dark',
theme: 'light',
mobile : width < 720,
homeData: [],
newProducts: [],
@ -80,7 +80,6 @@ const publicApi = (state = initialState, action) => {
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 {

@ -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 (
<Pressable
style={[

@ -12,6 +12,7 @@ import fontSize from "../../../constants/fontSize";
const ios = Platform.OS === "ios";
function MyBooks({ books, grades, theme }) {
console.log(books);
return books?.filter((book) => book.condition >= 2).length ? (
<View style={[tw("flex w-full mb-5")]}>
<View

@ -1,11 +1,5 @@
import React from "react";
import {
View,
Image,
Pressable,
FlatList,
Platform,
} from "react-native";
import { View, Image, Pressable, FlatList, Platform } from "react-native";
import { useNavigation } from "@react-navigation/native";
import tw from "tailwind-rn";
@ -25,8 +19,9 @@ function Scroll({ books, mobile }) {
style={[
tw("mr-1 overflow-hidden"),
{
width: position === 0 ? mobile ? 170 : 240 : mobile ? 84 : 125,
height: position === 0 ? mobile ? 240 : 350 : mobile ? 118 : 170,
width: position === 0 ? (mobile ? 170 : 240) : mobile ? 84 : 125,
height:
position === 0 ? (mobile ? 240 : 350) : mobile ? 118 : 170,
marginLeft: position === 0 ? 16 : 4,
},
]}
@ -43,9 +38,7 @@ function Scroll({ books, mobile }) {
<View
style={[
tw(
`flex justify-between ${
ios ? "flex-wrap" : "flex-wrap-reverse"
}`
`flex justify-between ${ios ? "flex-wrap" : "flex-wrap-reverse"}`
),
{ height: mobile ? 242 : 350, direction: "rtl" },
]}
@ -58,6 +51,7 @@ function Scroll({ books, mobile }) {
};
return (
<View style={[tw(`flex mb-5`)]}>
{books?.length ? (
<FlatList
showsHorizontalScrollIndicator={false}
horizontal={true}
@ -67,12 +61,13 @@ function Scroll({ books, mobile }) {
renderItem={({}) => <Box books={books} />}
keyExtractor={(item) => item.id}
/>
) : null}
</View>
);
}
const mapStateToProps = (state) => ({
mobile : state.publicApi.mobile
mobile: state.publicApi.mobile,
});
export default connect(mapStateToProps, {})(Scroll);

@ -20,6 +20,7 @@ function Videos({ videos, grades, mobile, theme }) {
<View style={tw("flex px-4")}>
<Header title="دورههای ویدئویی شما" route={"VOD"} />
</View>
{videos.length ? (
<FlatList
showsHorizontalScrollIndicator={false}
style={[tw("py-3")]}
@ -27,10 +28,16 @@ function Videos({ videos, grades, mobile, theme }) {
inverted={true}
data={videos.slice(0, 7)}
renderItem={({ item }) => (
<Video video={item} grades={grades} mobile={mobile} theme={theme} />
<Video
video={item}
grades={grades}
mobile={mobile}
theme={theme}
/>
)}
keyExtractor={(item) => item.id}
/>
) : null}
</View>
</View>
);
@ -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",

@ -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 (
<SafeAreaView style={styles.safeStyle}>
<Navbar
@ -90,7 +110,9 @@ const mapStateToProps = (state) => ({
});
const mapDispatchToProps = {
// getVideos: product.listVOD
getBlogs: blog.list,
getBooks: book.list,
getUserProducts: userProduct.list,
};
export default connect(mapStateToProps, mapDispatchToProps)(Home);

@ -31,7 +31,7 @@ function Commnets({
productId,
getFullList,
orderFullList,
theme
theme,
}) {
React.useEffect(() => {
if (!orderFullList.length) {
@ -50,11 +50,7 @@ function Commnets({
renderItem={({ item }) => <Comment comment={item} theme={theme} />}
keyExtractor={(item) => item.id}
/>
<AddComment
addComment={addComment}
productId={productId}
theme={theme}
/>
<AddComment addComment={addComment} productId={productId} theme={theme} />
</View>
);
}
@ -150,34 +146,45 @@ 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'}
placeholderTextColor={
theme === "light"
? Colors.theme1.gray2077
: Colors.theme1.white + "aa"
}
/>
<TextInput
style={[
tw("w-full mt-4 py-4 px-2 rounded-md h-40"),
{
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.tiny,
textAlign: "right",
fontFamily: "light",
borderWidth: 1,
borderColor: theme === 'light' ? Colors.theme1.grayE3 : Colors.theme1.white + '55',
borderColor:
theme === "light"
? Colors.theme1.grayE3
: Colors.theme1.white + "55",
},
]}
value={comment.text}
@ -185,8 +192,13 @@ const AddComment = ({ addComment, productId, theme, ...props }) => {
textAlignVertical="top"
placeholder="متن نظر ..."
onChangeText={(text) => setCommentForm({ ...commentForm, text })}
placeholderTextColor={theme === 'light' ? Colors.theme1.gray2077 : Colors.theme1.white + 'aa'}
placeholderTextColor={
theme === "light"
? Colors.theme1.gray2077
: Colors.theme1.white + "aa"
}
/>
{commentForm.title && commentForm.text ? (
<View style={tw("w-full mt-4")}>
<Pressable
title="ارسال نظر"
@ -197,6 +209,7 @@ const AddComment = ({ addComment, productId, theme, ...props }) => {
onPress={() => addComment(commentForm)}
/>
</View>
) : null}
</KeyboardAvoidingView>
);
};

Loading…
Cancel
Save