react-native-wagmi-charts 1.2.0 → 1.2.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.
Files changed (36) hide show
  1. package/lib/commonjs/charts/candle/CrosshairTooltip.js +12 -8
  2. package/lib/commonjs/charts/candle/CrosshairTooltip.js.map +1 -1
  3. package/lib/commonjs/charts/candle/DatetimeText.js +7 -8
  4. package/lib/commonjs/charts/candle/DatetimeText.js.map +1 -1
  5. package/lib/commonjs/charts/candle/PriceText.js +7 -8
  6. package/lib/commonjs/charts/candle/PriceText.js.map +1 -1
  7. package/lib/commonjs/charts/line/DatetimeText.js +7 -8
  8. package/lib/commonjs/charts/line/DatetimeText.js.map +1 -1
  9. package/lib/commonjs/charts/line/PriceText.js +7 -8
  10. package/lib/commonjs/charts/line/PriceText.js.map +1 -1
  11. package/lib/commonjs/components/AnimatedText.js +63 -0
  12. package/lib/commonjs/components/AnimatedText.js.map +1 -0
  13. package/lib/module/charts/candle/CrosshairTooltip.js +10 -8
  14. package/lib/module/charts/candle/CrosshairTooltip.js.map +1 -1
  15. package/lib/module/charts/candle/DatetimeText.js +6 -7
  16. package/lib/module/charts/candle/DatetimeText.js.map +1 -1
  17. package/lib/module/charts/candle/PriceText.js +6 -7
  18. package/lib/module/charts/candle/PriceText.js.map +1 -1
  19. package/lib/module/charts/line/DatetimeText.js +6 -7
  20. package/lib/module/charts/line/DatetimeText.js.map +1 -1
  21. package/lib/module/charts/line/PriceText.js +6 -7
  22. package/lib/module/charts/line/PriceText.js.map +1 -1
  23. package/lib/module/components/AnimatedText.js +43 -0
  24. package/lib/module/components/AnimatedText.js.map +1 -0
  25. package/lib/typescript/src/charts/candle/DatetimeText.d.ts +1 -1
  26. package/lib/typescript/src/charts/candle/PriceText.d.ts +1 -1
  27. package/lib/typescript/src/charts/line/DatetimeText.d.ts +1 -1
  28. package/lib/typescript/src/charts/line/PriceText.d.ts +1 -1
  29. package/lib/typescript/src/components/AnimatedText.d.ts +9 -0
  30. package/package.json +1 -1
  31. package/src/charts/candle/CrosshairTooltip.tsx +11 -4
  32. package/src/charts/candle/DatetimeText.tsx +3 -3
  33. package/src/charts/candle/PriceText.tsx +3 -3
  34. package/src/charts/line/DatetimeText.tsx +3 -3
  35. package/src/charts/line/PriceText.tsx +3 -3
  36. package/src/components/AnimatedText.tsx +53 -0
@@ -8,6 +8,8 @@ exports.CandlestickChartCrosshairTooltipContext = void 0;
8
8
 
9
9
  var React = _interopRequireWildcard(require("react"));
10
10
 
11
+ var _reactNative = require("react-native");
12
+
11
13
  var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
12
14
 
13
15
  var _Chart = require("./Chart");
@@ -33,8 +35,8 @@ function CandlestickChartCrosshairTooltip({
33
35
  children,
34
36
  xGutter = 8,
35
37
  yGutter = 8,
36
- tooltipTextProps = {},
37
- textStyle = {},
38
+ tooltipTextProps,
39
+ textStyle,
38
40
  ...props
39
41
  }) {
40
42
  const {
@@ -85,15 +87,17 @@ function CandlestickChartCrosshairTooltip({
85
87
  }, props, {
86
88
  style: [tooltip, leftTooltip, props.style]
87
89
  }), children || /*#__PURE__*/React.createElement(_PriceText.CandlestickChartPriceText, _extends({}, tooltipTextProps, {
88
- style: [{
89
- fontSize: 14
90
- }, tooltipTextProps.style, textStyle]
90
+ style: [styles.text, tooltipTextProps === null || tooltipTextProps === void 0 ? void 0 : tooltipTextProps.style, textStyle]
91
91
  }))), /*#__PURE__*/React.createElement(_reactNativeReanimated.default.View, _extends({}, props, {
92
92
  style: [tooltip, rightTooltip, props.style]
93
93
  }), children || /*#__PURE__*/React.createElement(_PriceText.CandlestickChartPriceText, _extends({}, tooltipTextProps, {
94
- style: [{
95
- fontSize: 14
96
- }, tooltipTextProps.style, textStyle]
94
+ style: [styles.text, tooltipTextProps === null || tooltipTextProps === void 0 ? void 0 : tooltipTextProps.style, textStyle]
97
95
  }))));
98
96
  }
97
+
98
+ const styles = _reactNative.StyleSheet.create({
99
+ text: {
100
+ fontSize: 14
101
+ }
102
+ });
99
103
  //# sourceMappingURL=CrosshairTooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["CrosshairTooltip.tsx"],"names":["CandlestickChartCrosshairTooltipContext","React","createContext","position","value","CandlestickChartCrosshairTooltip","children","xGutter","yGutter","tooltipTextProps","textStyle","props","width","height","useContext","CandlestickChartDimensionsContext","currentY","elementHeight","elementWidth","handleLayout","useCallback","event","nativeEvent","layout","topOffset","offset","tooltip","backgroundColor","display","padding","leftTooltip","left","top","opacity","rightTooltip","style","fontSize"],"mappings":";;;;;;;;AAAA;;AAEA;;AAMA;;AACA;;AACA;;;;;;;;AAiBO,MAAMA,uCAAuC,gBAClDC,KAAK,CAACC,aAAN,CAA6D;AAC3DC,EAAAA,QAAQ,EAAE;AAAEC,IAAAA,KAAK,EAAE;AAAT;AADiD,CAA7D,CADK;;;AAKA,SAASC,gCAAT,CAA0C;AAC/CC,EAAAA,QAD+C;AAE/CC,EAAAA,OAAO,GAAG,CAFqC;AAG/CC,EAAAA,OAAO,GAAG,CAHqC;AAI/CC,EAAAA,gBAAgB,GAAG,EAJ4B;AAK/CC,EAAAA,SAAS,GAAG,EALmC;AAM/C,KAAGC;AAN4C,CAA1C,EAOmC;AACxC,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAoBZ,KAAK,CAACa,UAAN,CAAiBC,wCAAjB,CAA1B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAe,+CAArB;AACA,QAAM;AAAEb,IAAAA;AAAF,MAAeF,KAAK,CAACa,UAAN,CACnBd,uCADmB,CAArB;AAIA,QAAMiB,aAAa,GAAG,2CAAe,CAAf,CAAtB;AACA,QAAMC,YAAY,GAAG,2CAAe,CAAf,CAArB;AAEA,QAAMC,YAAY,GAAGlB,KAAK,CAACmB,WAAN,CAClBC,KAAD,IAAW;AACTJ,IAAAA,aAAa,CAACb,KAAd,GAAsBiB,KAAK,CAACC,WAAN,CAAkBC,MAAlB,CAA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Y,GAAG,6CAAiB,OAAO;AAC3CH,IAAAA,IAAI,EAAEnB,KAAK,GAAGM,YAAY,CAACd,KAArB,GAA6BG,OADQ;AAE3CyB,IAAAA,GAAG,EAAE,EAAEf,aAAa,CAACb,KAAd,GAAsB,CAAxB,IAA6BoB,SAAS,CAACpB,KAFD;AAG3C6B,IAAAA,OAAO,EAAE9B,QAAQ,CAACC,KAAT,KAAmB,OAAnB,GAA6B,CAA7B,GAAiC;AAHC,GAAP,CAAjB,CAArB;AAMA,sBACE,uDACE,oBAAC,8BAAD,CAAU,IAAV;AACE,IAAA,QAAQ,EAAEe;AADZ,KAEMR,KAFN;AAGE,IAAA,KAAK,EAAE,CAACe,OAAD,EAAUI,WAAV,EAAuBnB,KAAK,CAACwB,KAA7B;AAHT,MAKG7B,QAAQ,iBACP,oBAAC,oCAAD,eACMG,gBADN;AAEE,IAAA,KAAK,EAAE,CAAC;AAAE2B,MAAAA,QAAQ,EAAE;AAAZ,KAAD,EAAmB3B,gBAAgB,CAAC0B,KAApC,EAA2CzB,SAA3C;AAFT,KANJ,CADF,eAaE,oBAAC,8BAAD,CAAU,IAAV,eAAmBC,KAAnB;AAA0B,IAAA,KAAK,EAAE,CAACe,OAAD,EAAUQ,YAAV,EAAwBvB,KAAK,CAACwB,KAA9B;AAAjC,MACG7B,QAAQ,iBACP,oBAAC,oCAAD,eACMG,gBADN;AAEE,IAAA,KAAK,EAAE,CAAC;AAAE2B,MAAAA,QAAQ,EAAE;AAAZ,KAAD,EAAmB3B,gBAAgB,CAAC0B,KAApC,EAA2CzB,SAA3C;AAFT,KAFJ,CAbF,CADF;AAwBD","sourcesContent":["import * as React from 'react';\nimport type { StyleProp, TextStyle, ViewProps } from 'react-native';\nimport Animated, {\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n} from 'react-native-reanimated';\n\nimport { CandlestickChartDimensionsContext } from './Chart';\nimport { useCandlestickChart } from './useCandlestickChart';\nimport {\n CandlestickChartPriceText,\n CandlestickChartPriceTextProps,\n} from './PriceText';\n\nexport type CandlestickChartCrosshairTooltipProps = ViewProps & {\n children?: React.ReactNode;\n xGutter?: number;\n yGutter?: number;\n tooltipTextProps?: CandlestickChartPriceTextProps;\n textStyle?: Animated.AnimateStyle<StyleProp<TextStyle>>;\n};\n\nexport type CandlestickChartCrosshairTooltipContext = {\n position: Animated.SharedValue<'left' | 'right'>;\n};\n\nexport const CandlestickChartCrosshairTooltipContext =\n React.createContext<CandlestickChartCrosshairTooltipContext>({\n position: { value: 'left' },\n });\n\nexport function CandlestickChartCrosshairTooltip({\n children,\n xGutter = 8,\n yGutter = 8,\n tooltipTextProps = {},\n textStyle = {},\n ...props\n}: CandlestickChartCrosshairTooltipProps) {\n const { width, height } = React.useContext(CandlestickChartDimensionsContext);\n const { currentY } = useCandlestickChart();\n const { position } = React.useContext(\n CandlestickChartCrosshairTooltipContext\n );\n\n const elementHeight = useSharedValue(0);\n const elementWidth = useSharedValue(0);\n\n const handleLayout = React.useCallback(\n (event) => {\n elementHeight.value = event.nativeEvent.layout.height;\n elementWidth.value = event.nativeEvent.layout.width;\n },\n [elementHeight, elementWidth]\n );\n\n const topOffset = useDerivedValue(() => {\n let offset = 0;\n if (currentY.value < elementHeight.value / 2 + yGutter) {\n offset = currentY.value - (elementHeight.value / 2 + yGutter);\n } else if (currentY.value + elementHeight.value / 2 > height - yGutter) {\n offset = currentY.value + elementHeight.value / 2 - height + yGutter;\n }\n\n return offset;\n });\n\n const tooltip = useAnimatedStyle(() => ({\n backgroundColor: 'white',\n position: 'absolute',\n display: 'flex',\n padding: 4,\n }));\n const leftTooltip = useAnimatedStyle(() => ({\n left: xGutter,\n top: -(elementHeight.value / 2) - topOffset.value,\n opacity: position.value === 'left' ? 1 : 0,\n }));\n const rightTooltip = useAnimatedStyle(() => ({\n left: width - elementWidth.value - xGutter,\n top: -(elementHeight.value / 2) - topOffset.value,\n opacity: position.value === 'right' ? 1 : 0,\n }));\n\n return (\n <>\n <Animated.View\n onLayout={handleLayout}\n {...props}\n style={[tooltip, leftTooltip, props.style]}\n >\n {children || (\n <CandlestickChartPriceText\n {...tooltipTextProps}\n style={[{ fontSize: 14 }, tooltipTextProps.style, textStyle]}\n />\n )}\n </Animated.View>\n <Animated.View {...props} style={[tooltip, rightTooltip, props.style]}>\n {children || (\n <CandlestickChartPriceText\n {...tooltipTextProps}\n style={[{ fontSize: 14 }, tooltipTextProps.style, textStyle]}\n />\n )}\n </Animated.View>\n </>\n );\n}\n"]}
1
+ {"version":3,"sources":["CrosshairTooltip.tsx"],"names":["CandlestickChartCrosshairTooltipContext","React","createContext","position","value","CandlestickChartCrosshairTooltip","children","xGutter","yGutter","tooltipTextProps","textStyle","props","width","height","useContext","CandlestickChartDimensionsContext","currentY","elementHeight","elementWidth","handleLayout","useCallback","event","nativeEvent","layout","topOffset","offset","tooltip","backgroundColor","display","padding","leftTooltip","left","top","opacity","rightTooltip","style","styles","text","StyleSheet","create","fontSize"],"mappings":";;;;;;;;AAAA;;AAEA;;AACA;;AAMA;;AACA;;AACA;;;;;;;;AAiBO,MAAMA,uCAAuC,gBAClDC,KAAK,CAACC,aAAN,CAA6D;AAC3DC,EAAAA,QAAQ,EAAE;AAAEC,IAAAA,KAAK,EAAE;AAAT;AADiD,CAA7D,CADK;;;AAKA,SAASC,gCAAT,CAA0C;AAC/CC,EAAAA,QAD+C;AAE/CC,EAAAA,OAAO,GAAG,CAFqC;AAG/CC,EAAAA,OAAO,GAAG,CAHqC;AAI/CC,EAAAA,gBAJ+C;AAK/CC,EAAAA,SAL+C;AAM/C,KAAGC;AAN4C,CAA1C,EAOmC;AACxC,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAoBZ,KAAK,CAACa,UAAN,CAAiBC,wCAAjB,CAA1B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAe,+CAArB;AACA,QAAM;AAAEb,IAAAA;AAAF,MAAeF,KAAK,CAACa,UAAN,CACnBd,uCADmB,CAArB;AAIA,QAAMiB,aAAa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AAwBD;;AAED,MAAM0B,MAAM,GAAGE,wBAAWC,MAAX,CAAkB;AAC/BF,EAAAA,IAAI,EAAE;AACJG,IAAAA,QAAQ,EAAE;AADN;AADyB,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\nimport type { StyleProp, TextStyle, ViewProps } from 'react-native';\nimport { StyleSheet } from 'react-native';\nimport Animated, {\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n} from 'react-native-reanimated';\n\nimport { CandlestickChartDimensionsContext } from './Chart';\nimport { useCandlestickChart } from './useCandlestickChart';\nimport {\n CandlestickChartPriceText,\n CandlestickChartPriceTextProps,\n} from './PriceText';\n\nexport type CandlestickChartCrosshairTooltipProps = ViewProps & {\n children?: React.ReactNode;\n xGutter?: number;\n yGutter?: number;\n tooltipTextProps?: CandlestickChartPriceTextProps;\n textStyle?: Animated.AnimateStyle<StyleProp<TextStyle>>;\n};\n\nexport type CandlestickChartCrosshairTooltipContext = {\n position: Animated.SharedValue<'left' | 'right'>;\n};\n\nexport const CandlestickChartCrosshairTooltipContext =\n React.createContext<CandlestickChartCrosshairTooltipContext>({\n position: { value: 'left' },\n });\n\nexport function CandlestickChartCrosshairTooltip({\n children,\n xGutter = 8,\n yGutter = 8,\n tooltipTextProps,\n textStyle,\n ...props\n}: CandlestickChartCrosshairTooltipProps) {\n const { width, height } = React.useContext(CandlestickChartDimensionsContext);\n const { currentY } = useCandlestickChart();\n const { position } = React.useContext(\n CandlestickChartCrosshairTooltipContext\n );\n\n const elementHeight = useSharedValue(0);\n const elementWidth = useSharedValue(0);\n\n const handleLayout = React.useCallback(\n (event) => {\n elementHeight.value = event.nativeEvent.layout.height;\n elementWidth.value = event.nativeEvent.layout.width;\n },\n [elementHeight, elementWidth]\n );\n\n const topOffset = useDerivedValue(() => {\n let offset = 0;\n if (currentY.value < elementHeight.value / 2 + yGutter) {\n offset = currentY.value - (elementHeight.value / 2 + yGutter);\n } else if (currentY.value + elementHeight.value / 2 > height - yGutter) {\n offset = currentY.value + elementHeight.value / 2 - height + yGutter;\n }\n\n return offset;\n });\n\n const tooltip = useAnimatedStyle(() => ({\n backgroundColor: 'white',\n position: 'absolute',\n display: 'flex',\n padding: 4,\n }));\n const leftTooltip = useAnimatedStyle(() => ({\n left: xGutter,\n top: -(elementHeight.value / 2) - topOffset.value,\n opacity: position.value === 'left' ? 1 : 0,\n }));\n const rightTooltip = useAnimatedStyle(() => ({\n left: width - elementWidth.value - xGutter,\n top: -(elementHeight.value / 2) - topOffset.value,\n opacity: position.value === 'right' ? 1 : 0,\n }));\n\n return (\n <>\n <Animated.View\n onLayout={handleLayout}\n {...props}\n style={[tooltip, leftTooltip, props.style]}\n >\n {children || (\n <CandlestickChartPriceText\n {...tooltipTextProps}\n style={[styles.text, tooltipTextProps?.style, textStyle]}\n />\n )}\n </Animated.View>\n <Animated.View {...props} style={[tooltip, rightTooltip, props.style]}>\n {children || (\n <CandlestickChartPriceText\n {...tooltipTextProps}\n style={[styles.text, tooltipTextProps?.style, textStyle]}\n />\n )}\n </Animated.View>\n </>\n );\n}\n\nconst styles = StyleSheet.create({\n text: {\n fontSize: 14,\n },\n});\n"]}
@@ -7,30 +7,29 @@ exports.CandlestickChartDatetimeText = CandlestickChartDatetimeText;
7
7
 
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
 
10
- var _reactNativeRedash = require("react-native-redash");
11
-
12
10
  var _useDatetime = require("./useDatetime");
13
11
 
12
+ var _AnimatedText = require("../../components/AnimatedText");
13
+
14
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
15
 
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
 
18
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
-
20
18
  function CandlestickChartDatetimeText({
21
19
  locale,
22
20
  options,
23
21
  format,
24
22
  variant = 'formatted',
25
- ...props
23
+ style
26
24
  }) {
27
25
  const datetime = (0, _useDatetime.useCandlestickChartDatetime)({
28
26
  format,
29
27
  locale,
30
28
  options
31
29
  });
32
- return /*#__PURE__*/React.createElement(_reactNativeRedash.ReText, _extends({
33
- text: datetime[variant]
34
- }, props));
30
+ return /*#__PURE__*/React.createElement(_AnimatedText.AnimatedText, {
31
+ text: datetime[variant],
32
+ style: style
33
+ });
35
34
  }
36
35
  //# sourceMappingURL=DatetimeText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["DatetimeText.tsx"],"names":["CandlestickChartDatetimeText","locale","options","format","variant","props","datetime"],"mappings":";;;;;;;AAAA;;AACA;;AAIA;;;;;;;;AAWO,SAASA,4BAAT,CAAsC;AAC3CC,EAAAA,MAD2C;AAE3CC,EAAAA,OAF2C;AAG3CC,EAAAA,MAH2C;AAI3CC,EAAAA,OAAO,GAAG,WAJiC;AAK3C,KAAGC;AALwC,CAAtC,EAM4B;AACjC,QAAMC,QAAQ,GAAG,8CAA4B;AAAEH,IAAAA,MAAF;AAAUF,IAAAA,MAAV;AAAkBC,IAAAA;AAAlB,GAA5B,CAAjB;AACA,sBAAO,oBAAC,yBAAD;AAAQ,IAAA,IAAI,EAAEI,QAAQ,CAACF,OAAD;AAAtB,KAAqCC,KAArC,EAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { ReText } from 'react-native-redash';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useCandlestickChartDatetime } from './useDatetime';\nimport type { TFormatterFn } from 'react-native-wagmi-charts';\n\ntype CandlestickChartPriceTextProps = {\n locale?: string;\n options?: { [key: string]: string };\n format?: TFormatterFn<number>;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function CandlestickChartDatetimeText({\n locale,\n options,\n format,\n variant = 'formatted',\n ...props\n}: CandlestickChartPriceTextProps) {\n const datetime = useCandlestickChartDatetime({ format, locale, options });\n return <ReText text={datetime[variant]} {...props} />;\n}\n"]}
1
+ {"version":3,"sources":["DatetimeText.tsx"],"names":["CandlestickChartDatetimeText","locale","options","format","variant","style","datetime"],"mappings":";;;;;;;AAAA;;AAIA;;AAEA;;;;;;AAUO,SAASA,4BAAT,CAAsC;AAC3CC,EAAAA,MAD2C;AAE3CC,EAAAA,OAF2C;AAG3CC,EAAAA,MAH2C;AAI3CC,EAAAA,OAAO,GAAG,WAJiC;AAK3CC,EAAAA;AAL2C,CAAtC,EAM4B;AACjC,QAAMC,QAAQ,GAAG,8CAA4B;AAAEH,IAAAA,MAAF;AAAUF,IAAAA,MAAV;AAAkBC,IAAAA;AAAlB,GAA5B,CAAjB;AACA,sBAAO,oBAAC,0BAAD;AAAc,IAAA,IAAI,EAAEI,QAAQ,CAACF,OAAD,CAA5B;AAAuC,IAAA,KAAK,EAAEC;AAA9C,IAAP;AACD","sourcesContent":["import * as React from 'react';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useCandlestickChartDatetime } from './useDatetime';\nimport type { TFormatterFn } from 'react-native-wagmi-charts';\nimport { AnimatedText } from '../../components/AnimatedText';\n\ntype CandlestickChartPriceTextProps = {\n locale?: string;\n options?: { [key: string]: string };\n format?: TFormatterFn<number>;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function CandlestickChartDatetimeText({\n locale,\n options,\n format,\n variant = 'formatted',\n style,\n}: CandlestickChartPriceTextProps) {\n const datetime = useCandlestickChartDatetime({ format, locale, options });\n return <AnimatedText text={datetime[variant]} style={style} />;\n}\n"]}
@@ -7,30 +7,29 @@ exports.CandlestickChartPriceText = CandlestickChartPriceText;
7
7
 
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
 
10
- var _reactNativeRedash = require("react-native-redash");
11
-
12
10
  var _usePrice = require("./usePrice");
13
11
 
12
+ var _AnimatedText = require("../../components/AnimatedText");
13
+
14
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
15
 
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
 
18
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
-
20
18
  function CandlestickChartPriceText({
21
19
  format,
22
20
  precision = 2,
23
21
  variant = 'formatted',
24
22
  type = 'crosshair',
25
- ...props
23
+ style
26
24
  }) {
27
25
  const price = (0, _usePrice.useCandlestickChartPrice)({
28
26
  format,
29
27
  precision,
30
28
  type
31
29
  });
32
- return /*#__PURE__*/React.createElement(_reactNativeRedash.ReText, _extends({
33
- text: price[variant]
34
- }, props));
30
+ return /*#__PURE__*/React.createElement(_AnimatedText.AnimatedText, {
31
+ text: price[variant],
32
+ style: style
33
+ });
35
34
  }
36
35
  //# sourceMappingURL=PriceText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["PriceText.tsx"],"names":["CandlestickChartPriceText","format","precision","variant","type","props","price"],"mappings":";;;;;;;AAAA;;AACA;;AAKA;;;;;;;;AAUO,SAASA,yBAAT,CAAmC;AACxCC,EAAAA,MADwC;AAExCC,EAAAA,SAAS,GAAG,CAF4B;AAGxCC,EAAAA,OAAO,GAAG,WAH8B;AAIxCC,EAAAA,IAAI,GAAG,WAJiC;AAKxC,KAAGC;AALqC,CAAnC,EAM4B;AACjC,QAAMC,KAAK,GAAG,wCAAyB;AAAEL,IAAAA,MAAF;AAAUC,IAAAA,SAAV;AAAqBE,IAAAA;AAArB,GAAzB,CAAd;AACA,sBAAO,oBAAC,yBAAD;AAAQ,IAAA,IAAI,EAAEE,KAAK,CAACH,OAAD;AAAnB,KAAkCE,KAAlC,EAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { ReText } from 'react-native-redash';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\nimport type { TFormatterFn, TPriceType } from './types';\n\nimport { useCandlestickChartPrice } from './usePrice';\n\nexport type CandlestickChartPriceTextProps = {\n format?: TFormatterFn<string>;\n precision?: number;\n variant?: 'formatted' | 'value';\n type?: TPriceType;\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function CandlestickChartPriceText({\n format,\n precision = 2,\n variant = 'formatted',\n type = 'crosshair',\n ...props\n}: CandlestickChartPriceTextProps) {\n const price = useCandlestickChartPrice({ format, precision, type });\n return <ReText text={price[variant]} {...props} />;\n}\n"]}
1
+ {"version":3,"sources":["PriceText.tsx"],"names":["CandlestickChartPriceText","format","precision","variant","type","style","price"],"mappings":";;;;;;;AAAA;;AAKA;;AACA;;;;;;AAUO,SAASA,yBAAT,CAAmC;AACxCC,EAAAA,MADwC;AAExCC,EAAAA,SAAS,GAAG,CAF4B;AAGxCC,EAAAA,OAAO,GAAG,WAH8B;AAIxCC,EAAAA,IAAI,GAAG,WAJiC;AAKxCC,EAAAA;AALwC,CAAnC,EAM4B;AACjC,QAAMC,KAAK,GAAG,wCAAyB;AAAEL,IAAAA,MAAF;AAAUC,IAAAA,SAAV;AAAqBE,IAAAA;AAArB,GAAzB,CAAd;AACA,sBAAO,oBAAC,0BAAD;AAAc,IAAA,IAAI,EAAEE,KAAK,CAACH,OAAD,CAAzB;AAAoC,IAAA,KAAK,EAAEE;AAA3C,IAAP;AACD","sourcesContent":["import * as React from 'react';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\nimport type { TFormatterFn, TPriceType } from './types';\n\nimport { useCandlestickChartPrice } from './usePrice';\nimport { AnimatedText } from '../../components/AnimatedText';\n\nexport type CandlestickChartPriceTextProps = {\n format?: TFormatterFn<string>;\n precision?: number;\n variant?: 'formatted' | 'value';\n type?: TPriceType;\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function CandlestickChartPriceText({\n format,\n precision = 2,\n variant = 'formatted',\n type = 'crosshair',\n style,\n}: CandlestickChartPriceTextProps) {\n const price = useCandlestickChartPrice({ format, precision, type });\n return <AnimatedText text={price[variant]} style={style} />;\n}\n"]}
@@ -7,30 +7,29 @@ exports.LineChartDatetimeText = LineChartDatetimeText;
7
7
 
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
 
10
- var _reactNativeRedash = require("react-native-redash");
11
-
12
10
  var _useDatetime = require("./useDatetime");
13
11
 
12
+ var _AnimatedText = require("../../components/AnimatedText");
13
+
14
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
15
 
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
 
18
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
-
20
18
  function LineChartDatetimeText({
21
19
  locale,
22
20
  options,
23
21
  format,
24
22
  variant = 'formatted',
25
- ...props
23
+ style
26
24
  }) {
27
25
  const datetime = (0, _useDatetime.useLineChartDatetime)({
28
26
  format,
29
27
  locale,
30
28
  options
31
29
  });
32
- return /*#__PURE__*/React.createElement(_reactNativeRedash.ReText, _extends({
33
- text: datetime[variant]
34
- }, props));
30
+ return /*#__PURE__*/React.createElement(_AnimatedText.AnimatedText, {
31
+ text: datetime[variant],
32
+ style: style
33
+ });
35
34
  }
36
35
  //# sourceMappingURL=DatetimeText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["DatetimeText.tsx"],"names":["LineChartDatetimeText","locale","options","format","variant","props","datetime"],"mappings":";;;;;;;AAAA;;AACA;;AAIA;;;;;;;;AAWO,SAASA,qBAAT,CAA+B;AACpCC,EAAAA,MADoC;AAEpCC,EAAAA,OAFoC;AAGpCC,EAAAA,MAHoC;AAIpCC,EAAAA,OAAO,GAAG,WAJ0B;AAKpC,KAAGC;AALiC,CAA/B,EAMoB;AACzB,QAAMC,QAAQ,GAAG,uCAAqB;AAAEH,IAAAA,MAAF;AAAUF,IAAAA,MAAV;AAAkBC,IAAAA;AAAlB,GAArB,CAAjB;AACA,sBAAO,oBAAC,yBAAD;AAAQ,IAAA,IAAI,EAAEI,QAAQ,CAACF,OAAD;AAAtB,KAAqCC,KAArC,EAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { ReText } from 'react-native-redash';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useLineChartDatetime } from './useDatetime';\nimport type { TFormatterFn } from 'react-native-wagmi-charts';\n\ntype LineChartDatetimeProps = {\n locale?: string;\n options?: Intl.DateTimeFormatOptions;\n format?: TFormatterFn<number>;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function LineChartDatetimeText({\n locale,\n options,\n format,\n variant = 'formatted',\n ...props\n}: LineChartDatetimeProps) {\n const datetime = useLineChartDatetime({ format, locale, options });\n return <ReText text={datetime[variant]} {...props} />;\n}\n"]}
1
+ {"version":3,"sources":["DatetimeText.tsx"],"names":["LineChartDatetimeText","locale","options","format","variant","style","datetime"],"mappings":";;;;;;;AAAA;;AAIA;;AAEA;;;;;;AAUO,SAASA,qBAAT,CAA+B;AACpCC,EAAAA,MADoC;AAEpCC,EAAAA,OAFoC;AAGpCC,EAAAA,MAHoC;AAIpCC,EAAAA,OAAO,GAAG,WAJ0B;AAKpCC,EAAAA;AALoC,CAA/B,EAMoB;AACzB,QAAMC,QAAQ,GAAG,uCAAqB;AAAEH,IAAAA,MAAF;AAAUF,IAAAA,MAAV;AAAkBC,IAAAA;AAAlB,GAArB,CAAjB;AACA,sBAAO,oBAAC,0BAAD;AAAc,IAAA,IAAI,EAAEI,QAAQ,CAACF,OAAD,CAA5B;AAAuC,IAAA,KAAK,EAAEC;AAA9C,IAAP;AACD","sourcesContent":["import * as React from 'react';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useLineChartDatetime } from './useDatetime';\nimport type { TFormatterFn } from 'react-native-wagmi-charts';\nimport { AnimatedText } from '../../components/AnimatedText';\n\ntype LineChartDatetimeProps = {\n locale?: string;\n options?: Intl.DateTimeFormatOptions;\n format?: TFormatterFn<number>;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function LineChartDatetimeText({\n locale,\n options,\n format,\n variant = 'formatted',\n style,\n}: LineChartDatetimeProps) {\n const datetime = useLineChartDatetime({ format, locale, options });\n return <AnimatedText text={datetime[variant]} style={style} />;\n}\n"]}
@@ -7,28 +7,27 @@ exports.LineChartPriceText = LineChartPriceText;
7
7
 
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
 
10
- var _reactNativeRedash = require("react-native-redash");
11
-
12
10
  var _usePrice = require("./usePrice");
13
11
 
12
+ var _AnimatedText = require("../../components/AnimatedText");
13
+
14
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
15
 
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
 
18
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
-
20
18
  function LineChartPriceText({
21
19
  format,
22
20
  precision = 2,
23
21
  variant = 'formatted',
24
- ...props
22
+ style
25
23
  }) {
26
24
  const price = (0, _usePrice.useLineChartPrice)({
27
25
  format,
28
26
  precision
29
27
  });
30
- return /*#__PURE__*/React.createElement(_reactNativeRedash.ReText, _extends({
31
- text: price[variant]
32
- }, props));
28
+ return /*#__PURE__*/React.createElement(_AnimatedText.AnimatedText, {
29
+ text: price[variant],
30
+ style: style
31
+ });
33
32
  }
34
33
  //# sourceMappingURL=PriceText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["PriceText.tsx"],"names":["LineChartPriceText","format","precision","variant","props","price"],"mappings":";;;;;;;AAAA;;AACA;;AAIA;;;;;;;;AAUO,SAASA,kBAAT,CAA4B;AACjCC,EAAAA,MADiC;AAEjCC,EAAAA,SAAS,GAAG,CAFqB;AAGjCC,EAAAA,OAAO,GAAG,WAHuB;AAIjC,KAAGC;AAJ8B,CAA5B,EAKqB;AAC1B,QAAMC,KAAK,GAAG,iCAAkB;AAAEJ,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAlB,CAAd;AACA,sBAAO,oBAAC,yBAAD;AAAQ,IAAA,IAAI,EAAEG,KAAK,CAACF,OAAD;AAAnB,KAAkCC,KAAlC,EAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { ReText } from 'react-native-redash';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useLineChartPrice } from './usePrice';\nimport type { TFormatterFn } from '../candle/types';\n\nexport type LineChartPriceTextProps = {\n format?: TFormatterFn<string>;\n precision?: number;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function LineChartPriceText({\n format,\n precision = 2,\n variant = 'formatted',\n ...props\n}: LineChartPriceTextProps) {\n const price = useLineChartPrice({ format, precision });\n return <ReText text={price[variant]} {...props} />;\n}\n"]}
1
+ {"version":3,"sources":["PriceText.tsx"],"names":["LineChartPriceText","format","precision","variant","style","price"],"mappings":";;;;;;;AAAA;;AAIA;;AAEA;;;;;;AASO,SAASA,kBAAT,CAA4B;AACjCC,EAAAA,MADiC;AAEjCC,EAAAA,SAAS,GAAG,CAFqB;AAGjCC,EAAAA,OAAO,GAAG,WAHuB;AAIjCC,EAAAA;AAJiC,CAA5B,EAKqB;AAC1B,QAAMC,KAAK,GAAG,iCAAkB;AAAEJ,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAlB,CAAd;AACA,sBAAO,oBAAC,0BAAD;AAAc,IAAA,IAAI,EAAEG,KAAK,CAACF,OAAD,CAAzB;AAAoC,IAAA,KAAK,EAAEC;AAA3C,IAAP;AACD","sourcesContent":["import * as React from 'react';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useLineChartPrice } from './usePrice';\nimport type { TFormatterFn } from '../candle/types';\nimport { AnimatedText } from '../../components/AnimatedText';\n\nexport type LineChartPriceTextProps = {\n format?: TFormatterFn<string>;\n precision?: number;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function LineChartPriceText({\n format,\n precision = 2,\n variant = 'formatted',\n style,\n}: LineChartPriceTextProps) {\n const price = useLineChartPrice({ format, precision });\n return <AnimatedText text={price[variant]} style={style} />;\n}\n"]}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AnimatedText = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
13
+
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ // forked from https://github.com/wcandillon/react-native-redash/blob/master/src/ReText.tsx
21
+ _reactNativeReanimated.default.addWhitelistedNativeProps({
22
+ text: true
23
+ });
24
+
25
+ const AnimatedTextInput = _reactNativeReanimated.default.createAnimatedComponent(_reactNative.TextInput);
26
+
27
+ const AnimatedText = ({
28
+ text,
29
+ style
30
+ }) => {
31
+ const inputRef = _react.default.useRef(null);
32
+
33
+ (0, _reactNativeReanimated.useAnimatedReaction)(() => {
34
+ // always return false unless web to prevent unnecessary reactions
35
+ return _reactNative.Platform.OS === 'web' && text.value;
36
+ }, (data, prevData) => {
37
+ if (_reactNative.Platform.OS === 'web' && data !== prevData && inputRef.current) {
38
+ inputRef.current.setNativeProps({
39
+ value: data
40
+ });
41
+ }
42
+ });
43
+ const animatedProps = (0, _reactNativeReanimated.useAnimatedProps)(() => {
44
+ return {
45
+ text: text.value // Here we use any because the text prop is not available in the type
46
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
+
48
+ };
49
+ });
50
+ return /*#__PURE__*/_react.default.createElement(AnimatedTextInput, {
51
+ underlineColorAndroid: "transparent",
52
+ editable: false,
53
+ ref: _reactNative.Platform.select({
54
+ web: inputRef
55
+ }),
56
+ value: text.value,
57
+ style: style,
58
+ animatedProps: animatedProps
59
+ });
60
+ };
61
+
62
+ exports.AnimatedText = AnimatedText;
63
+ //# sourceMappingURL=AnimatedText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["AnimatedText.tsx"],"names":["Animated","addWhitelistedNativeProps","text","AnimatedTextInput","createAnimatedComponent","TextInput","AnimatedText","style","inputRef","React","useRef","Platform","OS","value","data","prevData","current","setNativeProps","animatedProps","select","web"],"mappings":";;;;;;;AAEA;;AACA;;AAEA;;;;;;;;AALA;AAUAA,+BAASC,yBAAT,CAAmC;AAAEC,EAAAA,IAAI,EAAE;AAAR,CAAnC;;AAOA,MAAMC,iBAAiB,GAAGH,+BAASI,uBAAT,CAAiCC,sBAAjC,CAA1B;;AAEO,MAAMC,YAAY,GAAG,CAAC;AAAEJ,EAAAA,IAAF;AAAQK,EAAAA;AAAR,CAAD,KAAwC;AAClE,QAAMC,QAAQ,GAAGC,eAAMC,MAAN,CAAwB,IAAxB,CAAjB;;AAEA,kDACE,MAAM;AACJ;AACA,WAAOC,sBAASC,EAAT,KAAgB,KAAhB,IAAyBV,IAAI,CAACW,KAArC;AACD,GAJH,EAKE,CAACC,IAAD,EAAOC,QAAP,KAAoB;AAClB,QAAIJ,sBAASC,EAAT,KAAgB,KAAhB,IAAyBE,IAAI,KAAKC,QAAlC,IAA8CP,QAAQ,CAACQ,OAA3D,EAAoE;AAClER,MAAAA,QAAQ,CAACQ,OAAT,CAAiBC,cAAjB,CAAgC;AAC9BJ,QAAAA,KAAK,EAAEC;AADuB,OAAhC;AAGD;AACF,GAXH;AAaA,QAAMI,aAAa,GAAG,6CAAiB,MAAM;AAC3C,WAAO;AACLhB,MAAAA,IAAI,EAAEA,IAAI,CAACW,KADN,CAEL;AACA;;AAHK,KAAP;AAKD,GANqB,CAAtB;AAOA,sBACE,6BAAC,iBAAD;AACE,IAAA,qBAAqB,EAAC,aADxB;AAEE,IAAA,QAAQ,EAAE,KAFZ;AAGE,IAAA,GAAG,EAAEF,sBAASQ,MAAT,CAAgB;AAAEC,MAAAA,GAAG,EAAEZ;AAAP,KAAhB,CAHP;AAIE,IAAA,KAAK,EAAEN,IAAI,CAACW,KAJd;AAKE,IAAA,KAAK,EAAEN,KALT;AAME,IAAA,aAAa,EAAEW;AANjB,IADF;AAUD,CAjCM","sourcesContent":["// forked from https://github.com/wcandillon/react-native-redash/blob/master/src/ReText.tsx\n\nimport React from 'react';\nimport { Platform, TextProps as RNTextProps } from 'react-native';\nimport { TextInput } from 'react-native';\nimport Animated, {\n useAnimatedProps,\n useAnimatedReaction,\n} from 'react-native-reanimated';\n\nAnimated.addWhitelistedNativeProps({ text: true });\n\ninterface AnimatedTextProps {\n text: Animated.SharedValue<string>;\n style?: Animated.AnimateProps<RNTextProps>['style'];\n}\n\nconst AnimatedTextInput = Animated.createAnimatedComponent(TextInput);\n\nexport const AnimatedText = ({ text, style }: AnimatedTextProps) => {\n const inputRef = React.useRef<TextInput>(null);\n\n useAnimatedReaction(\n () => {\n // always return false unless web to prevent unnecessary reactions\n return Platform.OS === 'web' && text.value;\n },\n (data, prevData) => {\n if (Platform.OS === 'web' && data !== prevData && inputRef.current) {\n inputRef.current.setNativeProps({\n value: data,\n });\n }\n }\n );\n const animatedProps = useAnimatedProps(() => {\n return {\n text: text.value,\n // Here we use any because the text prop is not available in the type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } as any;\n });\n return (\n <AnimatedTextInput\n underlineColorAndroid=\"transparent\"\n editable={false}\n ref={Platform.select({ web: inputRef })}\n value={text.value}\n style={style}\n animatedProps={animatedProps}\n />\n );\n};\n"]}
@@ -1,6 +1,7 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import * as React from 'react';
4
+ import { StyleSheet } from 'react-native';
4
5
  import Animated, { useAnimatedStyle, useDerivedValue, useSharedValue } from 'react-native-reanimated';
5
6
  import { CandlestickChartDimensionsContext } from './Chart';
6
7
  import { useCandlestickChart } from './useCandlestickChart';
@@ -14,8 +15,8 @@ export function CandlestickChartCrosshairTooltip({
14
15
  children,
15
16
  xGutter = 8,
16
17
  yGutter = 8,
17
- tooltipTextProps = {},
18
- textStyle = {},
18
+ tooltipTextProps,
19
+ textStyle,
19
20
  ...props
20
21
  }) {
21
22
  const {
@@ -66,15 +67,16 @@ export function CandlestickChartCrosshairTooltip({
66
67
  }, props, {
67
68
  style: [tooltip, leftTooltip, props.style]
68
69
  }), children || /*#__PURE__*/React.createElement(CandlestickChartPriceText, _extends({}, tooltipTextProps, {
69
- style: [{
70
- fontSize: 14
71
- }, tooltipTextProps.style, textStyle]
70
+ style: [styles.text, tooltipTextProps === null || tooltipTextProps === void 0 ? void 0 : tooltipTextProps.style, textStyle]
72
71
  }))), /*#__PURE__*/React.createElement(Animated.View, _extends({}, props, {
73
72
  style: [tooltip, rightTooltip, props.style]
74
73
  }), children || /*#__PURE__*/React.createElement(CandlestickChartPriceText, _extends({}, tooltipTextProps, {
75
- style: [{
76
- fontSize: 14
77
- }, tooltipTextProps.style, textStyle]
74
+ style: [styles.text, tooltipTextProps === null || tooltipTextProps === void 0 ? void 0 : tooltipTextProps.style, textStyle]
78
75
  }))));
79
76
  }
77
+ const styles = StyleSheet.create({
78
+ text: {
79
+ fontSize: 14
80
+ }
81
+ });
80
82
  //# sourceMappingURL=CrosshairTooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["CrosshairTooltip.tsx"],"names":["React","Animated","useAnimatedStyle","useDerivedValue","useSharedValue","CandlestickChartDimensionsContext","useCandlestickChart","CandlestickChartPriceText","CandlestickChartCrosshairTooltipContext","createContext","position","value","CandlestickChartCrosshairTooltip","children","xGutter","yGutter","tooltipTextProps","textStyle","props","width","height","useContext","currentY","elementHeight","elementWidth","handleLayout","useCallback","event","nativeEvent","layout","topOffset","offset","tooltip","backgroundColor","display","padding","leftTooltip","left","top","opacity","rightTooltip","style","fontSize"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,OAAOC,QAAP,IACEC,gBADF,EAEEC,eAFF,EAGEC,cAHF,QAIO,yBAJP;AAMA,SAASC,iCAAT,QAAkD,SAAlD;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,SACEC,yBADF,QAGO,aAHP;AAiBA,OAAO,MAAMC,uCAAuC,gBAClDR,KAAK,CAACS,aAAN,CAA6D;AAC3DC,EAAAA,QAAQ,EAAE;AAAEC,IAAAA,KAAK,EAAE;AAAT;AADiD,CAA7D,CADK;AAKP,OAAO,SAASC,gCAAT,CAA0C;AAC/CC,EAAAA,QAD+C;AAE/CC,EAAAA,OAAO,GAAG,CAFqC;AAG/CC,EAAAA,OAAO,GAAG,CAHqC;AAI/CC,EAAAA,gBAAgB,GAAG,EAJ4B;AAK/CC,EAAAA,SAAS,GAAG,EALmC;AAM/C,KAAGC;AAN4C,CAA1C,EAOmC;AACxC,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAoBpB,KAAK,CAACqB,UAAN,CAAiBhB,iCAAjB,CAA1B;AACA,QAAM;AAA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AAC,yBAAD,eACMG,gBADN;AAEE,IAAA,KAAK,EAAE,CAAC;AAAE0B,MAAAA,QAAQ,EAAE;AAAZ,KAAD,EAAmB1B,gBAAgB,CAACyB,KAApC,EAA2CxB,SAA3C;AAFT,KAFJ,CAbF,CADF;AAwBD","sourcesContent":["import * as React from 'react';\nimport type { StyleProp, TextStyle, ViewProps } from 'react-native';\nimport Animated, {\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n} from 'react-native-reanimated';\n\nimport { CandlestickChartDimensionsContext } from './Chart';\nimport { useCandlestickChart } from './useCandlestickChart';\nimport {\n CandlestickChartPriceText,\n CandlestickChartPriceTextProps,\n} from './PriceText';\n\nexport type CandlestickChartCrosshairTooltipProps = ViewProps & {\n children?: React.ReactNode;\n xGutter?: number;\n yGutter?: number;\n tooltipTextProps?: CandlestickChartPriceTextProps;\n textStyle?: Animated.AnimateStyle<StyleProp<TextStyle>>;\n};\n\nexport type CandlestickChartCrosshairTooltipContext = {\n position: Animated.SharedValue<'left' | 'right'>;\n};\n\nexport const CandlestickChartCrosshairTooltipContext =\n React.createContext<CandlestickChartCrosshairTooltipContext>({\n position: { value: 'left' },\n });\n\nexport function CandlestickChartCrosshairTooltip({\n children,\n xGutter = 8,\n yGutter = 8,\n tooltipTextProps = {},\n textStyle = {},\n ...props\n}: CandlestickChartCrosshairTooltipProps) {\n const { width, height } = React.useContext(CandlestickChartDimensionsContext);\n const { currentY } = useCandlestickChart();\n const { position } = React.useContext(\n CandlestickChartCrosshairTooltipContext\n );\n\n const elementHeight = useSharedValue(0);\n const elementWidth = useSharedValue(0);\n\n const handleLayout = React.useCallback(\n (event) => {\n elementHeight.value = event.nativeEvent.layout.height;\n elementWidth.value = event.nativeEvent.layout.width;\n },\n [elementHeight, elementWidth]\n );\n\n const topOffset = useDerivedValue(() => {\n let offset = 0;\n if (currentY.value < elementHeight.value / 2 + yGutter) {\n offset = currentY.value - (elementHeight.value / 2 + yGutter);\n } else if (currentY.value + elementHeight.value / 2 > height - yGutter) {\n offset = currentY.value + elementHeight.value / 2 - height + yGutter;\n }\n\n return offset;\n });\n\n const tooltip = useAnimatedStyle(() => ({\n backgroundColor: 'white',\n position: 'absolute',\n display: 'flex',\n padding: 4,\n }));\n const leftTooltip = useAnimatedStyle(() => ({\n left: xGutter,\n top: -(elementHeight.value / 2) - topOffset.value,\n opacity: position.value === 'left' ? 1 : 0,\n }));\n const rightTooltip = useAnimatedStyle(() => ({\n left: width - elementWidth.value - xGutter,\n top: -(elementHeight.value / 2) - topOffset.value,\n opacity: position.value === 'right' ? 1 : 0,\n }));\n\n return (\n <>\n <Animated.View\n onLayout={handleLayout}\n {...props}\n style={[tooltip, leftTooltip, props.style]}\n >\n {children || (\n <CandlestickChartPriceText\n {...tooltipTextProps}\n style={[{ fontSize: 14 }, tooltipTextProps.style, textStyle]}\n />\n )}\n </Animated.View>\n <Animated.View {...props} style={[tooltip, rightTooltip, props.style]}>\n {children || (\n <CandlestickChartPriceText\n {...tooltipTextProps}\n style={[{ fontSize: 14 }, tooltipTextProps.style, textStyle]}\n />\n )}\n </Animated.View>\n </>\n );\n}\n"]}
1
+ {"version":3,"sources":["CrosshairTooltip.tsx"],"names":["React","StyleSheet","Animated","useAnimatedStyle","useDerivedValue","useSharedValue","CandlestickChartDimensionsContext","useCandlestickChart","CandlestickChartPriceText","CandlestickChartCrosshairTooltipContext","createContext","position","value","CandlestickChartCrosshairTooltip","children","xGutter","yGutter","tooltipTextProps","textStyle","props","width","height","useContext","currentY","elementHeight","elementWidth","handleLayout","useCallback","event","nativeEvent","layout","topOffset","offset","tooltip","backgroundColor","display","padding","leftTooltip","left","top","opacity","rightTooltip","style","styles","text","create","fontSize"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,SAASC,UAAT,QAA2B,cAA3B;AACA,OAAOC,QAAP,IACEC,gBADF,EAEEC,eAFF,EAGEC,cAHF,QAIO,yBAJP;AAMA,SAASC,iCAAT,QAAkD,SAAlD;A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P,CAAD,CAArC;AAMA,sBACE,uDACE,oBAAC,QAAD,CAAU,IAAV;AACE,IAAA,QAAQ,EAAEc;AADZ,KAEMP,KAFN;AAGE,IAAA,KAAK,EAAE,CAACc,OAAD,EAAUI,WAAV,EAAuBlB,KAAK,CAACuB,KAA7B;AAHT,MAKG5B,QAAQ,iBACP,oBAAC,yBAAD,eACMG,gBADN;AAEE,IAAA,KAAK,EAAE,CAAC0B,MAAM,CAACC,IAAR,EAAc3B,gBAAd,aAAcA,gBAAd,uBAAcA,gBAAgB,CAAEyB,KAAhC,EAAuCxB,SAAvC;AAFT,KANJ,CADF,eAaE,oBAAC,QAAD,CAAU,IAAV,eAAmBC,KAAnB;AAA0B,IAAA,KAAK,EAAE,CAACc,OAAD,EAAUQ,YAAV,EAAwBtB,KAAK,CAACuB,KAA9B;AAAjC,MACG5B,QAAQ,iBACP,oBAAC,yBAAD,eACMG,gBADN;AAEE,IAAA,KAAK,EAAE,CAAC0B,MAAM,CAACC,IAAR,EAAc3B,gBAAd,aAAcA,gBAAd,uBAAcA,gBAAgB,CAAEyB,KAAhC,EAAuCxB,SAAvC;AAFT,KAFJ,CAbF,CADF;AAwBD;AAED,MAAMyB,MAAM,GAAG1C,UAAU,CAAC4C,MAAX,CAAkB;AAC/BD,EAAAA,IAAI,EAAE;AACJE,IAAAA,QAAQ,EAAE;AADN;AADyB,CAAlB,CAAf","sourcesContent":["import * as React from 'react';\nimport type { StyleProp, TextStyle, ViewProps } from 'react-native';\nimport { StyleSheet } from 'react-native';\nimport Animated, {\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n} from 'react-native-reanimated';\n\nimport { CandlestickChartDimensionsContext } from './Chart';\nimport { useCandlestickChart } from './useCandlestickChart';\nimport {\n CandlestickChartPriceText,\n CandlestickChartPriceTextProps,\n} from './PriceText';\n\nexport type CandlestickChartCrosshairTooltipProps = ViewProps & {\n children?: React.ReactNode;\n xGutter?: number;\n yGutter?: number;\n tooltipTextProps?: CandlestickChartPriceTextProps;\n textStyle?: Animated.AnimateStyle<StyleProp<TextStyle>>;\n};\n\nexport type CandlestickChartCrosshairTooltipContext = {\n position: Animated.SharedValue<'left' | 'right'>;\n};\n\nexport const CandlestickChartCrosshairTooltipContext =\n React.createContext<CandlestickChartCrosshairTooltipContext>({\n position: { value: 'left' },\n });\n\nexport function CandlestickChartCrosshairTooltip({\n children,\n xGutter = 8,\n yGutter = 8,\n tooltipTextProps,\n textStyle,\n ...props\n}: CandlestickChartCrosshairTooltipProps) {\n const { width, height } = React.useContext(CandlestickChartDimensionsContext);\n const { currentY } = useCandlestickChart();\n const { position } = React.useContext(\n CandlestickChartCrosshairTooltipContext\n );\n\n const elementHeight = useSharedValue(0);\n const elementWidth = useSharedValue(0);\n\n const handleLayout = React.useCallback(\n (event) => {\n elementHeight.value = event.nativeEvent.layout.height;\n elementWidth.value = event.nativeEvent.layout.width;\n },\n [elementHeight, elementWidth]\n );\n\n const topOffset = useDerivedValue(() => {\n let offset = 0;\n if (currentY.value < elementHeight.value / 2 + yGutter) {\n offset = currentY.value - (elementHeight.value / 2 + yGutter);\n } else if (currentY.value + elementHeight.value / 2 > height - yGutter) {\n offset = currentY.value + elementHeight.value / 2 - height + yGutter;\n }\n\n return offset;\n });\n\n const tooltip = useAnimatedStyle(() => ({\n backgroundColor: 'white',\n position: 'absolute',\n display: 'flex',\n padding: 4,\n }));\n const leftTooltip = useAnimatedStyle(() => ({\n left: xGutter,\n top: -(elementHeight.value / 2) - topOffset.value,\n opacity: position.value === 'left' ? 1 : 0,\n }));\n const rightTooltip = useAnimatedStyle(() => ({\n left: width - elementWidth.value - xGutter,\n top: -(elementHeight.value / 2) - topOffset.value,\n opacity: position.value === 'right' ? 1 : 0,\n }));\n\n return (\n <>\n <Animated.View\n onLayout={handleLayout}\n {...props}\n style={[tooltip, leftTooltip, props.style]}\n >\n {children || (\n <CandlestickChartPriceText\n {...tooltipTextProps}\n style={[styles.text, tooltipTextProps?.style, textStyle]}\n />\n )}\n </Animated.View>\n <Animated.View {...props} style={[tooltip, rightTooltip, props.style]}>\n {children || (\n <CandlestickChartPriceText\n {...tooltipTextProps}\n style={[styles.text, tooltipTextProps?.style, textStyle]}\n />\n )}\n </Animated.View>\n </>\n );\n}\n\nconst styles = StyleSheet.create({\n text: {\n fontSize: 14,\n },\n});\n"]}
@@ -1,22 +1,21 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  import * as React from 'react';
4
- import { ReText } from 'react-native-redash';
5
2
  import { useCandlestickChartDatetime } from './useDatetime';
3
+ import { AnimatedText } from '../../components/AnimatedText';
6
4
  export function CandlestickChartDatetimeText({
7
5
  locale,
8
6
  options,
9
7
  format,
10
8
  variant = 'formatted',
11
- ...props
9
+ style
12
10
  }) {
13
11
  const datetime = useCandlestickChartDatetime({
14
12
  format,
15
13
  locale,
16
14
  options
17
15
  });
18
- return /*#__PURE__*/React.createElement(ReText, _extends({
19
- text: datetime[variant]
20
- }, props));
16
+ return /*#__PURE__*/React.createElement(AnimatedText, {
17
+ text: datetime[variant],
18
+ style: style
19
+ });
21
20
  }
22
21
  //# sourceMappingURL=DatetimeText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["DatetimeText.tsx"],"names":["React","ReText","useCandlestickChartDatetime","CandlestickChartDatetimeText","locale","options","format","variant","props","datetime"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAIA,SAASC,2BAAT,QAA4C,eAA5C;AAWA,OAAO,SAASC,4BAAT,CAAsC;AAC3CC,EAAAA,MAD2C;AAE3CC,EAAAA,OAF2C;AAG3CC,EAAAA,MAH2C;AAI3CC,EAAAA,OAAO,GAAG,WAJiC;AAK3C,KAAGC;AALwC,CAAtC,EAM4B;AACjC,QAAMC,QAAQ,GAAGP,2BAA2B,CAAC;AAAEI,IAAAA,MAAF;AAAUF,IAAAA,MAAV;AAAkBC,IAAAA;AAAlB,GAAD,CAA5C;AACA,sBAAO,oBAAC,MAAD;AAAQ,IAAA,IAAI,EAAEI,QAAQ,CAACF,OAAD;AAAtB,KAAqCC,KAArC,EAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { ReText } from 'react-native-redash';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useCandlestickChartDatetime } from './useDatetime';\nimport type { TFormatterFn } from 'react-native-wagmi-charts';\n\ntype CandlestickChartPriceTextProps = {\n locale?: string;\n options?: { [key: string]: string };\n format?: TFormatterFn<number>;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function CandlestickChartDatetimeText({\n locale,\n options,\n format,\n variant = 'formatted',\n ...props\n}: CandlestickChartPriceTextProps) {\n const datetime = useCandlestickChartDatetime({ format, locale, options });\n return <ReText text={datetime[variant]} {...props} />;\n}\n"]}
1
+ {"version":3,"sources":["DatetimeText.tsx"],"names":["React","useCandlestickChartDatetime","AnimatedText","CandlestickChartDatetimeText","locale","options","format","variant","style","datetime"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAIA,SAASC,2BAAT,QAA4C,eAA5C;AAEA,SAASC,YAAT,QAA6B,+BAA7B;AAUA,OAAO,SAASC,4BAAT,CAAsC;AAC3CC,EAAAA,MAD2C;AAE3CC,EAAAA,OAF2C;AAG3CC,EAAAA,MAH2C;AAI3CC,EAAAA,OAAO,GAAG,WAJiC;AAK3CC,EAAAA;AAL2C,CAAtC,EAM4B;AACjC,QAAMC,QAAQ,GAAGR,2BAA2B,CAAC;AAAEK,IAAAA,MAAF;AAAUF,IAAAA,MAAV;AAAkBC,IAAAA;AAAlB,GAAD,CAA5C;AACA,sBAAO,oBAAC,YAAD;AAAc,IAAA,IAAI,EAAEI,QAAQ,CAACF,OAAD,CAA5B;AAAuC,IAAA,KAAK,EAAEC;AAA9C,IAAP;AACD","sourcesContent":["import * as React from 'react';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useCandlestickChartDatetime } from './useDatetime';\nimport type { TFormatterFn } from 'react-native-wagmi-charts';\nimport { AnimatedText } from '../../components/AnimatedText';\n\ntype CandlestickChartPriceTextProps = {\n locale?: string;\n options?: { [key: string]: string };\n format?: TFormatterFn<number>;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function CandlestickChartDatetimeText({\n locale,\n options,\n format,\n variant = 'formatted',\n style,\n}: CandlestickChartPriceTextProps) {\n const datetime = useCandlestickChartDatetime({ format, locale, options });\n return <AnimatedText text={datetime[variant]} style={style} />;\n}\n"]}
@@ -1,22 +1,21 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  import * as React from 'react';
4
- import { ReText } from 'react-native-redash';
5
2
  import { useCandlestickChartPrice } from './usePrice';
3
+ import { AnimatedText } from '../../components/AnimatedText';
6
4
  export function CandlestickChartPriceText({
7
5
  format,
8
6
  precision = 2,
9
7
  variant = 'formatted',
10
8
  type = 'crosshair',
11
- ...props
9
+ style
12
10
  }) {
13
11
  const price = useCandlestickChartPrice({
14
12
  format,
15
13
  precision,
16
14
  type
17
15
  });
18
- return /*#__PURE__*/React.createElement(ReText, _extends({
19
- text: price[variant]
20
- }, props));
16
+ return /*#__PURE__*/React.createElement(AnimatedText, {
17
+ text: price[variant],
18
+ style: style
19
+ });
21
20
  }
22
21
  //# sourceMappingURL=PriceText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["PriceText.tsx"],"names":["React","ReText","useCandlestickChartPrice","CandlestickChartPriceText","format","precision","variant","type","props","price"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAKA,SAASC,wBAAT,QAAyC,YAAzC;AAUA,OAAO,SAASC,yBAAT,CAAmC;AACxCC,EAAAA,MADwC;AAExCC,EAAAA,SAAS,GAAG,CAF4B;AAGxCC,EAAAA,OAAO,GAAG,WAH8B;AAIxCC,EAAAA,IAAI,GAAG,WAJiC;AAKxC,KAAGC;AALqC,CAAnC,EAM4B;AACjC,QAAMC,KAAK,GAAGP,wBAAwB,CAAC;AAAEE,IAAAA,MAAF;AAAUC,IAAAA,SAAV;AAAqBE,IAAAA;AAArB,GAAD,CAAtC;AACA,sBAAO,oBAAC,MAAD;AAAQ,IAAA,IAAI,EAAEE,KAAK,CAACH,OAAD;AAAnB,KAAkCE,KAAlC,EAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { ReText } from 'react-native-redash';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\nimport type { TFormatterFn, TPriceType } from './types';\n\nimport { useCandlestickChartPrice } from './usePrice';\n\nexport type CandlestickChartPriceTextProps = {\n format?: TFormatterFn<string>;\n precision?: number;\n variant?: 'formatted' | 'value';\n type?: TPriceType;\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function CandlestickChartPriceText({\n format,\n precision = 2,\n variant = 'formatted',\n type = 'crosshair',\n ...props\n}: CandlestickChartPriceTextProps) {\n const price = useCandlestickChartPrice({ format, precision, type });\n return <ReText text={price[variant]} {...props} />;\n}\n"]}
1
+ {"version":3,"sources":["PriceText.tsx"],"names":["React","useCandlestickChartPrice","AnimatedText","CandlestickChartPriceText","format","precision","variant","type","style","price"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAKA,SAASC,wBAAT,QAAyC,YAAzC;AACA,SAASC,YAAT,QAA6B,+BAA7B;AAUA,OAAO,SAASC,yBAAT,CAAmC;AACxCC,EAAAA,MADwC;AAExCC,EAAAA,SAAS,GAAG,CAF4B;AAGxCC,EAAAA,OAAO,GAAG,WAH8B;AAIxCC,EAAAA,IAAI,GAAG,WAJiC;AAKxCC,EAAAA;AALwC,CAAnC,EAM4B;AACjC,QAAMC,KAAK,GAAGR,wBAAwB,CAAC;AAAEG,IAAAA,MAAF;AAAUC,IAAAA,SAAV;AAAqBE,IAAAA;AAArB,GAAD,CAAtC;AACA,sBAAO,oBAAC,YAAD;AAAc,IAAA,IAAI,EAAEE,KAAK,CAACH,OAAD,CAAzB;AAAoC,IAAA,KAAK,EAAEE;AAA3C,IAAP;AACD","sourcesContent":["import * as React from 'react';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\nimport type { TFormatterFn, TPriceType } from './types';\n\nimport { useCandlestickChartPrice } from './usePrice';\nimport { AnimatedText } from '../../components/AnimatedText';\n\nexport type CandlestickChartPriceTextProps = {\n format?: TFormatterFn<string>;\n precision?: number;\n variant?: 'formatted' | 'value';\n type?: TPriceType;\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function CandlestickChartPriceText({\n format,\n precision = 2,\n variant = 'formatted',\n type = 'crosshair',\n style,\n}: CandlestickChartPriceTextProps) {\n const price = useCandlestickChartPrice({ format, precision, type });\n return <AnimatedText text={price[variant]} style={style} />;\n}\n"]}
@@ -1,22 +1,21 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  import * as React from 'react';
4
- import { ReText } from 'react-native-redash';
5
2
  import { useLineChartDatetime } from './useDatetime';
3
+ import { AnimatedText } from '../../components/AnimatedText';
6
4
  export function LineChartDatetimeText({
7
5
  locale,
8
6
  options,
9
7
  format,
10
8
  variant = 'formatted',
11
- ...props
9
+ style
12
10
  }) {
13
11
  const datetime = useLineChartDatetime({
14
12
  format,
15
13
  locale,
16
14
  options
17
15
  });
18
- return /*#__PURE__*/React.createElement(ReText, _extends({
19
- text: datetime[variant]
20
- }, props));
16
+ return /*#__PURE__*/React.createElement(AnimatedText, {
17
+ text: datetime[variant],
18
+ style: style
19
+ });
21
20
  }
22
21
  //# sourceMappingURL=DatetimeText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["DatetimeText.tsx"],"names":["React","ReText","useLineChartDatetime","LineChartDatetimeText","locale","options","format","variant","props","datetime"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAIA,SAASC,oBAAT,QAAqC,eAArC;AAWA,OAAO,SAASC,qBAAT,CAA+B;AACpCC,EAAAA,MADoC;AAEpCC,EAAAA,OAFoC;AAGpCC,EAAAA,MAHoC;AAIpCC,EAAAA,OAAO,GAAG,WAJ0B;AAKpC,KAAGC;AALiC,CAA/B,EAMoB;AACzB,QAAMC,QAAQ,GAAGP,oBAAoB,CAAC;AAAEI,IAAAA,MAAF;AAAUF,IAAAA,MAAV;AAAkBC,IAAAA;AAAlB,GAAD,CAArC;AACA,sBAAO,oBAAC,MAAD;AAAQ,IAAA,IAAI,EAAEI,QAAQ,CAACF,OAAD;AAAtB,KAAqCC,KAArC,EAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { ReText } from 'react-native-redash';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useLineChartDatetime } from './useDatetime';\nimport type { TFormatterFn } from 'react-native-wagmi-charts';\n\ntype LineChartDatetimeProps = {\n locale?: string;\n options?: Intl.DateTimeFormatOptions;\n format?: TFormatterFn<number>;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function LineChartDatetimeText({\n locale,\n options,\n format,\n variant = 'formatted',\n ...props\n}: LineChartDatetimeProps) {\n const datetime = useLineChartDatetime({ format, locale, options });\n return <ReText text={datetime[variant]} {...props} />;\n}\n"]}
1
+ {"version":3,"sources":["DatetimeText.tsx"],"names":["React","useLineChartDatetime","AnimatedText","LineChartDatetimeText","locale","options","format","variant","style","datetime"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAIA,SAASC,oBAAT,QAAqC,eAArC;AAEA,SAASC,YAAT,QAA6B,+BAA7B;AAUA,OAAO,SAASC,qBAAT,CAA+B;AACpCC,EAAAA,MADoC;AAEpCC,EAAAA,OAFoC;AAGpCC,EAAAA,MAHoC;AAIpCC,EAAAA,OAAO,GAAG,WAJ0B;AAKpCC,EAAAA;AALoC,CAA/B,EAMoB;AACzB,QAAMC,QAAQ,GAAGR,oBAAoB,CAAC;AAAEK,IAAAA,MAAF;AAAUF,IAAAA,MAAV;AAAkBC,IAAAA;AAAlB,GAAD,CAArC;AACA,sBAAO,oBAAC,YAAD;AAAc,IAAA,IAAI,EAAEI,QAAQ,CAACF,OAAD,CAA5B;AAAuC,IAAA,KAAK,EAAEC;AAA9C,IAAP;AACD","sourcesContent":["import * as React from 'react';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useLineChartDatetime } from './useDatetime';\nimport type { TFormatterFn } from 'react-native-wagmi-charts';\nimport { AnimatedText } from '../../components/AnimatedText';\n\ntype LineChartDatetimeProps = {\n locale?: string;\n options?: Intl.DateTimeFormatOptions;\n format?: TFormatterFn<number>;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function LineChartDatetimeText({\n locale,\n options,\n format,\n variant = 'formatted',\n style,\n}: LineChartDatetimeProps) {\n const datetime = useLineChartDatetime({ format, locale, options });\n return <AnimatedText text={datetime[variant]} style={style} />;\n}\n"]}
@@ -1,20 +1,19 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
1
  import * as React from 'react';
4
- import { ReText } from 'react-native-redash';
5
2
  import { useLineChartPrice } from './usePrice';
3
+ import { AnimatedText } from '../../components/AnimatedText';
6
4
  export function LineChartPriceText({
7
5
  format,
8
6
  precision = 2,
9
7
  variant = 'formatted',
10
- ...props
8
+ style
11
9
  }) {
12
10
  const price = useLineChartPrice({
13
11
  format,
14
12
  precision
15
13
  });
16
- return /*#__PURE__*/React.createElement(ReText, _extends({
17
- text: price[variant]
18
- }, props));
14
+ return /*#__PURE__*/React.createElement(AnimatedText, {
15
+ text: price[variant],
16
+ style: style
17
+ });
19
18
  }
20
19
  //# sourceMappingURL=PriceText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["PriceText.tsx"],"names":["React","ReText","useLineChartPrice","LineChartPriceText","format","precision","variant","props","price"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAIA,SAASC,iBAAT,QAAkC,YAAlC;AAUA,OAAO,SAASC,kBAAT,CAA4B;AACjCC,EAAAA,MADiC;AAEjCC,EAAAA,SAAS,GAAG,CAFqB;AAGjCC,EAAAA,OAAO,GAAG,WAHuB;AAIjC,KAAGC;AAJ8B,CAA5B,EAKqB;AAC1B,QAAMC,KAAK,GAAGN,iBAAiB,CAAC;AAAEE,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAD,CAA/B;AACA,sBAAO,oBAAC,MAAD;AAAQ,IAAA,IAAI,EAAEG,KAAK,CAACF,OAAD;AAAnB,KAAkCC,KAAlC,EAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { ReText } from 'react-native-redash';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useLineChartPrice } from './usePrice';\nimport type { TFormatterFn } from '../candle/types';\n\nexport type LineChartPriceTextProps = {\n format?: TFormatterFn<string>;\n precision?: number;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function LineChartPriceText({\n format,\n precision = 2,\n variant = 'formatted',\n ...props\n}: LineChartPriceTextProps) {\n const price = useLineChartPrice({ format, precision });\n return <ReText text={price[variant]} {...props} />;\n}\n"]}
1
+ {"version":3,"sources":["PriceText.tsx"],"names":["React","useLineChartPrice","AnimatedText","LineChartPriceText","format","precision","variant","style","price"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAIA,SAASC,iBAAT,QAAkC,YAAlC;AAEA,SAASC,YAAT,QAA6B,+BAA7B;AASA,OAAO,SAASC,kBAAT,CAA4B;AACjCC,EAAAA,MADiC;AAEjCC,EAAAA,SAAS,GAAG,CAFqB;AAGjCC,EAAAA,OAAO,GAAG,WAHuB;AAIjCC,EAAAA;AAJiC,CAA5B,EAKqB;AAC1B,QAAMC,KAAK,GAAGP,iBAAiB,CAAC;AAAEG,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAD,CAA/B;AACA,sBAAO,oBAAC,YAAD;AAAc,IAAA,IAAI,EAAEG,KAAK,CAACF,OAAD,CAAzB;AAAoC,IAAA,KAAK,EAAEC;AAA3C,IAAP;AACD","sourcesContent":["import * as React from 'react';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useLineChartPrice } from './usePrice';\nimport type { TFormatterFn } from '../candle/types';\nimport { AnimatedText } from '../../components/AnimatedText';\n\nexport type LineChartPriceTextProps = {\n format?: TFormatterFn<string>;\n precision?: number;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function LineChartPriceText({\n format,\n precision = 2,\n variant = 'formatted',\n style,\n}: LineChartPriceTextProps) {\n const price = useLineChartPrice({ format, precision });\n return <AnimatedText text={price[variant]} style={style} />;\n}\n"]}
@@ -0,0 +1,43 @@
1
+ // forked from https://github.com/wcandillon/react-native-redash/blob/master/src/ReText.tsx
2
+ import React from 'react';
3
+ import { Platform } from 'react-native';
4
+ import { TextInput } from 'react-native';
5
+ import Animated, { useAnimatedProps, useAnimatedReaction } from 'react-native-reanimated';
6
+ Animated.addWhitelistedNativeProps({
7
+ text: true
8
+ });
9
+ const AnimatedTextInput = Animated.createAnimatedComponent(TextInput);
10
+ export const AnimatedText = ({
11
+ text,
12
+ style
13
+ }) => {
14
+ const inputRef = React.useRef(null);
15
+ useAnimatedReaction(() => {
16
+ // always return false unless web to prevent unnecessary reactions
17
+ return Platform.OS === 'web' && text.value;
18
+ }, (data, prevData) => {
19
+ if (Platform.OS === 'web' && data !== prevData && inputRef.current) {
20
+ inputRef.current.setNativeProps({
21
+ value: data
22
+ });
23
+ }
24
+ });
25
+ const animatedProps = useAnimatedProps(() => {
26
+ return {
27
+ text: text.value // Here we use any because the text prop is not available in the type
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+
30
+ };
31
+ });
32
+ return /*#__PURE__*/React.createElement(AnimatedTextInput, {
33
+ underlineColorAndroid: "transparent",
34
+ editable: false,
35
+ ref: Platform.select({
36
+ web: inputRef
37
+ }),
38
+ value: text.value,
39
+ style: style,
40
+ animatedProps: animatedProps
41
+ });
42
+ };
43
+ //# sourceMappingURL=AnimatedText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["AnimatedText.tsx"],"names":["React","Platform","TextInput","Animated","useAnimatedProps","useAnimatedReaction","addWhitelistedNativeProps","text","AnimatedTextInput","createAnimatedComponent","AnimatedText","style","inputRef","useRef","OS","value","data","prevData","current","setNativeProps","animatedProps","select","web"],"mappings":"AAAA;AAEA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,QAAmD,cAAnD;AACA,SAASC,SAAT,QAA0B,cAA1B;AACA,OAAOC,QAAP,IACEC,gBADF,EAEEC,mBAFF,QAGO,yBAHP;AAKAF,QAAQ,CAACG,yBAAT,CAAmC;AAAEC,EAAAA,IAAI,EAAE;AAAR,CAAnC;AAOA,MAAMC,iBAAiB,GAAGL,QAAQ,CAACM,uBAAT,CAAiCP,SAAjC,CAA1B;AAEA,OAAO,MAAMQ,YAAY,GAAG,CAAC;AAAEH,EAAAA,IAAF;AAAQI,EAAAA;AAAR,CAAD,KAAwC;AAClE,QAAMC,QAAQ,GAAGZ,KAAK,CAACa,MAAN,CAAwB,IAAxB,CAAjB;AAEAR,EAAAA,mBAAmB,CACjB,MAAM;AACJ;AACA,WAAOJ,QAAQ,CAACa,EAAT,KAAgB,KAAhB,IAAyBP,IAAI,CAACQ,KAArC;AACD,GAJgB,EAKjB,CAACC,IAAD,EAAOC,QAAP,KAAoB;AAClB,QAAIhB,QAAQ,CAACa,EAAT,KAAgB,KAAhB,IAAyBE,IAAI,KAAKC,QAAlC,IAA8CL,QAAQ,CAACM,OAA3D,EAAoE;AAClEN,MAAAA,QAAQ,CAACM,OAAT,CAAiBC,cAAjB,CAAgC;AAC9BJ,QAAAA,KAAK,EAAEC;AADuB,OAAhC;AAGD;AACF,GAXgB,CAAnB;AAaA,QAAMI,aAAa,GAAGhB,gBAAgB,CAAC,MAAM;AAC3C,WAAO;AACLG,MAAAA,IAAI,EAAEA,IAAI,CAACQ,KADN,CAEL;AACA;;AAHK,KAAP;AAKD,GANqC,CAAtC;AAOA,sBACE,oBAAC,iBAAD;AACE,IAAA,qBAAqB,EAAC,aADxB;AAEE,IAAA,QAAQ,EAAE,KAFZ;AAGE,IAAA,GAAG,EAAEd,QAAQ,CAACoB,MAAT,CAAgB;AAAEC,MAAAA,GAAG,EAAEV;AAAP,KAAhB,CAHP;AAIE,IAAA,KAAK,EAAEL,IAAI,CAACQ,KAJd;AAKE,IAAA,KAAK,EAAEJ,KALT;AAME,IAAA,aAAa,EAAES;AANjB,IADF;AAUD,CAjCM","sourcesContent":["// forked from https://github.com/wcandillon/react-native-redash/blob/master/src/ReText.tsx\n\nimport React from 'react';\nimport { Platform, TextProps as RNTextProps } from 'react-native';\nimport { TextInput } from 'react-native';\nimport Animated, {\n useAnimatedProps,\n useAnimatedReaction,\n} from 'react-native-reanimated';\n\nAnimated.addWhitelistedNativeProps({ text: true });\n\ninterface AnimatedTextProps {\n text: Animated.SharedValue<string>;\n style?: Animated.AnimateProps<RNTextProps>['style'];\n}\n\nconst AnimatedTextInput = Animated.createAnimatedComponent(TextInput);\n\nexport const AnimatedText = ({ text, style }: AnimatedTextProps) => {\n const inputRef = React.useRef<TextInput>(null);\n\n useAnimatedReaction(\n () => {\n // always return false unless web to prevent unnecessary reactions\n return Platform.OS === 'web' && text.value;\n },\n (data, prevData) => {\n if (Platform.OS === 'web' && data !== prevData && inputRef.current) {\n inputRef.current.setNativeProps({\n value: data,\n });\n }\n }\n );\n const animatedProps = useAnimatedProps(() => {\n return {\n text: text.value,\n // Here we use any because the text prop is not available in the type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } as any;\n });\n return (\n <AnimatedTextInput\n underlineColorAndroid=\"transparent\"\n editable={false}\n ref={Platform.select({ web: inputRef })}\n value={text.value}\n style={style}\n animatedProps={animatedProps}\n />\n );\n};\n"]}
@@ -11,5 +11,5 @@ declare type CandlestickChartPriceTextProps = {
11
11
  variant?: 'formatted' | 'value';
12
12
  style?: Animated.AnimateProps<RNTextProps>['style'];
13
13
  };
14
- export declare function CandlestickChartDatetimeText({ locale, options, format, variant, ...props }: CandlestickChartPriceTextProps): JSX.Element;
14
+ export declare function CandlestickChartDatetimeText({ locale, options, format, variant, style, }: CandlestickChartPriceTextProps): JSX.Element;
15
15
  export {};
@@ -9,4 +9,4 @@ export declare type CandlestickChartPriceTextProps = {
9
9
  type?: TPriceType;
10
10
  style?: Animated.AnimateProps<RNTextProps>['style'];
11
11
  };
12
- export declare function CandlestickChartPriceText({ format, precision, variant, type, ...props }: CandlestickChartPriceTextProps): JSX.Element;
12
+ export declare function CandlestickChartPriceText({ format, precision, variant, type, style, }: CandlestickChartPriceTextProps): JSX.Element;
@@ -9,5 +9,5 @@ declare type LineChartDatetimeProps = {
9
9
  variant?: 'formatted' | 'value';
10
10
  style?: Animated.AnimateProps<RNTextProps>['style'];
11
11
  };
12
- export declare function LineChartDatetimeText({ locale, options, format, variant, ...props }: LineChartDatetimeProps): JSX.Element;
12
+ export declare function LineChartDatetimeText({ locale, options, format, variant, style, }: LineChartDatetimeProps): JSX.Element;
13
13
  export {};
@@ -8,4 +8,4 @@ export declare type LineChartPriceTextProps = {
8
8
  variant?: 'formatted' | 'value';
9
9
  style?: Animated.AnimateProps<RNTextProps>['style'];
10
10
  };
11
- export declare function LineChartPriceText({ format, precision, variant, ...props }: LineChartPriceTextProps): JSX.Element;
11
+ export declare function LineChartPriceText({ format, precision, variant, style, }: LineChartPriceTextProps): JSX.Element;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { TextProps as RNTextProps } from 'react-native';
3
+ import Animated from 'react-native-reanimated';
4
+ interface AnimatedTextProps {
5
+ text: Animated.SharedValue<string>;
6
+ style?: Animated.AnimateProps<RNTextProps>['style'];
7
+ }
8
+ export declare const AnimatedText: ({ text, style }: AnimatedTextProps) => JSX.Element;
9
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-wagmi-charts",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "A sweet candlestick chart for React Native",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import type { StyleProp, TextStyle, ViewProps } from 'react-native';
3
+ import { StyleSheet } from 'react-native';
3
4
  import Animated, {
4
5
  useAnimatedStyle,
5
6
  useDerivedValue,
@@ -34,8 +35,8 @@ export function CandlestickChartCrosshairTooltip({
34
35
  children,
35
36
  xGutter = 8,
36
37
  yGutter = 8,
37
- tooltipTextProps = {},
38
- textStyle = {},
38
+ tooltipTextProps,
39
+ textStyle,
39
40
  ...props
40
41
  }: CandlestickChartCrosshairTooltipProps) {
41
42
  const { width, height } = React.useContext(CandlestickChartDimensionsContext);
@@ -93,7 +94,7 @@ export function CandlestickChartCrosshairTooltip({
93
94
  {children || (
94
95
  <CandlestickChartPriceText
95
96
  {...tooltipTextProps}
96
- style={[{ fontSize: 14 }, tooltipTextProps.style, textStyle]}
97
+ style={[styles.text, tooltipTextProps?.style, textStyle]}
97
98
  />
98
99
  )}
99
100
  </Animated.View>
@@ -101,10 +102,16 @@ export function CandlestickChartCrosshairTooltip({
101
102
  {children || (
102
103
  <CandlestickChartPriceText
103
104
  {...tooltipTextProps}
104
- style={[{ fontSize: 14 }, tooltipTextProps.style, textStyle]}
105
+ style={[styles.text, tooltipTextProps?.style, textStyle]}
105
106
  />
106
107
  )}
107
108
  </Animated.View>
108
109
  </>
109
110
  );
110
111
  }
112
+
113
+ const styles = StyleSheet.create({
114
+ text: {
115
+ fontSize: 14,
116
+ },
117
+ });
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
- import { ReText } from 'react-native-redash';
3
2
  import type { TextProps as RNTextProps } from 'react-native';
4
3
  import type Animated from 'react-native-reanimated';
5
4
 
6
5
  import { useCandlestickChartDatetime } from './useDatetime';
7
6
  import type { TFormatterFn } from 'react-native-wagmi-charts';
7
+ import { AnimatedText } from '../../components/AnimatedText';
8
8
 
9
9
  type CandlestickChartPriceTextProps = {
10
10
  locale?: string;
@@ -19,8 +19,8 @@ export function CandlestickChartDatetimeText({
19
19
  options,
20
20
  format,
21
21
  variant = 'formatted',
22
- ...props
22
+ style,
23
23
  }: CandlestickChartPriceTextProps) {
24
24
  const datetime = useCandlestickChartDatetime({ format, locale, options });
25
- return <ReText text={datetime[variant]} {...props} />;
25
+ return <AnimatedText text={datetime[variant]} style={style} />;
26
26
  }
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
- import { ReText } from 'react-native-redash';
3
2
  import type { TextProps as RNTextProps } from 'react-native';
4
3
  import type Animated from 'react-native-reanimated';
5
4
  import type { TFormatterFn, TPriceType } from './types';
6
5
 
7
6
  import { useCandlestickChartPrice } from './usePrice';
7
+ import { AnimatedText } from '../../components/AnimatedText';
8
8
 
9
9
  export type CandlestickChartPriceTextProps = {
10
10
  format?: TFormatterFn<string>;
@@ -19,8 +19,8 @@ export function CandlestickChartPriceText({
19
19
  precision = 2,
20
20
  variant = 'formatted',
21
21
  type = 'crosshair',
22
- ...props
22
+ style,
23
23
  }: CandlestickChartPriceTextProps) {
24
24
  const price = useCandlestickChartPrice({ format, precision, type });
25
- return <ReText text={price[variant]} {...props} />;
25
+ return <AnimatedText text={price[variant]} style={style} />;
26
26
  }
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
- import { ReText } from 'react-native-redash';
3
2
  import type { TextProps as RNTextProps } from 'react-native';
4
3
  import type Animated from 'react-native-reanimated';
5
4
 
6
5
  import { useLineChartDatetime } from './useDatetime';
7
6
  import type { TFormatterFn } from 'react-native-wagmi-charts';
7
+ import { AnimatedText } from '../../components/AnimatedText';
8
8
 
9
9
  type LineChartDatetimeProps = {
10
10
  locale?: string;
@@ -19,8 +19,8 @@ export function LineChartDatetimeText({
19
19
  options,
20
20
  format,
21
21
  variant = 'formatted',
22
- ...props
22
+ style,
23
23
  }: LineChartDatetimeProps) {
24
24
  const datetime = useLineChartDatetime({ format, locale, options });
25
- return <ReText text={datetime[variant]} {...props} />;
25
+ return <AnimatedText text={datetime[variant]} style={style} />;
26
26
  }
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
- import { ReText } from 'react-native-redash';
3
2
  import type { TextProps as RNTextProps } from 'react-native';
4
3
  import type Animated from 'react-native-reanimated';
5
4
 
6
5
  import { useLineChartPrice } from './usePrice';
7
6
  import type { TFormatterFn } from '../candle/types';
7
+ import { AnimatedText } from '../../components/AnimatedText';
8
8
 
9
9
  export type LineChartPriceTextProps = {
10
10
  format?: TFormatterFn<string>;
@@ -17,8 +17,8 @@ export function LineChartPriceText({
17
17
  format,
18
18
  precision = 2,
19
19
  variant = 'formatted',
20
- ...props
20
+ style,
21
21
  }: LineChartPriceTextProps) {
22
22
  const price = useLineChartPrice({ format, precision });
23
- return <ReText text={price[variant]} {...props} />;
23
+ return <AnimatedText text={price[variant]} style={style} />;
24
24
  }
@@ -0,0 +1,53 @@
1
+ // forked from https://github.com/wcandillon/react-native-redash/blob/master/src/ReText.tsx
2
+
3
+ import React from 'react';
4
+ import { Platform, TextProps as RNTextProps } from 'react-native';
5
+ import { TextInput } from 'react-native';
6
+ import Animated, {
7
+ useAnimatedProps,
8
+ useAnimatedReaction,
9
+ } from 'react-native-reanimated';
10
+
11
+ Animated.addWhitelistedNativeProps({ text: true });
12
+
13
+ interface AnimatedTextProps {
14
+ text: Animated.SharedValue<string>;
15
+ style?: Animated.AnimateProps<RNTextProps>['style'];
16
+ }
17
+
18
+ const AnimatedTextInput = Animated.createAnimatedComponent(TextInput);
19
+
20
+ export const AnimatedText = ({ text, style }: AnimatedTextProps) => {
21
+ const inputRef = React.useRef<TextInput>(null);
22
+
23
+ useAnimatedReaction(
24
+ () => {
25
+ // always return false unless web to prevent unnecessary reactions
26
+ return Platform.OS === 'web' && text.value;
27
+ },
28
+ (data, prevData) => {
29
+ if (Platform.OS === 'web' && data !== prevData && inputRef.current) {
30
+ inputRef.current.setNativeProps({
31
+ value: data,
32
+ });
33
+ }
34
+ }
35
+ );
36
+ const animatedProps = useAnimatedProps(() => {
37
+ return {
38
+ text: text.value,
39
+ // Here we use any because the text prop is not available in the type
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
+ } as any;
42
+ });
43
+ return (
44
+ <AnimatedTextInput
45
+ underlineColorAndroid="transparent"
46
+ editable={false}
47
+ ref={Platform.select({ web: inputRef })}
48
+ value={text.value}
49
+ style={style}
50
+ animatedProps={animatedProps}
51
+ />
52
+ );
53
+ };