diff --git a/src/components/Avatar.js b/src/components/Avatar.js
new file mode 100644
index 0000000..07452e5
--- /dev/null
+++ b/src/components/Avatar.js
@@ -0,0 +1,54 @@
+import React from "react";
+import { Image, View } from "react-native";
+import Svg, { G, Path } from "react-native-svg";
+
+//style
+import tw from "tailwind-rn";
+
+function Avatar({ source, size }) {
+ return (
+
+ {source ? (
+
+ ) : (
+
+ )}
+
+ );
+}
+
+export default Avatar;
diff --git a/src/components/Drawer.js b/src/components/Drawer.js
index 7bd9a50..3e96bf3 100644
--- a/src/components/Drawer.js
+++ b/src/components/Drawer.js
@@ -9,6 +9,7 @@ import {
TouchableOpacity,
Image,
LayoutAnimation,
+ Animated,
} from "react-native";
import { useNavigation } from "@react-navigation/native";
import { asyncAwesomeAlert } from "../utils/AsyncWrappers";
@@ -17,11 +18,15 @@ import { user } from "../redux/actions";
import Svg, { Path, G } from "react-native-svg";
import { AntDesign } from "@expo/vector-icons";
+//components
+import Avatar from "../components/Avatar";
+
//style
import tw from "tailwind-rn";
import fontSize from "../constants/fontSize";
import Colors from "../constants/Colors";
+//variables
const ios = Platform.OS === "ios";
if (
@@ -34,6 +39,7 @@ if (
const Drawer = ({ position, setBoxPosition, user, mobile, theme }) => {
const [height, setHeight] = useState(Dimensions.get("window").height);
const [width, setWidth] = useState(Dimensions.get("window").width);
+ const fadeAnim = React.useRef(new Animated.Value(0)).current; // Initial value for opacity: 0
const [dropdown, setDropdown] = useState(false);
const [dropdownHeight, setDropdownHeight] = useState(0);
const navigation = useNavigation();
@@ -246,6 +252,23 @@ const Drawer = ({ position, setBoxPosition, user, mobile, theme }) => {
[mobile, position]
);
+ React.useEffect(() => {
+ if (position === "0%") {
+ setTimeout(() => {
+ Animated.timing(fadeAnim, {
+ toValue: 0.5,
+ duration: 300,
+ }).start();
+ }, 300);
+ }
+ if (position === "100%") {
+ Animated.timing(fadeAnim, {
+ toValue: 0,
+ duration: 10,
+ }).start();
+ }
+ }, [position]);
+
const onLayout = React.useCallback(() => {
setHeight(Dimensions.get("window").height);
setWidth(Dimensions.get("window").width);
@@ -270,14 +293,14 @@ const Drawer = ({ position, setBoxPosition, user, mobile, theme }) => {
]}
onLayout={() => onLayout()}
>
- setBoxPosition()}
- style={[
- tw(
- `w-1/5 h-full ${position === "0%" ? "bg-black bg-opacity-40" : ""}`
- ),
- ]}
- >
+
+ setBoxPosition()}
+ >
+
{
]}
>
- {user?.picFileIds ? (
-
- ) : (
-
- )}
+
{
color: "white",
fontFamily: "bold",
marginTop: 5,
- textAlign: ios ? "right" : "auto",
+ textAlign: "right",
}}
>
{user?.cellphone}
diff --git a/src/components/Empty.js b/src/components/Empty.js
index c027699..9e2542f 100644
--- a/src/components/Empty.js
+++ b/src/components/Empty.js
@@ -8,7 +8,6 @@ import tw from "tailwind-rn";
import fontSize from "../constants/fontSize";
const Empty = ({ text, buttonText, buttonAction, theme }) => {
- console.log('first');
return (
{
case "user/loading":
return { ...state, loading: true };
case "user/error":
+ asyncAwesomeAlert("خطا", data.message, {
+ showCancelButton: false,
+ });
return { ...state, error : true };
default:
return state;
diff --git a/src/screens/Product/components/Book.js b/src/screens/Product/components/Book.js
index 6de7d90..be5c182 100644
--- a/src/screens/Product/components/Book.js
+++ b/src/screens/Product/components/Book.js
@@ -527,7 +527,7 @@ function Book({
امتیازات و نظرات
-
{
behavior={ios ? "padding" : "height"}
style={[tw("flex items-end")]}
>
-
+
{
+const User = ({ user, mobile, theme }) => {
const [dropdown, setDropdown] = React.useState(true);
const navigation = useNavigation();
React.useEffect(() => {
- if(!user){
- navigation.navigate('Login');
+ if (!user) {
+ navigation.navigate("Login");
}
- },[user]);
+ }, [user]);
return (
@@ -32,28 +38,8 @@ const User = ({ user, mobile, theme, logout }) => {
onPress={() => setDropdown(!dropdown)}
>
- {user?.picFileIds ? (
-
- ) : (
-
- )}
-
+
+
{
color: Colors.theme1[theme].gray20,
fontFamily: "light",
marginTop: mobile ? 3 : 6,
+ textAlign: "right",
}}
>
{user?.cellphone}
@@ -141,5 +128,4 @@ const mapStateToProps = (state) => ({
theme: state.publicApi.theme,
});
-
export default connect(mapStateToProps)(User);
diff --git a/src/screens/Profile/index.js b/src/screens/Profile/index.js
index 98d338f..5b4aae7 100644
--- a/src/screens/Profile/index.js
+++ b/src/screens/Profile/index.js
@@ -9,6 +9,7 @@ import {
SafeAreaView,
StatusBar,
LayoutAnimation,
+ ActivityIndicator,
} from "react-native";
import { connect } from "react-redux";
import { useNavigation } from "@react-navigation/native";
@@ -28,7 +29,7 @@ import fontSize from "../../constants/fontSize";
import Colors from "../../constants/Colors";
import tw from "tailwind-rn";
-function Profile({ mobile, theme, logout }) {
+function Profile({ mobile, theme, logout, loading }) {
const navigation = useNavigation();
const [position, setPosition] = useState("100%");
@@ -78,33 +79,41 @@ function Profile({ mobile, theme, logout }) {
-
+ )}
+
خروج از حساب کاربری
@@ -119,6 +128,7 @@ function Profile({ mobile, theme, logout }) {
const mapStateToProps = (state) => ({
mobile: state.publicApi.mobile,
theme: state.publicApi.theme,
+ loading: state.user.loading,
});
const mapDispatchToProps = {
diff --git a/src/screens/Splash/index.js b/src/screens/Splash/index.js
index 7d6a277..1ae9d95 100644
--- a/src/screens/Splash/index.js
+++ b/src/screens/Splash/index.js
@@ -44,10 +44,7 @@ function Splash({
setOut(false);
BackHandler.exitApp();
}
-
- // if(isFocused){
- // console.log('bi rabt');
- // }
+
if(isFocused && !out){
if (isLogin !== null) {
diff --git a/src/screens/Video/index.js b/src/screens/Video/index.js
index d21c965..1ec43cc 100644
--- a/src/screens/Video/index.js
+++ b/src/screens/Video/index.js
@@ -161,7 +161,7 @@ function Product({