|
|
|
@ -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 }, |
|
|
|
|