related-ui-components 1.8.5 → 1.8.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 +62 -120
- package/lib/commonjs/app.js.map +1 -1
- package/lib/commonjs/components/Wheel/Wheel.js +193 -178
- package/lib/commonjs/components/Wheel/Wheel.js.map +1 -1
- package/lib/commonjs/index.js +5 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/app.js +63 -121
- package/lib/module/app.js.map +1 -1
- package/lib/module/components/Wheel/Wheel.js +194 -180
- package/lib/module/components/Wheel/Wheel.js.map +1 -1
- package/lib/module/index.js +4 -7
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/app.d.ts +2 -2
- package/lib/typescript/commonjs/app.d.ts.map +1 -1
- package/lib/typescript/commonjs/components/Wheel/Wheel.d.ts +3 -1
- package/lib/typescript/commonjs/components/Wheel/Wheel.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +1 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/module/app.d.ts +2 -2
- package/lib/typescript/module/app.d.ts.map +1 -1
- package/lib/typescript/module/components/Wheel/Wheel.d.ts +3 -1
- package/lib/typescript/module/components/Wheel/Wheel.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +1 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/app.tsx +35 -99
- package/src/components/Wheel/Wheel.tsx +233 -220
- package/src/index.ts +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/app.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/app.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAaxC,QAAA,MAAM,eAAe,yBA6BpB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -9,8 +9,10 @@ export interface SpinWheelItem {
|
|
|
9
9
|
}
|
|
10
10
|
interface SpinWheelProps {
|
|
11
11
|
items: SpinWheelItem[];
|
|
12
|
+
predeterminedWinner?: SpinWheelItem | string | number;
|
|
12
13
|
size?: number;
|
|
13
14
|
spinDuration?: number;
|
|
15
|
+
friction?: number;
|
|
14
16
|
enabled?: boolean;
|
|
15
17
|
onSpinStart?: () => void;
|
|
16
18
|
onSpinEnd?: (item: SpinWheelItem) => void;
|
|
@@ -21,10 +23,10 @@ interface SpinWheelProps {
|
|
|
21
23
|
knobStyle?: ViewStyle;
|
|
22
24
|
actionButtonStyle?: ViewStyle;
|
|
23
25
|
actionButtonTextStyle?: TextStyle;
|
|
26
|
+
wheelBorderColor?: string;
|
|
24
27
|
wheelTextColor?: string;
|
|
25
28
|
knobColor?: string;
|
|
26
29
|
centerComponent?: React.ReactNode;
|
|
27
|
-
predeterminedWinnerId?: string | number | null;
|
|
28
30
|
}
|
|
29
31
|
declare const SpinWheel: React.FC<SpinWheelProps>;
|
|
30
32
|
export default SpinWheel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wheel.d.ts","sourceRoot":"","sources":["../../../../../src/components/Wheel/Wheel.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Wheel.d.ts","sourceRoot":"","sources":["../../../../../src/components/Wheel/Wheel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAOL,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA+BD,UAAU,cAAc;IAEtB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,mBAAmB,CAAC,EAAE,aAAa,GAAG,MAAM,GAAG,MAAM,CAAC;IAGtD,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAGlB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAG1C,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,iBAAiB,CAAC,EAAE,SAAS,CAAC;IAC9B,qBAAqB,CAAC,EAAE,SAAS,CAAC;IAGlC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACnC;AAED,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAwRvC,CAAC;AAqDF,eAAe,SAAS,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,yBAAyB,CAAC;AAOjC,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAC"}
|
package/package.json
CHANGED
package/src/app.tsx
CHANGED
|
@@ -1,109 +1,45 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { View, Button } from "react-native";
|
|
3
|
-
import
|
|
4
|
-
import BRANDS from "./constants/BRANDS";
|
|
5
|
-
import { Ionicons } from "@expo/vector-icons";
|
|
6
|
-
import { useTheme } from "./theme";
|
|
7
|
-
import RedeemedVoucherSheet from "./components/RedeemedVoucher/RedeemedVoucherSheet";
|
|
8
|
-
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
|
3
|
+
import SpinWheel, { SpinWheelItem } from "./components/Wheel/Wheel";
|
|
9
4
|
|
|
10
|
-
const
|
|
11
|
-
|
|
5
|
+
const wheelItems: SpinWheelItem[] = [
|
|
6
|
+
{ id: 1, label: "Prize 1", color: "#FF6384" },
|
|
7
|
+
{ id: 2, label: "Prize 2", color: "#36A2EB" },
|
|
8
|
+
{ id: 3, label: "Prize 3", color: "#FFCE56" },
|
|
9
|
+
{ id: 4, label: "Prize 4", color: "#4BC0C0" },
|
|
10
|
+
{ id: 5, label: "Prize 5", color: "#9966FF" },
|
|
11
|
+
{ id: 6, label: "Prize 6", color: "#FF9F40" },
|
|
12
|
+
];
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const handleApplyFilters = (result: FilterResult) => {
|
|
16
|
-
console.log("Filters applied:", result);
|
|
17
|
-
// Process filter results...
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const rewardsData = [
|
|
21
|
-
{
|
|
22
|
-
icon: (
|
|
23
|
-
<Ionicons name="briefcase-outline" size={30} color={theme.primary} />
|
|
24
|
-
),
|
|
25
|
-
activeIcon: (
|
|
26
|
-
<Ionicons name="briefcase-outline" size={30} color={theme.onPrimary} />
|
|
27
|
-
),
|
|
28
|
-
title: "Aqua Guardian",
|
|
29
|
-
description:
|
|
30
|
-
"Maintain water usage below the community average for a month.",
|
|
31
|
-
isActive: false,
|
|
32
|
-
status: "0/1",
|
|
33
|
-
statusBackgroundColor: "#FFCDD2",
|
|
34
|
-
statusTextColor: "#D32F2F",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
icon: <Ionicons name="heart-outline" size={30} color={theme.primary} />,
|
|
38
|
-
activeIcon: (
|
|
39
|
-
<Ionicons name="heart-outline" size={30} color={theme.onPrimary} />
|
|
40
|
-
),
|
|
41
|
-
title: "Wellness Warrior",
|
|
42
|
-
description: "Complete 30 days of healthy hydration tracking.",
|
|
43
|
-
isActive: true,
|
|
44
|
-
status: "15/30",
|
|
45
|
-
statusBackgroundColor: "#C8E6C9",
|
|
46
|
-
statusTextColor: "#388E3C",
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
icon: <Ionicons name="airplane-outline" size={24} color={theme.helper} />,
|
|
50
|
-
activeIcon: (
|
|
51
|
-
<Ionicons name="airplane-outline" size={24} color={theme.primary} />
|
|
52
|
-
),
|
|
53
|
-
title: "Eco Traveler",
|
|
54
|
-
description: "Log 5 trips where you chose sustainable travel options.",
|
|
55
|
-
isActive: false,
|
|
56
|
-
status: "2/5",
|
|
57
|
-
statusBackgroundColor: theme.disabled,
|
|
58
|
-
statusTextColor: theme.text,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
icon: <Ionicons name="school-outline" size={24} color={theme.helper} />,
|
|
62
|
-
activeIcon: (
|
|
63
|
-
<Ionicons name="school-outline" size={24} color={theme.primary} />
|
|
64
|
-
),
|
|
65
|
-
title: "Knowledge Seeker",
|
|
66
|
-
description: "Complete all water conservation learning modules.",
|
|
67
|
-
isActive: false,
|
|
68
|
-
status: "3/5",
|
|
69
|
-
statusBackgroundColor: theme.disabled,
|
|
70
|
-
statusTextColor: theme.text,
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
icon: <Ionicons name="settings-outline" size={24} color={theme.helper} />,
|
|
74
|
-
activeIcon: (
|
|
75
|
-
<Ionicons name="settings-outline" size={24} color={theme.primary} />
|
|
76
|
-
),
|
|
77
|
-
title: "Smart Saver",
|
|
78
|
-
description: "Set up and use all water-saving features in the app.",
|
|
79
|
-
isActive: true,
|
|
80
|
-
status: "4/4",
|
|
81
|
-
statusBackgroundColor: theme.primary,
|
|
82
|
-
statusTextColor: theme.background,
|
|
83
|
-
},
|
|
84
|
-
];
|
|
14
|
+
const MockWheelScreen = () => {
|
|
15
|
+
const [winner, setWinner] = useState<SpinWheelItem | null>(null);
|
|
85
16
|
|
|
86
17
|
return (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
// primaryButtonColors={["red", "blue"]}
|
|
98
|
-
onMyVouchersButtonPress={() => console.log("My Vouchers pressed")}
|
|
99
|
-
onCopyCode={(code) => console.log("Copied:", code)}
|
|
100
|
-
// To use custom icons:
|
|
101
|
-
// amountIconComponent={<Image source={YourCustomAmountIcon} style={{width: 20, height: 20, marginRight: 5}} />}
|
|
102
|
-
// renderCopyIcon={() => <Text style={{fontSize: 22, color: 'blue'}}>COPY</Text>}
|
|
18
|
+
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
|
|
19
|
+
<SpinWheel
|
|
20
|
+
items={wheelItems}
|
|
21
|
+
predeterminedWinner={wheelItems[2]}
|
|
22
|
+
onSpinEnd={(item) => {
|
|
23
|
+
alert(`Winner: ${item.label}`);
|
|
24
|
+
setWinner(null);
|
|
25
|
+
}}
|
|
26
|
+
size={300}
|
|
27
|
+
spinButtonText="Spin Randomly"
|
|
103
28
|
/>
|
|
104
|
-
|
|
105
|
-
|
|
29
|
+
|
|
30
|
+
<View style={{ flexDirection: "row", marginTop: 20 }}>
|
|
31
|
+
<Button
|
|
32
|
+
title="Spin to Prize 3"
|
|
33
|
+
onPress={() => setWinner(wheelItems[2])}
|
|
34
|
+
/>
|
|
35
|
+
<View style={{ width: 20 }} />
|
|
36
|
+
<Button
|
|
37
|
+
title="Spin Random"
|
|
38
|
+
onPress={() => setWinner(null)}
|
|
39
|
+
/>
|
|
40
|
+
</View>
|
|
41
|
+
</View>
|
|
106
42
|
);
|
|
107
43
|
};
|
|
108
44
|
|
|
109
|
-
export default
|
|
45
|
+
export default MockWheelScreen;
|