master
Reza_ashrafi 3 years ago
parent 64f995c2e5
commit 76e10ae95b
  1. 1
      src/redux/reducers/userFactor.js
  2. 31
      src/screens/Product/components/Rates.js

@ -49,7 +49,6 @@ export default function userFactor(state = initialState, action) {
case "userFactor/myList": case "userFactor/myList":
return { ...state, loading: false, list: data, error: null }; return { ...state, loading: false, list: data, error: null };
case "userFactor/update": case "userFactor/update":
// toast.success("درخواست شما با موفقیت انجام شد.");
return { ...state, loading: false, error: null }; return { ...state, loading: false, error: null };
case "userFactor/deleteUserOffCode": case "userFactor/deleteUserOffCode":
return { ...state, loading: false, error: null }; return { ...state, loading: false, error: null };

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import { View, Text, Dimensions, Appearance } from "react-native"; import { View, Text, Dimensions, Appearance, Pressable } from "react-native";
import { Rating } from "react-native-ratings"; import { Rating } from "react-native-ratings";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { vote } from "../../../redux/actions"; import { vote } from "../../../redux/actions";
@ -12,14 +12,23 @@ import Colors from "../../../constants/Colors";
const width = Dimensions.get("window").width; const width = Dimensions.get("window").width;
function Rates({ rate, productId, addVote, isBuyed }) { function Rates({ rate, productId, addVote, isBuyed = null }) {
const ratingCompleted = (rating) => { const ratingCompleted = (rating) => {
return; return;
}; };
return ( return (
<View style={tw("flex flex-row-reverse")}> <View style={tw("flex flex-row-reverse")}>
<View style={[tw("flex items-center justify-center"), { width: "25%" }]}> <Pressable
style={[tw("flex items-center justify-center"), { width: "25%" }]}
onPress={() =>
!isBuyed
? asyncAwesomeAlert("خطا", "شما این محصول رو خریداری نکرده اید.", {
showCancelButton: false,
})
: {}
}
>
<Text <Text
style={[ style={[
{ fontSize: fontSize.xl6, color: "#05335F", fontFamily: "bold" }, { fontSize: fontSize.xl6, color: "#05335F", fontFamily: "bold" },
@ -31,17 +40,9 @@ function Rates({ rate, productId, addVote, isBuyed }) {
type="star" type="star"
ratingCount={5} ratingCount={5}
imageSize={15} imageSize={15}
onFinishRating={(rating) => value={4}
isBuyed onFinishRating={(rating) => addVote({ productId, vote: rating })}
? addVote({ productId, vote: rating }) readonly={!isBuyed}
: asyncAwesomeAlert(
"خطا",
"شما این محصول رو خریداری نکرده اید.",
{
showCancelButton: false,
}
)
}
/> />
<Text <Text
style={{ style={{
@ -53,7 +54,7 @@ function Rates({ rate, productId, addVote, isBuyed }) {
> >
{`از بین ${1150} نفر`} {`از بین ${1150} نفر`}
</Text> </Text>
</View> </Pressable>
<View style={[tw("flex flex-1"), { width: "60%" }]}> <View style={[tw("flex flex-1"), { width: "60%" }]}>
{[ {[
{ name: "بخش ۱", value: 40 }, { name: "بخش ۱", value: 40 },

Loading…
Cancel
Save