ordering-ui-react-native 0.17.7 → 0.17.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import { useLanguage } from 'ordering-components/native'
|
|
3
|
-
import { OText, OButton, OInput } from '../shared'
|
|
2
|
+
import { useLanguage, useUtils } from 'ordering-components/native'
|
|
3
|
+
import { OText, OButton, OInput, OIcon } from '../shared'
|
|
4
4
|
import { StyleSheet, TouchableOpacity, View } from 'react-native'
|
|
5
5
|
import AntDesignIcons from 'react-native-vector-icons/AntDesign'
|
|
6
6
|
import { useTheme } from 'styled-components/native'
|
|
7
7
|
import { SingleProductReviewParams } from '../../types'
|
|
8
|
+
import FastImage from 'react-native-fast-image'
|
|
8
9
|
|
|
9
10
|
import {
|
|
10
11
|
ProductContainer,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
LikeHandsActionContainer,
|
|
13
14
|
LikeHandsButton,
|
|
14
15
|
CommentsButtonGroup,
|
|
16
|
+
LogoWrapper
|
|
15
17
|
} from './styles'
|
|
16
18
|
|
|
17
19
|
export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
@@ -23,6 +25,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
23
25
|
|
|
24
26
|
const [, t] = useLanguage()
|
|
25
27
|
const theme = useTheme()
|
|
28
|
+
const [{ optimizeImage }] = useUtils()
|
|
26
29
|
|
|
27
30
|
const styles = StyleSheet.create({
|
|
28
31
|
inputTextArea: {
|
|
@@ -38,6 +41,12 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
38
41
|
justifyContent: 'center',
|
|
39
42
|
marginVertical: 10,
|
|
40
43
|
},
|
|
44
|
+
productStyle: {
|
|
45
|
+
width: 80,
|
|
46
|
+
height: 80,
|
|
47
|
+
marginLeft: 'auto',
|
|
48
|
+
marginRight: 'auto'
|
|
49
|
+
}
|
|
41
50
|
})
|
|
42
51
|
|
|
43
52
|
const [comments, setComments] = useState<Array<any>>([])
|
|
@@ -100,6 +109,24 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
100
109
|
return (
|
|
101
110
|
<>
|
|
102
111
|
<ProductContainer>
|
|
112
|
+
<LogoWrapper>
|
|
113
|
+
{product?.images ? (
|
|
114
|
+
<FastImage
|
|
115
|
+
style={styles.productStyle}
|
|
116
|
+
source={{
|
|
117
|
+
uri: optimizeImage(product?.images, 'h_250,c_limit'),
|
|
118
|
+
priority: FastImage.priority.normal,
|
|
119
|
+
}}
|
|
120
|
+
resizeMode={FastImage.resizeMode.cover}
|
|
121
|
+
/>
|
|
122
|
+
) : (
|
|
123
|
+
<OIcon
|
|
124
|
+
src={theme?.images?.dummies?.product}
|
|
125
|
+
width={80}
|
|
126
|
+
height={80}
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
129
|
+
</LogoWrapper>
|
|
103
130
|
<ProductHeader>
|
|
104
131
|
<OText numberOfLines={1} style={{ flex: 1 }}>{product?.name}</OText>
|
|
105
132
|
<LikeHandsActionContainer>
|
|
@@ -129,7 +156,7 @@ export const SingleProductReview = (props: SingleProductReviewParams) => {
|
|
|
129
156
|
style={{ height: 35, paddingLeft: 5, paddingRight: 5, marginHorizontal: 3, marginVertical: 10 }}
|
|
130
157
|
imgRightSrc={isSelectedComment(commentItem.key) ? theme.images.general.close : null}
|
|
131
158
|
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
132
|
-
onClick={() => handleChangeComment(commentItem)
|
|
159
|
+
onClick={() => handleChangeComment(commentItem)}
|
|
133
160
|
/>
|
|
134
161
|
))}
|
|
135
162
|
</CommentsButtonGroup>
|
|
@@ -14,6 +14,18 @@ export const LikeHandsActionContainer = styled.View`
|
|
|
14
14
|
flex-direction: row;
|
|
15
15
|
`
|
|
16
16
|
|
|
17
|
+
export const LogoWrapper = styled.View`
|
|
18
|
+
shadowRadius: 3;
|
|
19
|
+
shadowOffset: { width: 1, height: 4 };
|
|
20
|
+
elevation: 3;
|
|
21
|
+
borderRadius: 8;
|
|
22
|
+
shadowOpacity: 0.1;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
width: 80;
|
|
25
|
+
marginLeft: auto;
|
|
26
|
+
marginRight: auto;
|
|
27
|
+
`
|
|
28
|
+
|
|
17
29
|
export const LikeHandsButton = styled.TouchableOpacity`
|
|
18
30
|
${(props: any) => props.isLike && css`
|
|
19
31
|
margin-horizontal: 15px;
|