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":
return { ...state, loading: false, list: data, error: null };
case "userFactor/update":
// toast.success("درخواست شما با موفقیت انجام شد.");
return { ...state, loading: false, error: null };
case "userFactor/deleteUserOffCode":
return { ...state, loading: false, error: null };

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

Loading…
Cancel
Save