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