related-ui-components 2.5.9 → 2.6.1
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/module/components/RangeSlider/RangeSlider.js +209 -0
- package/lib/module/components/RangeSlider/RangeSlider.js.map +1 -0
- package/lib/module/components/RangeSlider/index.js +5 -0
- package/lib/module/components/RangeSlider/index.js.map +1 -0
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/contexts/BottomSheetStackContext.js.map +1 -1
- package/lib/module/contexts/BottomSheetStackProvider.js +2 -1
- package/lib/module/contexts/BottomSheetStackProvider.js.map +1 -1
- package/lib/typescript/src/components/RangeSlider/RangeSlider.d.ts +40 -0
- package/lib/typescript/src/components/RangeSlider/RangeSlider.d.ts.map +1 -0
- package/lib/typescript/src/components/RangeSlider/index.d.ts +3 -0
- package/lib/typescript/src/components/RangeSlider/index.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts +1 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/contexts/BottomSheetStackContext.d.ts +2 -0
- package/lib/typescript/src/contexts/BottomSheetStackContext.d.ts.map +1 -1
- package/lib/typescript/src/contexts/BottomSheetStackProvider.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/RangeSlider/RangeSlider.tsx +253 -0
- package/src/components/RangeSlider/index.ts +2 -0
- package/src/components/index.ts +2 -1
- package/src/contexts/BottomSheetStackContext.tsx +3 -0
- package/src/contexts/BottomSheetStackProvider.tsx +2 -1
- package/src/index.ts +1 -1
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useCallback, useState } from "react";
|
|
4
|
+
import { StyleSheet, View, Text } from "react-native";
|
|
5
|
+
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
6
|
+
import Animated, { runOnJS, useAnimatedStyle, useSharedValue } from "react-native-reanimated";
|
|
7
|
+
import { useTheme } from "../../theme/index.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const LABEL_HEIGHT = 26; // Default height for the label area above the thumb
|
|
10
|
+
|
|
11
|
+
const RangeSlider = ({
|
|
12
|
+
// Core props
|
|
13
|
+
min,
|
|
14
|
+
max,
|
|
15
|
+
step = 1,
|
|
16
|
+
sliderWidth,
|
|
17
|
+
initialMinValue,
|
|
18
|
+
initialMaxValue,
|
|
19
|
+
onValueChange,
|
|
20
|
+
// Sizing props
|
|
21
|
+
thumbSize = 28,
|
|
22
|
+
railHeight = 6,
|
|
23
|
+
// Styling props
|
|
24
|
+
containerStyle,
|
|
25
|
+
railStyle,
|
|
26
|
+
activeRailStyle,
|
|
27
|
+
thumbStyle,
|
|
28
|
+
labelContainerStyle,
|
|
29
|
+
labelTextStyle
|
|
30
|
+
}) => {
|
|
31
|
+
const {
|
|
32
|
+
theme
|
|
33
|
+
} = useTheme();
|
|
34
|
+
const styles = getStyles(theme, thumbSize, railHeight);
|
|
35
|
+
|
|
36
|
+
// State for labels, allowing them to have dynamic width
|
|
37
|
+
const [leftLabel, setLeftLabel] = useState(initialMinValue.toLocaleString());
|
|
38
|
+
const [rightLabel, setRightLabel] = useState(initialMaxValue.toLocaleString());
|
|
39
|
+
|
|
40
|
+
// --- Worklets for calculations ---
|
|
41
|
+
const valueToPosition = useCallback(value => {
|
|
42
|
+
"worklet";
|
|
43
|
+
|
|
44
|
+
return (value - min) / (max - min) * sliderWidth;
|
|
45
|
+
}, [min, max, sliderWidth]);
|
|
46
|
+
const positionToValue = useCallback(position => {
|
|
47
|
+
"worklet";
|
|
48
|
+
|
|
49
|
+
const rawValue = position / sliderWidth * (max - min) + min;
|
|
50
|
+
return Math.round(rawValue / step) * step;
|
|
51
|
+
}, [min, max, step, sliderWidth]);
|
|
52
|
+
|
|
53
|
+
// --- Shared Values for Animation ---
|
|
54
|
+
const leftPosition = useSharedValue(valueToPosition(initialMinValue));
|
|
55
|
+
const rightPosition = useSharedValue(valueToPosition(initialMaxValue));
|
|
56
|
+
const context = useSharedValue({
|
|
57
|
+
x: 0
|
|
58
|
+
});
|
|
59
|
+
const activeThumb = useSharedValue(null);
|
|
60
|
+
|
|
61
|
+
// --- Pan Gesture Handler ---
|
|
62
|
+
const panGesture = Gesture.Pan().onBegin(e => {
|
|
63
|
+
// Determine which thumb is closer to the touch point
|
|
64
|
+
const distToLeft = Math.abs(e.x - leftPosition.value);
|
|
65
|
+
const distToRight = Math.abs(e.x - rightPosition.value);
|
|
66
|
+
if (distToLeft <= distToRight) {
|
|
67
|
+
activeThumb.value = "left";
|
|
68
|
+
context.value = {
|
|
69
|
+
x: leftPosition.value
|
|
70
|
+
};
|
|
71
|
+
} else {
|
|
72
|
+
activeThumb.value = "right";
|
|
73
|
+
context.value = {
|
|
74
|
+
x: rightPosition.value
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}).onUpdate(e => {
|
|
78
|
+
if (activeThumb.value === null) return;
|
|
79
|
+
const newPos = context.value.x + e.translationX;
|
|
80
|
+
|
|
81
|
+
// Update the correct thumb's position and label
|
|
82
|
+
if (activeThumb.value === "left") {
|
|
83
|
+
const clampedPos = Math.max(0, Math.min(newPos, rightPosition.value));
|
|
84
|
+
leftPosition.value = clampedPos;
|
|
85
|
+
runOnJS(setLeftLabel)(positionToValue(clampedPos).toLocaleString());
|
|
86
|
+
} else {
|
|
87
|
+
const clampedPos = Math.min(sliderWidth, Math.max(newPos, leftPosition.value));
|
|
88
|
+
rightPosition.value = clampedPos;
|
|
89
|
+
runOnJS(setRightLabel)(positionToValue(clampedPos).toLocaleString());
|
|
90
|
+
}
|
|
91
|
+
}).onEnd(() => {
|
|
92
|
+
if (activeThumb.value === null) return;
|
|
93
|
+
// Finalize values and call the onValueChange callback
|
|
94
|
+
const finalLeftValue = positionToValue(leftPosition.value);
|
|
95
|
+
const finalRightValue = positionToValue(rightPosition.value);
|
|
96
|
+
runOnJS(onValueChange)({
|
|
97
|
+
min: finalLeftValue,
|
|
98
|
+
max: finalRightValue
|
|
99
|
+
});
|
|
100
|
+
activeThumb.value = null;
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// --- Animated Styles ---
|
|
104
|
+
const animatedLeftThumbStyle = useAnimatedStyle(() => ({
|
|
105
|
+
transform: [{
|
|
106
|
+
translateX: leftPosition.value
|
|
107
|
+
}]
|
|
108
|
+
}));
|
|
109
|
+
const animatedRightThumbStyle = useAnimatedStyle(() => ({
|
|
110
|
+
// Adjust position to account for the thumb's own width
|
|
111
|
+
transform: [{
|
|
112
|
+
translateX: rightPosition.value - thumbSize
|
|
113
|
+
}]
|
|
114
|
+
}));
|
|
115
|
+
const animatedActiveRailStyle = useAnimatedStyle(() => ({
|
|
116
|
+
left: leftPosition.value,
|
|
117
|
+
right: sliderWidth - rightPosition.value
|
|
118
|
+
}));
|
|
119
|
+
return /*#__PURE__*/_jsx(GestureDetector, {
|
|
120
|
+
gesture: panGesture,
|
|
121
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
122
|
+
style: [styles.container, {
|
|
123
|
+
width: sliderWidth
|
|
124
|
+
}, containerStyle],
|
|
125
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
126
|
+
style: styles.railContainer,
|
|
127
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
128
|
+
style: [styles.rail, railStyle]
|
|
129
|
+
}), /*#__PURE__*/_jsx(Animated.View, {
|
|
130
|
+
style: [styles.activeRail, animatedActiveRailStyle, activeRailStyle]
|
|
131
|
+
})]
|
|
132
|
+
}), /*#__PURE__*/_jsxs(Animated.View, {
|
|
133
|
+
style: [styles.thumbContainer, animatedLeftThumbStyle],
|
|
134
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
135
|
+
style: [styles.labelContainer, labelContainerStyle],
|
|
136
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
137
|
+
style: [styles.labelText, labelTextStyle],
|
|
138
|
+
numberOfLines: 1,
|
|
139
|
+
children: leftLabel
|
|
140
|
+
})
|
|
141
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
142
|
+
style: [styles.thumb, thumbStyle]
|
|
143
|
+
})]
|
|
144
|
+
}), /*#__PURE__*/_jsxs(Animated.View, {
|
|
145
|
+
style: [styles.thumbContainer, animatedRightThumbStyle],
|
|
146
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
147
|
+
style: [styles.labelContainer, labelContainerStyle],
|
|
148
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
149
|
+
style: [styles.labelText, labelTextStyle],
|
|
150
|
+
numberOfLines: 1,
|
|
151
|
+
children: rightLabel
|
|
152
|
+
})
|
|
153
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
154
|
+
style: [styles.thumb, thumbStyle]
|
|
155
|
+
})]
|
|
156
|
+
})]
|
|
157
|
+
})
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
const getStyles = (theme, thumbSize, railHeight) => StyleSheet.create({
|
|
161
|
+
container: {
|
|
162
|
+
height: LABEL_HEIGHT + thumbSize,
|
|
163
|
+
justifyContent: "center"
|
|
164
|
+
},
|
|
165
|
+
railContainer: {
|
|
166
|
+
justifyContent: "center"
|
|
167
|
+
},
|
|
168
|
+
rail: {
|
|
169
|
+
height: railHeight,
|
|
170
|
+
borderRadius: railHeight / 2,
|
|
171
|
+
backgroundColor: theme.surfaceVariant
|
|
172
|
+
},
|
|
173
|
+
activeRail: {
|
|
174
|
+
height: railHeight,
|
|
175
|
+
backgroundColor: theme.primary,
|
|
176
|
+
position: "absolute"
|
|
177
|
+
},
|
|
178
|
+
thumbContainer: {
|
|
179
|
+
position: "absolute",
|
|
180
|
+
alignItems: "center",
|
|
181
|
+
// Center the thumb visually on its value point
|
|
182
|
+
transform: [{
|
|
183
|
+
translateX: -thumbSize / 2
|
|
184
|
+
}]
|
|
185
|
+
},
|
|
186
|
+
labelContainer: {
|
|
187
|
+
position: "absolute",
|
|
188
|
+
bottom: thumbSize + 4,
|
|
189
|
+
backgroundColor: theme.onBackground,
|
|
190
|
+
paddingHorizontal: 10,
|
|
191
|
+
paddingVertical: 4,
|
|
192
|
+
borderRadius: 4
|
|
193
|
+
},
|
|
194
|
+
labelText: {
|
|
195
|
+
color: theme.background,
|
|
196
|
+
fontSize: 14,
|
|
197
|
+
fontWeight: "bold"
|
|
198
|
+
},
|
|
199
|
+
thumb: {
|
|
200
|
+
width: thumbSize,
|
|
201
|
+
height: thumbSize,
|
|
202
|
+
borderRadius: thumbSize / 2,
|
|
203
|
+
backgroundColor: theme.background,
|
|
204
|
+
borderColor: theme.primary,
|
|
205
|
+
borderWidth: 5
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
export default RangeSlider;
|
|
209
|
+
//# sourceMappingURL=RangeSlider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","useState","StyleSheet","View","Text","Gesture","GestureDetector","Animated","runOnJS","useAnimatedStyle","useSharedValue","useTheme","jsx","_jsx","jsxs","_jsxs","LABEL_HEIGHT","RangeSlider","min","max","step","sliderWidth","initialMinValue","initialMaxValue","onValueChange","thumbSize","railHeight","containerStyle","railStyle","activeRailStyle","thumbStyle","labelContainerStyle","labelTextStyle","theme","styles","getStyles","leftLabel","setLeftLabel","toLocaleString","rightLabel","setRightLabel","valueToPosition","value","positionToValue","position","rawValue","Math","round","leftPosition","rightPosition","context","x","activeThumb","panGesture","Pan","onBegin","e","distToLeft","abs","distToRight","onUpdate","newPos","translationX","clampedPos","onEnd","finalLeftValue","finalRightValue","animatedLeftThumbStyle","transform","translateX","animatedRightThumbStyle","animatedActiveRailStyle","left","right","gesture","children","style","container","width","railContainer","rail","activeRail","thumbContainer","labelContainer","labelText","numberOfLines","thumb","create","height","justifyContent","borderRadius","backgroundColor","surfaceVariant","primary","alignItems","bottom","onBackground","paddingHorizontal","paddingVertical","color","background","fontSize","fontWeight","borderColor","borderWidth"],"sourceRoot":"..\\..\\..\\..\\src","sources":["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AAG,CAAC;IAC5BiE,eAAe,EAAE1D,KAAK,CAAC2D;EACzB,CAAC;EACDX,UAAU,EAAE;IACVO,MAAM,EAAE9D,UAAU;IAClBiE,eAAe,EAAE1D,KAAK,CAAC4D,OAAO;IAC9BjD,QAAQ,EAAE;EACZ,CAAC;EACDsC,cAAc,EAAE;IACdtC,QAAQ,EAAE,UAAU;IACpBkD,UAAU,EAAE,QAAQ;IACpB;IACA1B,SAAS,EAAE,CAAC;MAAEC,UAAU,EAAE,CAAC5C,SAAS,GAAG;IAAE,CAAC;EAC5C,CAAC;EACD0D,cAAc,EAAE;IACdvC,QAAQ,EAAE,UAAU;IACpBmD,MAAM,EAAEtE,SAAS,GAAG,CAAC;IACrBkE,eAAe,EAAE1D,KAAK,CAAC+D,YAAY;IACnCC,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,CAAC;IAClBR,YAAY,EAAE;EAChB,CAAC;EACDN,SAAS,EAAE;IACTe,KAAK,EAAElE,KAAK,CAACmE,UAAU;IACvBC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACDhB,KAAK,EAAE;IACLR,KAAK,EAAErD,SAAS;IAChB+D,MAAM,EAAE/D,SAAS;IACjBiE,YAAY,EAAEjE,SAAS,GAAG,CAAC;IAC3BkE,eAAe,EAAE1D,KAAK,CAACmE,UAAU;IACjCG,WAAW,EAAEtE,KAAK,CAAC4D,OAAO;IAC1BW,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAEJ,eAAevF,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default","RangeSlider"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/RangeSlider/index.ts"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,WAAW,QAAQ,kBAAe;AACtD,cAAc,kBAAe","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["components/index.ts"],"mappings":";;AAAA,cAAc,iBAAQ;AACtB,cAAc,wBAAe;AAC7B,cAAe,mBAAU;AACzB,cAAc,mBAAU;AACxB,cAAc,sBAAa;AAC3B,cAAc,oBAAW;AACzB,cAAc,kBAAS;AACvB,cAAc,wBAAe;AAC7B,cAAc,kBAAS;AACvB,cAAc,6BAAoB;AAClC,cAAc,wBAAe;AAC7B,cAAc,0BAAiB;AAC/B,cAAc,kBAAS;AACvB,cAAc,sBAAa;AAC3B,cAAc,oBAAW;AACzB,cAAc,4BAAmB;AACjC,cAAc,mBAAU;AACxB,cAAc,qBAAY;AAC1B,cAAc,uBAAc;AAC5B,cAAc,8BAAqB;AACnC,cAAc,0BAAiB;AAC/B,cAAc,4BAAmB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"..\\..\\..\\src","sources":["components/index.ts"],"mappings":";;AAAA,cAAc,iBAAQ;AACtB,cAAc,wBAAe;AAC7B,cAAe,mBAAU;AACzB,cAAc,mBAAU;AACxB,cAAc,sBAAa;AAC3B,cAAc,oBAAW;AACzB,cAAc,kBAAS;AACvB,cAAc,wBAAe;AAC7B,cAAc,kBAAS;AACvB,cAAc,6BAAoB;AAClC,cAAc,wBAAe;AAC7B,cAAc,0BAAiB;AAC/B,cAAc,kBAAS;AACvB,cAAc,sBAAa;AAC3B,cAAc,oBAAW;AACzB,cAAc,4BAAmB;AACjC,cAAc,mBAAU;AACxB,cAAc,qBAAY;AAC1B,cAAc,uBAAc;AAC5B,cAAc,8BAAqB;AACnC,cAAc,0BAAiB;AAC/B,cAAc,4BAAmB;AACjC,cAAc,wBAAe","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useContext","BottomSheetStackContext","createContext","useBottomSheetStack","context","Error"],"sourceRoot":"..\\..\\..\\src","sources":["contexts/BottomSheetStackContext.tsx"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["React","useContext","BottomSheetStackContext","createContext","useBottomSheetStack","context","Error"],"sourceRoot":"..\\..\\..\\src","sources":["contexts/BottomSheetStackContext.tsx"],"mappings":";;AACA,OAAOA,KAAK,IAAeC,UAAU,QAAQ,OAAO;AAmBpD,OAAO,MAAMC,uBAAuB,gBAClCF,KAAK,CAACG,aAAa,CAAqC,IAAI,CAAC;AAE/D,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAMC,OAAO,GAAGJ,UAAU,CAACC,uBAAuB,CAAC;EAEnD,IAAI,CAACG,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CACb,oEACF,CAAC;EACH;EAEA,OAAOD,OAAO;AAChB,CAAC","ignoreList":[]}
|
|
@@ -37,7 +37,7 @@ export const BottomSheetStackProvider = ({
|
|
|
37
37
|
const isOpen = stack.length > 0;
|
|
38
38
|
useEffect(() => {
|
|
39
39
|
if (isOpen && currentItem) {
|
|
40
|
-
sheetRef.current?.snapToIndex(0);
|
|
40
|
+
sheetRef.current?.snapToIndex(currentItem.initialSnapIndex ?? 0);
|
|
41
41
|
}
|
|
42
42
|
const backHandlerSubscription = BackHandler.addEventListener("hardwareBackPress", () => {
|
|
43
43
|
if (canGoBack) {
|
|
@@ -73,6 +73,7 @@ export const BottomSheetStackProvider = ({
|
|
|
73
73
|
canGoBack
|
|
74
74
|
},
|
|
75
75
|
children: [children, /*#__PURE__*/_jsx(BottomSheet, {
|
|
76
|
+
...currentItem?.bottomSheetProps,
|
|
76
77
|
ref: sheetRef,
|
|
77
78
|
index: -1,
|
|
78
79
|
snapPoints: currentItem?.snapPoints || ["100%"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BottomSheet","BottomSheetBackdrop","React","useCallback","useEffect","useMemo","useRef","useState","BackHandler","StyleSheet","Animated","FadeIn","FadeOut","useSafeAreaInsets","BottomSheetStackContext","jsx","_jsx","jsxs","_jsxs","BottomSheetStackProvider","children","stack","setStack","sheetRef","top","push","item","prev","clear","current","close","pop","length","slice","replace","currentItem","canGoBack","isOpen","snapToIndex","backHandlerSubscription","addEventListener","remove","AnimatedView","View","enteringAnimation","duration","exitingAnimation","renderBackdrop","props","disappearsOnIndex","style","backgroundColor","appearsOnIndex","pressBehavior","Provider","value","ref","index","snapPoints","enableDynamicSizing","dynamicSizing","enablePanDownToClose","android_keyboardInputMode","enableBlurKeyboardOnGesture","keyboardBlurBehavior","keyboardBehavior","onClose","backdropComponent","topInset","handleIndicatorStyle","styles","sheetContainer","entering","exiting","animatedView","component","create","flex"],"sourceRoot":"..\\..\\..\\src","sources":["contexts/BottomSheetStackProvider.tsx"],"mappings":";;AAAA,OAAOA,WAAW,IAChBC,mBAAmB,QAEd,sBAAsB;AAC7B,OAAOC,KAAK,IAEVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAASC,WAAW,EAAEC,UAAU,QAAQ,cAAc;AACtD,OAAOC,QAAQ,IAAIC,MAAM,EAAEC,OAAO,QAAQ,yBAAyB;AACnE,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SACEC,uBAAuB,QAElB,8BAA2B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnC,OAAO,MAAMC,wBAA2D,GAAGA,CAAC;EAC1EC;AACF,CAAC,KAAK;EACJ,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGf,QAAQ,CAAyB,EAAE,CAAC;EAC9D,MAAMgB,QAAQ,GAAGjB,MAAM,CAAc,IAAI,CAAC;EAC1C,MAAM;IAAEkB;EAAI,CAAC,GAAGX,iBAAiB,CAAC,CAAC;EAEnC,MAAMY,IAAI,GAAGtB,WAAW,CAAEuB,IAA0B,IAAK;IACvDJ,QAAQ,CAAEK,IAAI,IAAK,CAAC,GAAGA,IAAI,EAAED,IAAI,CAAC,CAAC;EACrC,CAAC,EAAE,EAAE,CAAC;EAEN,MAAME,KAAK,GAAGzB,WAAW,CAAC,MAAM;IAC9BoB,QAAQ,CAACM,OAAO,EAAEC,KAAK,CAAC,CAAC;IACzBR,QAAQ,CAAC,EAAE,CAAC;EACd,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMS,GAAG,GAAG5B,WAAW,CAAC,MAAM;IAC5B,IAAIkB,KAAK,CAACW,MAAM,IAAI,CAAC,EAAE;MACrBJ,KAAK,CAAC,CAAC;MACP;IACF;IACAN,QAAQ,CAAEK,IAAI,IAAKA,IAAI,CAACM,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;EACvC,CAAC,EAAE,CAACZ,KAAK,CAACW,MAAM,EAAEJ,KAAK,CAAC,CAAC;EAEzB,MAAMM,OAAO,GAAG/B,WAAW,CAAEuB,IAA0B,IAAK;IAC1DJ,QAAQ,CAAEK,IAAI,IAAK,CAAC,GAAGA,IAAI,CAACM,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAEP,IAAI,CAAC,CAAC;EAClD,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMS,WAAW,GAAG9B,OAAO,CAAC,MAAMgB,KAAK,CAACA,KAAK,CAACW,MAAM,GAAG,CAAC,CAAC,EAAE,CAACX,KAAK,CAAC,CAAC;EACnE,MAAMe,SAAS,GAAGf,KAAK,CAACW,MAAM,GAAG,CAAC;EAClC,MAAMK,MAAM,GAAGhB,KAAK,CAACW,MAAM,GAAG,CAAC;EAE/B5B,SAAS,CAAC,MAAM;IACd,IAAIiC,MAAM,IAAIF,WAAW,EAAE;MACzBZ,QAAQ,CAACM,OAAO,EAAES,WAAW,
|
|
1
|
+
{"version":3,"names":["BottomSheet","BottomSheetBackdrop","React","useCallback","useEffect","useMemo","useRef","useState","BackHandler","StyleSheet","Animated","FadeIn","FadeOut","useSafeAreaInsets","BottomSheetStackContext","jsx","_jsx","jsxs","_jsxs","BottomSheetStackProvider","children","stack","setStack","sheetRef","top","push","item","prev","clear","current","close","pop","length","slice","replace","currentItem","canGoBack","isOpen","snapToIndex","initialSnapIndex","backHandlerSubscription","addEventListener","remove","AnimatedView","View","enteringAnimation","duration","exitingAnimation","renderBackdrop","props","disappearsOnIndex","style","backgroundColor","appearsOnIndex","pressBehavior","Provider","value","bottomSheetProps","ref","index","snapPoints","enableDynamicSizing","dynamicSizing","enablePanDownToClose","android_keyboardInputMode","enableBlurKeyboardOnGesture","keyboardBlurBehavior","keyboardBehavior","onClose","backdropComponent","topInset","handleIndicatorStyle","styles","sheetContainer","entering","exiting","animatedView","component","create","flex"],"sourceRoot":"..\\..\\..\\src","sources":["contexts/BottomSheetStackProvider.tsx"],"mappings":";;AAAA,OAAOA,WAAW,IAChBC,mBAAmB,QAEd,sBAAsB;AAC7B,OAAOC,KAAK,IAEVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAASC,WAAW,EAAEC,UAAU,QAAQ,cAAc;AACtD,OAAOC,QAAQ,IAAIC,MAAM,EAAEC,OAAO,QAAQ,yBAAyB;AACnE,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SACEC,uBAAuB,QAElB,8BAA2B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnC,OAAO,MAAMC,wBAA2D,GAAGA,CAAC;EAC1EC;AACF,CAAC,KAAK;EACJ,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGf,QAAQ,CAAyB,EAAE,CAAC;EAC9D,MAAMgB,QAAQ,GAAGjB,MAAM,CAAc,IAAI,CAAC;EAC1C,MAAM;IAAEkB;EAAI,CAAC,GAAGX,iBAAiB,CAAC,CAAC;EAEnC,MAAMY,IAAI,GAAGtB,WAAW,CAAEuB,IAA0B,IAAK;IACvDJ,QAAQ,CAAEK,IAAI,IAAK,CAAC,GAAGA,IAAI,EAAED,IAAI,CAAC,CAAC;EACrC,CAAC,EAAE,EAAE,CAAC;EAEN,MAAME,KAAK,GAAGzB,WAAW,CAAC,MAAM;IAC9BoB,QAAQ,CAACM,OAAO,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9BC,gBAAgB,EAAC,YAAY;MAC7BC,OAAO,EAAExC,KAAM;MACfyC,iBAAiB,EAAErB,cAAe;MAClCsB,QAAQ,EAAE9C,GAAI;MACd+C,oBAAoB,EAAE;QAAEnB,eAAe,EAAE;MAAU,CAAE;MACrDD,KAAK,EAAEqB,MAAM,CAACC,cAAe;MAAArD,QAAA,EAE5Be,WAAW,iBACVnB,IAAA,CAAC2B,YAAY;QAEX+B,QAAQ,EAAE7B,iBAAkB;QAC5B8B,OAAO,EAAE5B,gBAAiB;QAC1BI,KAAK,EAAEqB,MAAM,CAACI,YAAa;QAAAxD,QAAA,EAE1Be,WAAW,CAAC0C;MAAS,GALjBxD,KAAK,CAACW,MAMC;IACf,CACU,CAAC;EAAA,CACkB,CAAC;AAEvC,CAAC;AAED,MAAMwC,MAAM,GAAG/D,UAAU,CAACqE,MAAM,CAAC;EAC/BL,cAAc,EAAE;IACd;IACA;IACA;EAAA,CACD;EACDG,YAAY,EAAE;IACZG,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle, TextStyle } from "react-native";
|
|
3
|
+
export interface RangeSliderProps {
|
|
4
|
+
/** The minimum value of the slider. */
|
|
5
|
+
min: number;
|
|
6
|
+
/** The maximum value of the slider. */
|
|
7
|
+
max: number;
|
|
8
|
+
/** The increment value for each step of the slider. */
|
|
9
|
+
step?: number;
|
|
10
|
+
/** The total width of the slider component in pixels. */
|
|
11
|
+
sliderWidth: number;
|
|
12
|
+
/** The initial value for the left (minimum) thumb. */
|
|
13
|
+
initialMinValue: number;
|
|
14
|
+
/** The initial value for the right (maximum) thumb. */
|
|
15
|
+
initialMaxValue: number;
|
|
16
|
+
/** Callback function triggered when the user releases a thumb, returning the new min and max values. */
|
|
17
|
+
onValueChange: (values: {
|
|
18
|
+
min: number;
|
|
19
|
+
max: number;
|
|
20
|
+
}) => void;
|
|
21
|
+
/** The diameter of the draggable thumb. */
|
|
22
|
+
thumbSize?: number;
|
|
23
|
+
/** The height of the slider rail. */
|
|
24
|
+
railHeight?: number;
|
|
25
|
+
/** Custom style for the main container. */
|
|
26
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
27
|
+
/** Custom style for the inactive part of the rail. */
|
|
28
|
+
railStyle?: StyleProp<ViewStyle>;
|
|
29
|
+
/** Custom style for the active (selected) part of the rail. */
|
|
30
|
+
activeRailStyle?: StyleProp<ViewStyle>;
|
|
31
|
+
/** Custom style for the thumbs. Overrides the default themed thumb. */
|
|
32
|
+
thumbStyle?: StyleProp<ViewStyle>;
|
|
33
|
+
/** Custom style for the container of the value labels. */
|
|
34
|
+
labelContainerStyle?: StyleProp<ViewStyle>;
|
|
35
|
+
/** Custom style for the text inside the labels. */
|
|
36
|
+
labelTextStyle?: StyleProp<TextStyle>;
|
|
37
|
+
}
|
|
38
|
+
declare const RangeSlider: React.FC<RangeSliderProps>;
|
|
39
|
+
export default RangeSlider;
|
|
40
|
+
//# sourceMappingURL=RangeSlider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RangeSlider.d.ts","sourceRoot":"","sources":["../../../../../src/components/RangeSlider/RangeSlider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AACrD,OAAO,EAIL,SAAS,EACT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAWtB,MAAM,WAAW,gBAAgB;IAE/B,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAC;IACpB,sDAAsD;IACtD,eAAe,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,eAAe,EAAE,MAAM,CAAC;IACxB,wGAAwG;IACxG,aAAa,EAAE,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAG9D,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,sDAAsD;IACtD,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC,+DAA+D;IAC/D,eAAe,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACvC,uEAAuE;IACvE,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,0DAA0D;IAC1D,mBAAmB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC3C,mDAAmD;IACnD,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACvC;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAiJ3C,CAAC;AAkDF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/RangeSlider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,cAAc,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAe,UAAU,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAe,UAAU,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { BottomSheetProps } from "@gorhom/bottom-sheet";
|
|
1
2
|
import React, { ReactNode } from "react";
|
|
2
3
|
export interface BottomSheetStackItem {
|
|
3
4
|
component: ReactNode;
|
|
4
5
|
snapPoints?: string[] | number[];
|
|
5
6
|
initialSnapIndex?: number;
|
|
6
7
|
dynamicSizing?: boolean;
|
|
8
|
+
bottomSheetProps?: Partial<Omit<BottomSheetProps, "children">>;
|
|
7
9
|
}
|
|
8
10
|
export interface BottomSheetStackContextType {
|
|
9
11
|
push: (item: BottomSheetStackItem) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetStackContext.d.ts","sourceRoot":"","sources":["../../../../src/contexts/BottomSheetStackContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;AAErD,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BottomSheetStackContext.d.ts","sourceRoot":"","sources":["../../../../src/contexts/BottomSheetStackContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;AAErD,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,gBAAgB,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC,CAAC;CAChE;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC3C,GAAG,EAAE,MAAM,IAAI,CAAC;IAChB,OAAO,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC9C,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,uBAAuB,mDAC2B,CAAC;AAEhE,eAAO,MAAM,mBAAmB,mCAU/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetStackProvider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/BottomSheetStackProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EACZ,SAAS,EAMV,MAAM,OAAO,CAAC;AASf,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"BottomSheetStackProvider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/BottomSheetStackProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EACZ,SAAS,EAMV,MAAM,OAAO,CAAC;AASf,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,CA2GtE,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import React, { useCallback, useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
StyleSheet,
|
|
4
|
+
View,
|
|
5
|
+
Text,
|
|
6
|
+
StyleProp,
|
|
7
|
+
ViewStyle,
|
|
8
|
+
TextStyle,
|
|
9
|
+
} from "react-native";
|
|
10
|
+
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
11
|
+
import Animated, {
|
|
12
|
+
runOnJS,
|
|
13
|
+
useAnimatedStyle,
|
|
14
|
+
useSharedValue,
|
|
15
|
+
} from "react-native-reanimated";
|
|
16
|
+
import { ThemeType, useTheme } from "../../theme";
|
|
17
|
+
|
|
18
|
+
const LABEL_HEIGHT = 26; // Default height for the label area above the thumb
|
|
19
|
+
|
|
20
|
+
export interface RangeSliderProps {
|
|
21
|
+
// --- Core Functionality ---
|
|
22
|
+
/** The minimum value of the slider. */
|
|
23
|
+
min: number;
|
|
24
|
+
/** The maximum value of the slider. */
|
|
25
|
+
max: number;
|
|
26
|
+
/** The increment value for each step of the slider. */
|
|
27
|
+
step?: number;
|
|
28
|
+
/** The total width of the slider component in pixels. */
|
|
29
|
+
sliderWidth: number;
|
|
30
|
+
/** The initial value for the left (minimum) thumb. */
|
|
31
|
+
initialMinValue: number;
|
|
32
|
+
/** The initial value for the right (maximum) thumb. */
|
|
33
|
+
initialMaxValue: number;
|
|
34
|
+
/** Callback function triggered when the user releases a thumb, returning the new min and max values. */
|
|
35
|
+
onValueChange: (values: { min: number; max: number }) => void;
|
|
36
|
+
|
|
37
|
+
// --- Sizing ---
|
|
38
|
+
/** The diameter of the draggable thumb. */
|
|
39
|
+
thumbSize?: number;
|
|
40
|
+
/** The height of the slider rail. */
|
|
41
|
+
railHeight?: number;
|
|
42
|
+
|
|
43
|
+
// --- Styling ---
|
|
44
|
+
/** Custom style for the main container. */
|
|
45
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
46
|
+
/** Custom style for the inactive part of the rail. */
|
|
47
|
+
railStyle?: StyleProp<ViewStyle>;
|
|
48
|
+
/** Custom style for the active (selected) part of the rail. */
|
|
49
|
+
activeRailStyle?: StyleProp<ViewStyle>;
|
|
50
|
+
/** Custom style for the thumbs. Overrides the default themed thumb. */
|
|
51
|
+
thumbStyle?: StyleProp<ViewStyle>;
|
|
52
|
+
/** Custom style for the container of the value labels. */
|
|
53
|
+
labelContainerStyle?: StyleProp<ViewStyle>;
|
|
54
|
+
/** Custom style for the text inside the labels. */
|
|
55
|
+
labelTextStyle?: StyleProp<TextStyle>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const RangeSlider: React.FC<RangeSliderProps> = ({
|
|
59
|
+
// Core props
|
|
60
|
+
min,
|
|
61
|
+
max,
|
|
62
|
+
step = 1,
|
|
63
|
+
sliderWidth,
|
|
64
|
+
initialMinValue,
|
|
65
|
+
initialMaxValue,
|
|
66
|
+
onValueChange,
|
|
67
|
+
// Sizing props
|
|
68
|
+
thumbSize = 28,
|
|
69
|
+
railHeight = 6,
|
|
70
|
+
// Styling props
|
|
71
|
+
containerStyle,
|
|
72
|
+
railStyle,
|
|
73
|
+
activeRailStyle,
|
|
74
|
+
thumbStyle,
|
|
75
|
+
labelContainerStyle,
|
|
76
|
+
labelTextStyle,
|
|
77
|
+
}) => {
|
|
78
|
+
const { theme } = useTheme();
|
|
79
|
+
const styles = getStyles(theme, thumbSize, railHeight);
|
|
80
|
+
|
|
81
|
+
// State for labels, allowing them to have dynamic width
|
|
82
|
+
const [leftLabel, setLeftLabel] = useState(initialMinValue.toLocaleString());
|
|
83
|
+
const [rightLabel, setRightLabel] = useState(
|
|
84
|
+
initialMaxValue.toLocaleString()
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
// --- Worklets for calculations ---
|
|
88
|
+
const valueToPosition = useCallback(
|
|
89
|
+
(value: number) => {
|
|
90
|
+
"worklet";
|
|
91
|
+
return ((value - min) / (max - min)) * sliderWidth;
|
|
92
|
+
},
|
|
93
|
+
[min, max, sliderWidth]
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const positionToValue = useCallback(
|
|
97
|
+
(position: number) => {
|
|
98
|
+
"worklet";
|
|
99
|
+
const rawValue = (position / sliderWidth) * (max - min) + min;
|
|
100
|
+
return Math.round(rawValue / step) * step;
|
|
101
|
+
},
|
|
102
|
+
[min, max, step, sliderWidth]
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
// --- Shared Values for Animation ---
|
|
106
|
+
const leftPosition = useSharedValue(valueToPosition(initialMinValue));
|
|
107
|
+
const rightPosition = useSharedValue(valueToPosition(initialMaxValue));
|
|
108
|
+
const context = useSharedValue({ x: 0 });
|
|
109
|
+
const activeThumb = useSharedValue<"left" | "right" | null>(null);
|
|
110
|
+
|
|
111
|
+
// --- Pan Gesture Handler ---
|
|
112
|
+
const panGesture = Gesture.Pan()
|
|
113
|
+
.onBegin((e) => {
|
|
114
|
+
// Determine which thumb is closer to the touch point
|
|
115
|
+
const distToLeft = Math.abs(e.x - leftPosition.value);
|
|
116
|
+
const distToRight = Math.abs(e.x - rightPosition.value);
|
|
117
|
+
if (distToLeft <= distToRight) {
|
|
118
|
+
activeThumb.value = "left";
|
|
119
|
+
context.value = { x: leftPosition.value };
|
|
120
|
+
} else {
|
|
121
|
+
activeThumb.value = "right";
|
|
122
|
+
context.value = { x: rightPosition.value };
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
.onUpdate((e) => {
|
|
126
|
+
if (activeThumb.value === null) return;
|
|
127
|
+
const newPos = context.value.x + e.translationX;
|
|
128
|
+
|
|
129
|
+
// Update the correct thumb's position and label
|
|
130
|
+
if (activeThumb.value === "left") {
|
|
131
|
+
const clampedPos = Math.max(0, Math.min(newPos, rightPosition.value));
|
|
132
|
+
leftPosition.value = clampedPos;
|
|
133
|
+
runOnJS(setLeftLabel)(positionToValue(clampedPos).toLocaleString());
|
|
134
|
+
} else {
|
|
135
|
+
const clampedPos = Math.min(
|
|
136
|
+
sliderWidth,
|
|
137
|
+
Math.max(newPos, leftPosition.value)
|
|
138
|
+
);
|
|
139
|
+
rightPosition.value = clampedPos;
|
|
140
|
+
runOnJS(setRightLabel)(positionToValue(clampedPos).toLocaleString());
|
|
141
|
+
}
|
|
142
|
+
})
|
|
143
|
+
.onEnd(() => {
|
|
144
|
+
if (activeThumb.value === null) return;
|
|
145
|
+
// Finalize values and call the onValueChange callback
|
|
146
|
+
const finalLeftValue = positionToValue(leftPosition.value);
|
|
147
|
+
const finalRightValue = positionToValue(rightPosition.value);
|
|
148
|
+
runOnJS(onValueChange)({ min: finalLeftValue, max: finalRightValue });
|
|
149
|
+
activeThumb.value = null;
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// --- Animated Styles ---
|
|
153
|
+
const animatedLeftThumbStyle = useAnimatedStyle(() => ({
|
|
154
|
+
transform: [{ translateX: leftPosition.value }],
|
|
155
|
+
}));
|
|
156
|
+
|
|
157
|
+
const animatedRightThumbStyle = useAnimatedStyle(() => ({
|
|
158
|
+
// Adjust position to account for the thumb's own width
|
|
159
|
+
transform: [{ translateX: rightPosition.value - thumbSize }],
|
|
160
|
+
}));
|
|
161
|
+
|
|
162
|
+
const animatedActiveRailStyle = useAnimatedStyle(() => ({
|
|
163
|
+
left: leftPosition.value,
|
|
164
|
+
right: sliderWidth - rightPosition.value,
|
|
165
|
+
}));
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<GestureDetector gesture={panGesture}>
|
|
169
|
+
<View style={[styles.container, { width: sliderWidth }, containerStyle]}>
|
|
170
|
+
<View style={styles.railContainer}>
|
|
171
|
+
<View style={[styles.rail, railStyle]} />
|
|
172
|
+
<Animated.View
|
|
173
|
+
style={[
|
|
174
|
+
styles.activeRail,
|
|
175
|
+
animatedActiveRailStyle,
|
|
176
|
+
activeRailStyle,
|
|
177
|
+
]}
|
|
178
|
+
/>
|
|
179
|
+
</View>
|
|
180
|
+
|
|
181
|
+
{/* Left Thumb */}
|
|
182
|
+
<Animated.View style={[styles.thumbContainer, animatedLeftThumbStyle]}>
|
|
183
|
+
<View style={[styles.labelContainer, labelContainerStyle]}>
|
|
184
|
+
<Text style={[styles.labelText, labelTextStyle]} numberOfLines={1}>
|
|
185
|
+
{leftLabel}
|
|
186
|
+
</Text>
|
|
187
|
+
</View>
|
|
188
|
+
<View style={[styles.thumb, thumbStyle]} />
|
|
189
|
+
</Animated.View>
|
|
190
|
+
|
|
191
|
+
{/* Right Thumb */}
|
|
192
|
+
<Animated.View style={[styles.thumbContainer, animatedRightThumbStyle]}>
|
|
193
|
+
<View style={[styles.labelContainer, labelContainerStyle]}>
|
|
194
|
+
<Text style={[styles.labelText, labelTextStyle]} numberOfLines={1}>
|
|
195
|
+
{rightLabel}
|
|
196
|
+
</Text>
|
|
197
|
+
</View>
|
|
198
|
+
<View style={[styles.thumb, thumbStyle]} />
|
|
199
|
+
</Animated.View>
|
|
200
|
+
</View>
|
|
201
|
+
</GestureDetector>
|
|
202
|
+
);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const getStyles = (theme: ThemeType, thumbSize: number, railHeight: number) =>
|
|
206
|
+
StyleSheet.create({
|
|
207
|
+
container: {
|
|
208
|
+
height: LABEL_HEIGHT + thumbSize,
|
|
209
|
+
justifyContent: "center",
|
|
210
|
+
},
|
|
211
|
+
railContainer: {
|
|
212
|
+
justifyContent: "center",
|
|
213
|
+
},
|
|
214
|
+
rail: {
|
|
215
|
+
height: railHeight,
|
|
216
|
+
borderRadius: railHeight / 2,
|
|
217
|
+
backgroundColor: theme.surfaceVariant,
|
|
218
|
+
},
|
|
219
|
+
activeRail: {
|
|
220
|
+
height: railHeight,
|
|
221
|
+
backgroundColor: theme.primary,
|
|
222
|
+
position: "absolute",
|
|
223
|
+
},
|
|
224
|
+
thumbContainer: {
|
|
225
|
+
position: "absolute",
|
|
226
|
+
alignItems: "center",
|
|
227
|
+
// Center the thumb visually on its value point
|
|
228
|
+
transform: [{ translateX: -thumbSize / 2 }],
|
|
229
|
+
},
|
|
230
|
+
labelContainer: {
|
|
231
|
+
position: "absolute",
|
|
232
|
+
bottom: thumbSize + 4,
|
|
233
|
+
backgroundColor: theme.onBackground,
|
|
234
|
+
paddingHorizontal: 10,
|
|
235
|
+
paddingVertical: 4,
|
|
236
|
+
borderRadius: 4,
|
|
237
|
+
},
|
|
238
|
+
labelText: {
|
|
239
|
+
color: theme.background,
|
|
240
|
+
fontSize: 14,
|
|
241
|
+
fontWeight: "bold",
|
|
242
|
+
},
|
|
243
|
+
thumb: {
|
|
244
|
+
width: thumbSize,
|
|
245
|
+
height: thumbSize,
|
|
246
|
+
borderRadius: thumbSize / 2,
|
|
247
|
+
backgroundColor: theme.background,
|
|
248
|
+
borderColor: theme.primary,
|
|
249
|
+
borderWidth: 5,
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
export default RangeSlider;
|
package/src/components/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BottomSheetProps } from "@gorhom/bottom-sheet";
|
|
1
2
|
import React, { ReactNode, useContext } from "react";
|
|
2
3
|
|
|
3
4
|
export interface BottomSheetStackItem {
|
|
@@ -5,6 +6,8 @@ export interface BottomSheetStackItem {
|
|
|
5
6
|
snapPoints?: string[] | number[];
|
|
6
7
|
initialSnapIndex?: number;
|
|
7
8
|
dynamicSizing?: boolean;
|
|
9
|
+
|
|
10
|
+
bottomSheetProps?: Partial<Omit<BottomSheetProps, "children">>;
|
|
8
11
|
}
|
|
9
12
|
|
|
10
13
|
export interface BottomSheetStackContextType {
|
|
@@ -52,7 +52,7 @@ export const BottomSheetStackProvider: React.FC<{ children: ReactNode }> = ({
|
|
|
52
52
|
|
|
53
53
|
useEffect(() => {
|
|
54
54
|
if (isOpen && currentItem) {
|
|
55
|
-
sheetRef.current?.snapToIndex(0);
|
|
55
|
+
sheetRef.current?.snapToIndex(currentItem.initialSnapIndex ?? 0);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
const backHandlerSubscription = BackHandler.addEventListener(
|
|
@@ -96,6 +96,7 @@ export const BottomSheetStackProvider: React.FC<{ children: ReactNode }> = ({
|
|
|
96
96
|
>
|
|
97
97
|
{children}
|
|
98
98
|
<BottomSheet
|
|
99
|
+
{...currentItem?.bottomSheetProps}
|
|
99
100
|
ref={sheetRef}
|
|
100
101
|
index={-1}
|
|
101
102
|
snapPoints={currentItem?.snapPoints || ["100%"]}
|
package/src/index.ts
CHANGED