react-native-wagmi-charts 2.8.3 → 2.9.0
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/README.md
CHANGED
|
@@ -871,6 +871,7 @@ To customize the formatting of the date/time text, you can supply a `format` fun
|
|
|
871
871
|
| `crosshairProps` | `ViewProps` | | Props of the crosshair dot |
|
|
872
872
|
| `crosshairOuterProps` | `ViewProps` | | Props of the crosshair outer dot |
|
|
873
873
|
| `snapToPoint` | `boolean` | `false` | **REACT NATIVE ONLY** Snap cursor to X position of nearest data point |
|
|
874
|
+
| `persistOnEnd` | `boolean` | `false` | Keep the cursor pinned at its last position after the gesture ends |
|
|
874
875
|
| `at` | `number` | | Index of followed `data` item. |
|
|
875
876
|
| `...props` | `LongPressGestureHandlerProps` | | |
|
|
876
877
|
|
|
@@ -880,6 +881,7 @@ To customize the formatting of the date/time text, you can supply a `format` fun
|
|
|
880
881
|
| ----------- | ----------- | -------- | ---------------------------------------------------------------- |
|
|
881
882
|
| `color` | `string` | `"gray"` | Color of the cursor line |
|
|
882
883
|
| `lineProps` | `LineProps` | | Props of the cursor line. Takes React Native SVG's `Line` props. |
|
|
884
|
+
| `persistOnEnd` | `boolean` | `false` | Keep the cursor pinned at its last position after the gesture ends |
|
|
883
885
|
| `at` | `number` | | Index of followed `data` item. |
|
|
884
886
|
|
|
885
887
|
### LineChart.Dot
|
package/package.json
CHANGED
|
@@ -120,6 +120,12 @@ export function CandlestickChartCrosshair({
|
|
|
120
120
|
return (
|
|
121
121
|
<GestureDetector gesture={longPressGesture}>
|
|
122
122
|
<Animated.View style={StyleSheet.absoluteFill}>
|
|
123
|
+
<Animated.View
|
|
124
|
+
style={[StyleSheet.absoluteFill, vertical]}
|
|
125
|
+
{...verticalCrosshairProps}
|
|
126
|
+
>
|
|
127
|
+
<CandlestickChartLine color={color} x={0} y={height} {...lineProps} />
|
|
128
|
+
</Animated.View>
|
|
123
129
|
<Animated.View
|
|
124
130
|
style={[StyleSheet.absoluteFill, horizontal]}
|
|
125
131
|
{...horizontalCrosshairProps}
|
|
@@ -131,12 +137,6 @@ export function CandlestickChartCrosshair({
|
|
|
131
137
|
{children}
|
|
132
138
|
</CandlestickChartCrosshairTooltipContext.Provider>
|
|
133
139
|
</Animated.View>
|
|
134
|
-
<Animated.View
|
|
135
|
-
style={[StyleSheet.absoluteFill, vertical]}
|
|
136
|
-
{...verticalCrosshairProps}
|
|
137
|
-
>
|
|
138
|
-
<CandlestickChartLine color={color} x={0} y={height} {...lineProps} />
|
|
139
|
-
</Animated.View>
|
|
140
140
|
</Animated.View>
|
|
141
141
|
</GestureDetector>
|
|
142
142
|
);
|
|
@@ -26,6 +26,7 @@ export type LineChartCursorProps = {
|
|
|
26
26
|
onActivated?: () => void;
|
|
27
27
|
onEnded?: () => void;
|
|
28
28
|
orientation?: 'horizontal' | 'vertical';
|
|
29
|
+
persistOnEnd?: boolean;
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
export const CursorContext = React.createContext({ type: '' });
|
|
@@ -38,6 +39,7 @@ export function LineChartCursor({
|
|
|
38
39
|
type,
|
|
39
40
|
at,
|
|
40
41
|
shouldCancelWhenOutside = false,
|
|
42
|
+
persistOnEnd = false,
|
|
41
43
|
minDurationMs = 0,
|
|
42
44
|
onActivated,
|
|
43
45
|
onEnded,
|
|
@@ -149,8 +151,11 @@ export function LineChartCursor({
|
|
|
149
151
|
})
|
|
150
152
|
.onEnd(() => {
|
|
151
153
|
'worklet';
|
|
152
|
-
|
|
153
|
-
|
|
154
|
+
|
|
155
|
+
if (!persistOnEnd) {
|
|
156
|
+
isActive.value = false;
|
|
157
|
+
currentIndex.value = -1;
|
|
158
|
+
}
|
|
154
159
|
|
|
155
160
|
if (onEnded) {
|
|
156
161
|
runOnJS(onEnded)();
|
|
@@ -21,6 +21,7 @@ type LineChartCursorLineProps = {
|
|
|
21
21
|
lineProps?: Partial<LineProps>;
|
|
22
22
|
format?: TFormatterFn<string | number>;
|
|
23
23
|
textStyle?: TextStyle;
|
|
24
|
+
persistOnEnd?: boolean;
|
|
24
25
|
} & Omit<LineChartCursorProps, 'type' | 'children'>;
|
|
25
26
|
|
|
26
27
|
LineChartCursorLine.displayName = 'LineChartCursorLine';
|