react-native-wagmi-charts 2.0.1 → 2.1.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/.DS_Store +0 -0
- package/README.md +30 -1
- package/example/.DS_Store +0 -0
- package/example/package.json +11 -13
- package/example/src/App.tsx +39 -34
- package/example/src/LineChart.tsx +2 -1
- package/example/yarn.lock +1819 -8871
- package/lib/commonjs/charts/candle/HoverTrap/index.web.js +120 -0
- package/lib/commonjs/charts/candle/HoverTrap/index.web.js.map +1 -0
- package/lib/commonjs/charts/line/ChartPath.js +8 -3
- package/lib/commonjs/charts/line/ChartPath.js.map +1 -1
- package/lib/commonjs/charts/line/HoverTrap/index.js +15 -0
- package/lib/commonjs/charts/line/HoverTrap/index.js.map +1 -0
- package/lib/commonjs/charts/line/HoverTrap/index.web.js +120 -0
- package/lib/commonjs/charts/line/HoverTrap/index.web.js.map +1 -0
- package/lib/commonjs/charts/line/index.js +4 -1
- package/lib/commonjs/charts/line/index.js.map +1 -1
- package/lib/commonjs/components/AnimatedText.js +3 -5
- package/lib/commonjs/components/AnimatedText.js.map +1 -1
- package/lib/module/charts/candle/HoverTrap/index.web.js +101 -0
- package/lib/module/charts/candle/HoverTrap/index.web.js.map +1 -0
- package/lib/module/charts/line/ChartPath.js +8 -3
- package/lib/module/charts/line/ChartPath.js.map +1 -1
- package/lib/module/charts/line/HoverTrap/index.js +3 -0
- package/lib/module/charts/line/HoverTrap/index.js.map +1 -0
- package/lib/module/charts/line/HoverTrap/index.web.js +101 -0
- package/lib/module/charts/line/HoverTrap/index.web.js.map +1 -0
- package/lib/module/charts/line/index.js +3 -1
- package/lib/module/charts/line/index.js.map +1 -1
- package/lib/module/components/AnimatedText.js +2 -5
- package/lib/module/components/AnimatedText.js.map +1 -1
- package/lib/typescript/src/charts/candle/HoverTrap/index.web.d.ts +2 -0
- package/lib/typescript/src/charts/line/ChartPath.d.ts +3 -3
- package/lib/typescript/src/charts/line/HoverTrap/index.d.ts +2 -0
- package/lib/typescript/src/charts/line/HoverTrap/index.web.d.ts +2 -0
- package/lib/typescript/src/charts/line/index.d.ts +2 -0
- package/package.json +5 -5
- package/src/charts/candle/HoverTrap/index.web.tsx +110 -0
- package/src/charts/line/ChartPath.tsx +19 -14
- package/src/charts/line/HoverTrap/index.tsx +3 -0
- package/src/charts/line/HoverTrap/index.web.tsx +110 -0
- package/src/charts/line/index.ts +2 -0
- package/src/components/AnimatedText.tsx +2 -5
- package/tsconfig.json +1 -1
- package/yarn.lock +1840 -796
- package/example/patches/react-native-reanimated+2.2.2.patch +0 -28
package/.DS_Store
CHANGED
|
Binary file
|
package/README.md
CHANGED
|
@@ -63,6 +63,7 @@ A sweet & simple chart library for React Native that will make us feel like **W*
|
|
|
63
63
|
- [LineChart.Tooltip](#linecharttooltip)
|
|
64
64
|
- [LineChart.PriceText](#linechartpricetext)
|
|
65
65
|
- [LineChart.DatetimeText](#linechartdatetimetext)
|
|
66
|
+
- [LineChart.HoverTrap](#linecharthovertrap)
|
|
66
67
|
- [CandlestickChart.Provider](#candlestickchartprovider)
|
|
67
68
|
- [CandlestickChart](#candlestickchart)
|
|
68
69
|
- [CandlestickChart.Candles](#candlestickchartcandles)
|
|
@@ -374,6 +375,25 @@ To customise the color of the line chart cursor, supply a `color` prop to `LineC
|
|
|
374
375
|
|
|
375
376
|
<img width="200px" alt="Screen Shot 2021-09-13 at 4 53 46 pm" src="https://user-images.githubusercontent.com/7336481/133037333-6b1345e5-a98b-459c-b3b1-6e5b08143f33.png">
|
|
376
377
|
|
|
378
|
+
#### Hovering the chart
|
|
379
|
+
|
|
380
|
+
By default, the cursor is triggered whenever you press the chart.
|
|
381
|
+
|
|
382
|
+
If your app runs on Web, you may want to trigger the cursor when a user hovers, too.
|
|
383
|
+
|
|
384
|
+
To achieve this, simply add `<LineChart.HoverTrap />` as the child of your cursor.
|
|
385
|
+
|
|
386
|
+
```jsx
|
|
387
|
+
<LineChart.Provider data={data}>
|
|
388
|
+
<LineChart>
|
|
389
|
+
<LineChart.Path color="hotpink" />
|
|
390
|
+
<LineChart.CursorCrosshair color="hotpink>
|
|
391
|
+
<LineChart.HoverTrap />
|
|
392
|
+
</LineChart.CursorCrosshair>
|
|
393
|
+
</LineChart>
|
|
394
|
+
</LineChart.Provider>
|
|
395
|
+
```
|
|
396
|
+
|
|
377
397
|
### Gradients
|
|
378
398
|
|
|
379
399
|
By using the `LineChart.Gradient` component, you can apply a gradient to the area underneath your path.
|
|
@@ -844,7 +864,6 @@ To customize the formatting of the date/time text, you can supply a `format` fun
|
|
|
844
864
|
| `showInactiveColor` | `boolean` | `true` | Whether or not to show the inactive highlight when the chart is inactive. |
|
|
845
865
|
| `width` | `number` | `3` | Width of the highlight stroke. |
|
|
846
866
|
|
|
847
|
-
|
|
848
867
|
### LineChart.HorizontalLine
|
|
849
868
|
|
|
850
869
|
| Prop | Type | Default | Description |
|
|
@@ -888,6 +907,16 @@ To customize the formatting of the date/time text, you can supply a `format` fun
|
|
|
888
907
|
| `style` | `{}` | | Style of the price text |
|
|
889
908
|
| `variant` | `"formatted"` or `"value"` | `"formatted"` | Default representation of the timestamp value. |
|
|
890
909
|
|
|
910
|
+
### LineChart.HoverTrap
|
|
911
|
+
|
|
912
|
+
This component doesn't take any props.
|
|
913
|
+
|
|
914
|
+
Place it as the child of your cursor component to trap hover events on Web. If you're using mutliple cursors, place this as the child of your lowest-rendered cursor.
|
|
915
|
+
|
|
916
|
+
```tsx
|
|
917
|
+
<LineChart.HoverTrap />
|
|
918
|
+
```
|
|
919
|
+
|
|
891
920
|
### CandlestickChart.Provider
|
|
892
921
|
|
|
893
922
|
| Prop | Type | Default | Description |
|
package/example/.DS_Store
CHANGED
|
Binary file
|
package/example/package.json
CHANGED
|
@@ -15,23 +15,21 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"bumbag": "^2.2.1",
|
|
17
17
|
"bumbag-native": "^2.3.0",
|
|
18
|
-
"expo": "
|
|
19
|
-
"expo-haptics": "
|
|
20
|
-
"expo-splash-screen": "~0.
|
|
21
|
-
"react": "
|
|
22
|
-
"react-dom": "
|
|
23
|
-
"react-native": "0.
|
|
24
|
-
"react-native-gesture-handler": "~1.
|
|
25
|
-
"react-native-reanimated": "2.
|
|
26
|
-
"react-native-
|
|
27
|
-
"react-native-web": "~0.13.12"
|
|
18
|
+
"expo": "^44.0.0-beta.2",
|
|
19
|
+
"expo-haptics": "~11.1.0",
|
|
20
|
+
"expo-splash-screen": "~0.14.0",
|
|
21
|
+
"react": "17.0.1",
|
|
22
|
+
"react-dom": "17.0.1",
|
|
23
|
+
"react-native": "0.64.3",
|
|
24
|
+
"react-native-gesture-handler": "~2.1.0",
|
|
25
|
+
"react-native-reanimated": "~2.3.1",
|
|
26
|
+
"react-native-web": "0.17.1"
|
|
28
27
|
},
|
|
29
28
|
"devDependencies": {
|
|
30
|
-
"@babel/core": "
|
|
29
|
+
"@babel/core": "^7.12.9",
|
|
31
30
|
"@babel/runtime": "^7.14.6",
|
|
32
31
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
33
|
-
"babel-preset-expo": "
|
|
34
|
-
"expo-cli": "^4.8.1",
|
|
32
|
+
"babel-preset-expo": "9.0.1",
|
|
35
33
|
"jsonfile": "^6.1.0",
|
|
36
34
|
"patch-package": "^6.4.7",
|
|
37
35
|
"postinstall-postinstall": "^2.1.0"
|
package/example/src/App.tsx
CHANGED
|
@@ -11,45 +11,50 @@ import {
|
|
|
11
11
|
|
|
12
12
|
import CandlestickChart from './CandlestickChart';
|
|
13
13
|
import LineChart from './LineChart';
|
|
14
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
14
15
|
|
|
15
16
|
export default function App() {
|
|
16
17
|
const [selected, setSelected] = React.useState('');
|
|
17
18
|
return (
|
|
18
|
-
<
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<Box.Scroll>
|
|
34
|
-
{!selected && (
|
|
35
|
-
<Box paddingX="major-2" marginTop="major-6">
|
|
36
|
-
<Heading.H6 marginBottom="major-2">
|
|
37
|
-
Click a chart below to get started
|
|
38
|
-
</Heading.H6>
|
|
39
|
-
<Button onPress={() => setSelected('candlestick')}>
|
|
40
|
-
<Text>Candlestick</Text>
|
|
41
|
-
</Button>
|
|
42
|
-
<Button onPress={() => setSelected('line')}>
|
|
43
|
-
<Text>Line</Text>
|
|
19
|
+
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
20
|
+
<BumbagNativeProvider>
|
|
21
|
+
<Box.Safe flex="1">
|
|
22
|
+
<Level
|
|
23
|
+
verticalBelow=""
|
|
24
|
+
paddingX="major-2"
|
|
25
|
+
paddingY="major-2"
|
|
26
|
+
alignY="center"
|
|
27
|
+
>
|
|
28
|
+
<Heading.H5 key={'heading'}>
|
|
29
|
+
React Native WAGMI Charts 💸
|
|
30
|
+
</Heading.H5>
|
|
31
|
+
{selected ? (
|
|
32
|
+
<Button size="small" onPress={() => setSelected('')}>
|
|
33
|
+
Back
|
|
44
34
|
</Button>
|
|
35
|
+
) : null}
|
|
36
|
+
</Level>
|
|
37
|
+
<Box.Scroll>
|
|
38
|
+
{!selected && (
|
|
39
|
+
<Box paddingX="major-2" marginTop="major-6">
|
|
40
|
+
<Heading.H6 marginBottom="major-2">
|
|
41
|
+
Click a chart below to get started
|
|
42
|
+
</Heading.H6>
|
|
43
|
+
<Button onPress={() => setSelected('candlestick')}>
|
|
44
|
+
<Text>Candlestick</Text>
|
|
45
|
+
</Button>
|
|
46
|
+
<Button onPress={() => setSelected('line')}>
|
|
47
|
+
<Text>Line</Text>
|
|
48
|
+
</Button>
|
|
49
|
+
</Box>
|
|
50
|
+
)}
|
|
51
|
+
<Box marginTop="major-2">
|
|
52
|
+
{selected === 'candlestick' && <CandlestickChart />}
|
|
53
|
+
{selected === 'line' && <LineChart />}
|
|
45
54
|
</Box>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
</Box>
|
|
51
|
-
</Box.Scroll>
|
|
52
|
-
</Box.Safe>
|
|
53
|
-
</BumbagNativeProvider>
|
|
55
|
+
</Box.Scroll>
|
|
56
|
+
</Box.Safe>
|
|
57
|
+
</BumbagNativeProvider>
|
|
58
|
+
</GestureHandlerRootView>
|
|
54
59
|
);
|
|
55
60
|
}
|