@hoddy-ui/core 1.0.82 → 1.0.85
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 +1 -1
- package/src/Components/Popup.tsx +43 -41
- package/src/Components/StarRating.tsx +31 -29
package/package.json
CHANGED
package/src/Components/Popup.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import { useColors } from "../hooks";
|
|
|
15
15
|
import { PopupProps } from "../types";
|
|
16
16
|
import { IconButton } from "./Button";
|
|
17
17
|
import Typography from "./Typography";
|
|
18
|
+
import { UIThemeProvider } from "../theme";
|
|
18
19
|
|
|
19
20
|
export const Popup: React.FC<PopupProps> = ({
|
|
20
21
|
title,
|
|
@@ -95,50 +96,51 @@ export const Popup: React.FC<PopupProps> = ({
|
|
|
95
96
|
onRequestClose={closeAction}
|
|
96
97
|
>
|
|
97
98
|
<View style={styles.backdrop} />
|
|
99
|
+
<UIThemeProvider>
|
|
100
|
+
<Modal
|
|
101
|
+
transparent
|
|
102
|
+
animationType="slide"
|
|
103
|
+
statusBarTranslucent
|
|
104
|
+
visible={showSecondary}
|
|
105
|
+
onRequestClose={closeAction}
|
|
106
|
+
>
|
|
107
|
+
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
|
|
108
|
+
<View style={styles.root}>
|
|
109
|
+
{open && (
|
|
110
|
+
<Pressable
|
|
111
|
+
style={StyleSheet.absoluteFill}
|
|
112
|
+
onPress={closeAction}
|
|
113
|
+
/>
|
|
114
|
+
)}
|
|
98
115
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
keyboardVerticalOffset={keyboardVerticalOffset}
|
|
118
|
-
behavior={Platform.OS === "ios" ? "position" : "padding"}
|
|
119
|
-
>
|
|
120
|
-
<View style={styles.container}>
|
|
121
|
-
{!bare && (
|
|
122
|
-
<View style={styles.title}>
|
|
123
|
-
<IconButton
|
|
124
|
-
size={20}
|
|
125
|
-
icon="close"
|
|
126
|
-
onPress={closeAction}
|
|
127
|
-
/>
|
|
128
|
-
<View style={{ flex: 1 }}>
|
|
129
|
-
<Typography color="textSecondary" align="center">
|
|
130
|
-
{title}
|
|
131
|
-
</Typography>
|
|
116
|
+
<KeyboardAvoidingView
|
|
117
|
+
style={styles.avoidingView}
|
|
118
|
+
keyboardVerticalOffset={keyboardVerticalOffset}
|
|
119
|
+
behavior={Platform.OS === "ios" ? "position" : "padding"}
|
|
120
|
+
>
|
|
121
|
+
<View style={styles.container}>
|
|
122
|
+
{!bare && (
|
|
123
|
+
<View style={styles.title}>
|
|
124
|
+
<IconButton
|
|
125
|
+
size={20}
|
|
126
|
+
icon="close"
|
|
127
|
+
onPress={closeAction}
|
|
128
|
+
/>
|
|
129
|
+
<View style={{ flex: 1 }}>
|
|
130
|
+
<Typography color="textSecondary" align="center">
|
|
131
|
+
{title}
|
|
132
|
+
</Typography>
|
|
133
|
+
</View>
|
|
132
134
|
</View>
|
|
133
|
-
|
|
134
|
-
)}
|
|
135
|
+
)}
|
|
135
136
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
137
|
+
<View style={styles.content}>{children}</View>
|
|
138
|
+
</View>
|
|
139
|
+
</KeyboardAvoidingView>
|
|
140
|
+
</View>
|
|
141
|
+
</TouchableWithoutFeedback>
|
|
142
|
+
</Modal>
|
|
143
|
+
</UIThemeProvider>
|
|
142
144
|
</Modal>
|
|
143
145
|
</>
|
|
144
146
|
);
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { Ionicons } from "@expo/vector-icons";
|
|
2
2
|
import * as Haptics from "expo-haptics";
|
|
3
3
|
import { FC, useEffect, useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ActivityIndicator,
|
|
6
|
+
TextInput,
|
|
7
|
+
TouchableOpacity,
|
|
8
|
+
View,
|
|
9
|
+
} from "react-native";
|
|
5
10
|
import { ScaledSheet } from "react-native-size-matters";
|
|
6
11
|
import { useColors } from "../hooks";
|
|
7
12
|
import { RatingInputProps, RatingStarsProps } from "../types";
|
|
@@ -41,7 +46,6 @@ export const RatingStars: FC<RatingStarsProps> = ({
|
|
|
41
46
|
export const RatingInput: FC<RatingInputProps> = ({
|
|
42
47
|
onSubmit: _onSubmit,
|
|
43
48
|
rating = 0,
|
|
44
|
-
noReview,
|
|
45
49
|
size = 16,
|
|
46
50
|
}) => {
|
|
47
51
|
const [showReviewsModal, setShowReviewsModal] = useState(false);
|
|
@@ -57,7 +61,7 @@ export const RatingInput: FC<RatingInputProps> = ({
|
|
|
57
61
|
inputCon: {
|
|
58
62
|
marginBottom: "20@vs",
|
|
59
63
|
backgroundColor: colors.white[3],
|
|
60
|
-
padding: "
|
|
64
|
+
padding: "15@ms",
|
|
61
65
|
borderRadius: 20,
|
|
62
66
|
},
|
|
63
67
|
input: {
|
|
@@ -67,10 +71,6 @@ export const RatingInput: FC<RatingInputProps> = ({
|
|
|
67
71
|
},
|
|
68
72
|
});
|
|
69
73
|
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
if (noReview && rate) onSubmit();
|
|
72
|
-
}, [rate, noReview]);
|
|
73
|
-
|
|
74
74
|
useEffect(() => {
|
|
75
75
|
setRate(rating);
|
|
76
76
|
}, [rating]);
|
|
@@ -78,37 +78,40 @@ export const RatingInput: FC<RatingInputProps> = ({
|
|
|
78
78
|
setRate(index + 1);
|
|
79
79
|
Haptics.selectionAsync();
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}, 500);
|
|
81
|
+
setTimeout(() => {
|
|
82
|
+
setShowReviewsModal(true);
|
|
83
|
+
}, 500);
|
|
85
84
|
};
|
|
86
85
|
|
|
87
86
|
const onSubmit = async () => {
|
|
88
87
|
setLoading(true);
|
|
89
|
-
_onSubmit && (await _onSubmit({ rating: rate, review }));
|
|
90
88
|
setShowReviewsModal(false);
|
|
89
|
+
_onSubmit && (await _onSubmit({ rating: rate, review }));
|
|
91
90
|
setLoading(false);
|
|
92
91
|
};
|
|
93
92
|
return (
|
|
94
93
|
<>
|
|
95
94
|
<View style={styles.root}>
|
|
96
|
-
{
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
95
|
+
{loading ? (
|
|
96
|
+
<ActivityIndicator />
|
|
97
|
+
) : (
|
|
98
|
+
[...Array(5)].map((_, index) => (
|
|
99
|
+
<TouchableOpacity
|
|
100
|
+
key={index}
|
|
101
|
+
activeOpacity={0.9}
|
|
102
|
+
onPress={() => {
|
|
103
|
+
onRate(index);
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
<Ionicons
|
|
107
|
+
style={{ marginLeft: 10 }}
|
|
108
|
+
name={index < rate ? "star" : "star-outline"}
|
|
109
|
+
size={size}
|
|
110
|
+
color={colors.primary.light}
|
|
111
|
+
/>
|
|
112
|
+
</TouchableOpacity>
|
|
113
|
+
))
|
|
114
|
+
)}
|
|
112
115
|
</View>
|
|
113
116
|
<Popup
|
|
114
117
|
sheet
|
|
@@ -138,7 +141,6 @@ export const RatingInput: FC<RatingInputProps> = ({
|
|
|
138
141
|
<TextInput
|
|
139
142
|
style={styles.input}
|
|
140
143
|
multiline
|
|
141
|
-
placeholderTextColor={colors.textSecondary.main}
|
|
142
144
|
value={review}
|
|
143
145
|
onChangeText={(text) => setReview(text)}
|
|
144
146
|
placeholder="Type review here.."
|