related-ui-components 1.6.5 → 1.6.7
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/lib/commonjs/app.js +32 -142
- package/lib/commonjs/app.js.map +1 -1
- package/lib/commonjs/components/Filters/Filters.js +45 -53
- package/lib/commonjs/components/Filters/Filters.js.map +1 -1
- package/lib/module/app.js +32 -145
- package/lib/module/app.js.map +1 -1
- package/lib/module/components/Filters/Filters.js +51 -55
- package/lib/module/components/Filters/Filters.js.map +1 -1
- package/lib/typescript/commonjs/app.d.ts +3 -2
- package/lib/typescript/commonjs/app.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/Filters/Filters.d.ts +0 -1
- package/lib/typescript/commonjs/components/Filters/Filters.d.ts.map +1 -1
- package/lib/typescript/module/app.d.ts +3 -2
- package/lib/typescript/module/app.d.ts.map +1 -1
- package/lib/typescript/module/components/Filters/Filters.d.ts +0 -1
- package/lib/typescript/module/components/Filters/Filters.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/app.tsx +23 -143
- package/src/components/Filters/Filters.tsx +459 -449
package/src/app.tsx
CHANGED
|
@@ -1,150 +1,30 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Text,
|
|
6
|
-
TouchableOpacity,
|
|
7
|
-
ScrollView,
|
|
8
|
-
FlatList,
|
|
9
|
-
Alert,
|
|
10
|
-
Modal, // Import Modal
|
|
11
|
-
} from "react-native";
|
|
12
|
-
import { Ionicons } from "@expo/vector-icons";
|
|
13
|
-
import { RelatedProvider, useTheme } from "./theme";
|
|
14
|
-
import {
|
|
15
|
-
Banner,
|
|
16
|
-
Filters,
|
|
17
|
-
Popup,
|
|
18
|
-
RedemptionOption,
|
|
19
|
-
ScratchCard, // Your component
|
|
20
|
-
ScratchCardContent,
|
|
21
|
-
UnlockRewards,
|
|
22
|
-
} from "./components";
|
|
23
|
-
import { SafeAreaView } from "react-native-safe-area-context";
|
|
24
|
-
// ... other imports
|
|
25
|
-
import { GestureHandlerRootView } from "react-native-gesture-handler"; // Ensure import
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View, Button } from 'react-native';
|
|
3
|
+
import { FilterResult, Filters } from './components';
|
|
4
|
+
import BRANDS from './constants/BRANDS';
|
|
26
5
|
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
// ... other state and constants
|
|
6
|
+
const MyScreen = () => {
|
|
7
|
+
const [isFilterVisible, setIsFilterVisible] = useState(false);
|
|
30
8
|
|
|
31
|
-
|
|
32
|
-
|
|
9
|
+
const handleApplyFilters = (result: FilterResult) => {
|
|
10
|
+
console.log("Filters applied:", result);
|
|
11
|
+
// Process filter results...
|
|
12
|
+
};
|
|
33
13
|
|
|
34
14
|
return (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<RelatedProvider>
|
|
38
|
-
<SafeAreaView
|
|
39
|
-
style={{ flex: 1, padding: 10, backgroundColor: theme.background }}
|
|
40
|
-
>
|
|
41
|
-
{/* Example Button to open the modal */}
|
|
42
|
-
<TouchableOpacity
|
|
43
|
-
onPress={() => setScratchModalVisible(true)}
|
|
44
|
-
style={styles.testButton}
|
|
45
|
-
>
|
|
46
|
-
<Text style={styles.buttonText}>Show Scratch Card Modal</Text>
|
|
47
|
-
</TouchableOpacity>
|
|
15
|
+
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
|
16
|
+
<Button title="Show Filters" onPress={() => setIsFilterVisible(true)} />
|
|
48
17
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{/* Optional: Add a background overlay */}
|
|
59
|
-
<View style={styles.modalOverlay}>
|
|
60
|
-
{/* Center the card or position as needed */}
|
|
61
|
-
<View style={styles.modalContentContainer}>
|
|
62
|
-
<ScratchCard
|
|
63
|
-
backgroundColor="#8A2BE2"
|
|
64
|
-
text="Scratch to reveal your prize!"
|
|
65
|
-
textFontColor="#FFFFFF"
|
|
66
|
-
textFontSize={18}
|
|
67
|
-
width={300}
|
|
68
|
-
height={150}
|
|
69
|
-
onScratched={() => {
|
|
70
|
-
Alert.alert("Congratulations!", "You won a prize!");
|
|
71
|
-
// Optionally close modal after scratching
|
|
72
|
-
// setTimeout(() => setScratchModalVisible(false), 500);
|
|
73
|
-
}}
|
|
74
|
-
>
|
|
75
|
-
<ScratchCardContent style={{ backgroundColor: "#FFD700" }}>
|
|
76
|
-
<Text
|
|
77
|
-
style={{
|
|
78
|
-
fontSize: 24,
|
|
79
|
-
fontWeight: "bold",
|
|
80
|
-
color: "#000",
|
|
81
|
-
}}
|
|
82
|
-
>
|
|
83
|
-
50% OFF COUPON
|
|
84
|
-
</Text>
|
|
85
|
-
<Text style={{ marginTop: 8, color: "#333" }}>
|
|
86
|
-
Use code: SCRATCH50
|
|
87
|
-
</Text>
|
|
88
|
-
</ScratchCardContent>
|
|
89
|
-
</ScratchCard>
|
|
90
|
-
|
|
91
|
-
{/* Button to close the modal */}
|
|
92
|
-
<TouchableOpacity
|
|
93
|
-
onPress={() => setScratchModalVisible(false)}
|
|
94
|
-
style={styles.closeButton}
|
|
95
|
-
>
|
|
96
|
-
<Text style={styles.buttonText}>Close</Text>
|
|
97
|
-
</TouchableOpacity>
|
|
98
|
-
</View>
|
|
99
|
-
</View>
|
|
100
|
-
</GestureHandlerRootView>
|
|
101
|
-
</Modal>
|
|
102
|
-
|
|
103
|
-
{/* Other app content can go here */}
|
|
104
|
-
</SafeAreaView>
|
|
105
|
-
</RelatedProvider>
|
|
106
|
-
</GestureHandlerRootView>
|
|
18
|
+
<Filters
|
|
19
|
+
visible={isFilterVisible}
|
|
20
|
+
onClose={() => setIsFilterVisible(false)} // Pass the function to close the modal
|
|
21
|
+
onActionButtonPress={handleApplyFilters}
|
|
22
|
+
// ... other filter props (sortOptions, brands, etc.)
|
|
23
|
+
sortOptions={[/* your sort options */]}
|
|
24
|
+
brands={BRANDS}
|
|
25
|
+
/>
|
|
26
|
+
</View>
|
|
107
27
|
);
|
|
108
|
-
}
|
|
28
|
+
};
|
|
109
29
|
|
|
110
|
-
|
|
111
|
-
// ... your existing styles
|
|
112
|
-
testButton: {
|
|
113
|
-
backgroundColor: "#4a90e2",
|
|
114
|
-
paddingVertical: 12,
|
|
115
|
-
paddingHorizontal: 30,
|
|
116
|
-
borderRadius: 8,
|
|
117
|
-
marginBottom: 20,
|
|
118
|
-
alignSelf: "center",
|
|
119
|
-
},
|
|
120
|
-
buttonText: {
|
|
121
|
-
color: "#FFFFFF",
|
|
122
|
-
fontSize: 16,
|
|
123
|
-
fontWeight: "bold",
|
|
124
|
-
textAlign: "center",
|
|
125
|
-
},
|
|
126
|
-
// Styles for the Modal
|
|
127
|
-
modalRootView: {
|
|
128
|
-
flex: 1, // Important for the root view to take up space
|
|
129
|
-
},
|
|
130
|
-
modalOverlay: {
|
|
131
|
-
flex: 1,
|
|
132
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)", // Semi-transparent background
|
|
133
|
-
justifyContent: "center", // Center content vertically
|
|
134
|
-
alignItems: "center", // Center content horizontally
|
|
135
|
-
},
|
|
136
|
-
modalContentContainer: {
|
|
137
|
-
// Optional: Add padding or background to the content area if needed
|
|
138
|
-
// backgroundColor: 'white',
|
|
139
|
-
// padding: 20,
|
|
140
|
-
// borderRadius: 10,
|
|
141
|
-
alignItems: "center", // Center items like the close button
|
|
142
|
-
},
|
|
143
|
-
closeButton: {
|
|
144
|
-
marginTop: 20,
|
|
145
|
-
backgroundColor: "#d9534f",
|
|
146
|
-
paddingVertical: 10,
|
|
147
|
-
paddingHorizontal: 25,
|
|
148
|
-
borderRadius: 8,
|
|
149
|
-
},
|
|
150
|
-
});
|
|
30
|
+
export default MyScreen;
|