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.
Files changed (46) hide show
  1. package/.DS_Store +0 -0
  2. package/README.md +30 -1
  3. package/example/.DS_Store +0 -0
  4. package/example/package.json +11 -13
  5. package/example/src/App.tsx +39 -34
  6. package/example/src/LineChart.tsx +2 -1
  7. package/example/yarn.lock +1819 -8871
  8. package/lib/commonjs/charts/candle/HoverTrap/index.web.js +120 -0
  9. package/lib/commonjs/charts/candle/HoverTrap/index.web.js.map +1 -0
  10. package/lib/commonjs/charts/line/ChartPath.js +8 -3
  11. package/lib/commonjs/charts/line/ChartPath.js.map +1 -1
  12. package/lib/commonjs/charts/line/HoverTrap/index.js +15 -0
  13. package/lib/commonjs/charts/line/HoverTrap/index.js.map +1 -0
  14. package/lib/commonjs/charts/line/HoverTrap/index.web.js +120 -0
  15. package/lib/commonjs/charts/line/HoverTrap/index.web.js.map +1 -0
  16. package/lib/commonjs/charts/line/index.js +4 -1
  17. package/lib/commonjs/charts/line/index.js.map +1 -1
  18. package/lib/commonjs/components/AnimatedText.js +3 -5
  19. package/lib/commonjs/components/AnimatedText.js.map +1 -1
  20. package/lib/module/charts/candle/HoverTrap/index.web.js +101 -0
  21. package/lib/module/charts/candle/HoverTrap/index.web.js.map +1 -0
  22. package/lib/module/charts/line/ChartPath.js +8 -3
  23. package/lib/module/charts/line/ChartPath.js.map +1 -1
  24. package/lib/module/charts/line/HoverTrap/index.js +3 -0
  25. package/lib/module/charts/line/HoverTrap/index.js.map +1 -0
  26. package/lib/module/charts/line/HoverTrap/index.web.js +101 -0
  27. package/lib/module/charts/line/HoverTrap/index.web.js.map +1 -0
  28. package/lib/module/charts/line/index.js +3 -1
  29. package/lib/module/charts/line/index.js.map +1 -1
  30. package/lib/module/components/AnimatedText.js +2 -5
  31. package/lib/module/components/AnimatedText.js.map +1 -1
  32. package/lib/typescript/src/charts/candle/HoverTrap/index.web.d.ts +2 -0
  33. package/lib/typescript/src/charts/line/ChartPath.d.ts +3 -3
  34. package/lib/typescript/src/charts/line/HoverTrap/index.d.ts +2 -0
  35. package/lib/typescript/src/charts/line/HoverTrap/index.web.d.ts +2 -0
  36. package/lib/typescript/src/charts/line/index.d.ts +2 -0
  37. package/package.json +5 -5
  38. package/src/charts/candle/HoverTrap/index.web.tsx +110 -0
  39. package/src/charts/line/ChartPath.tsx +19 -14
  40. package/src/charts/line/HoverTrap/index.tsx +3 -0
  41. package/src/charts/line/HoverTrap/index.web.tsx +110 -0
  42. package/src/charts/line/index.ts +2 -0
  43. package/src/components/AnimatedText.tsx +2 -5
  44. package/tsconfig.json +1 -1
  45. package/yarn.lock +1840 -796
  46. 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
@@ -15,23 +15,21 @@
15
15
  "dependencies": {
16
16
  "bumbag": "^2.2.1",
17
17
  "bumbag-native": "^2.3.0",
18
- "expo": "42.0.1",
19
- "expo-haptics": "^10.1.0",
20
- "expo-splash-screen": "~0.11.2",
21
- "react": "16.13.1",
22
- "react-dom": "16.13.1",
23
- "react-native": "0.63.4",
24
- "react-native-gesture-handler": "~1.10.2",
25
- "react-native-reanimated": "2.2.2",
26
- "react-native-unimodules": "~0.14.5",
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": "~7.9.0",
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": "8.3.0",
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"
@@ -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
- <BumbagNativeProvider>
19
- <Box.Safe flex="1">
20
- <Level
21
- verticalBelow=""
22
- paddingX="major-2"
23
- paddingY="major-2"
24
- alignY="center"
25
- >
26
- <Heading.H5 key={'heading'}>React Native WAGMI Charts 💸</Heading.H5>
27
- {selected ? (
28
- <Button size="small" onPress={() => setSelected('')}>
29
- Back
30
- </Button>
31
- ) : null}
32
- </Level>
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
- <Box marginTop="major-2">
48
- {selected === 'candlestick' && <CandlestickChart />}
49
- {selected === 'line' && <LineChart />}
50
- </Box>
51
- </Box.Scroll>
52
- </Box.Safe>
53
- </BumbagNativeProvider>
55
+ </Box.Scroll>
56
+ </Box.Safe>
57
+ </BumbagNativeProvider>
58
+ </GestureHandlerRootView>
54
59
  );
55
60
  }
@@ -64,7 +64,8 @@ export default function App() {
64
64
  onActivated={invokeHaptic}
65
65
  onEnded={invokeHaptic}
66
66
  >
67
- <LineChart.Tooltip />
67
+ <LineChart.Tooltip position="top" />
68
+ <LineChart.HoverTrap />
68
69
  </LineChart.CursorCrosshair>
69
70
  </LineChart>
70
71
  );