@ohos-ports/react-native-animated-rolling-numbers 0.0.0-stage → 2.0.0-beta.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.
@@ -0,0 +1,233 @@
1
+ ```javascript
2
+ import {
3
+ Dimensions,
4
+ SafeAreaView,
5
+ ScrollView,
6
+ StyleSheet,
7
+ Text,
8
+ TouchableOpacity,
9
+ TouchableOpacityProps,
10
+ View,
11
+ } from "react-native";
12
+ import { useState } from "react";
13
+ import { AnimatedRollingNumber } from "react-native-animated-rolling-numbers";
14
+
15
+ interface ButtonProps extends TouchableOpacityProps {
16
+ variant?: "primary" | "secondary";
17
+ title?: string;
18
+ onPress?: () => void;
19
+ }
20
+ const Button: React.FC<ButtonProps> = ({
21
+ title,
22
+ onPress,
23
+ variant = "primary",
24
+ ...rest
25
+ }) => {
26
+ const { style, ...props } = rest;
27
+ return (
28
+ <TouchableOpacity
29
+ style={[
30
+ styles.button,
31
+ {
32
+ backgroundColor: variant === "primary" ? "#2077E0" : "white",
33
+ borderWidth: 1,
34
+ borderColor: variant === "primary" ? "white" : "#2077E0",
35
+ },
36
+ style,
37
+ ]}
38
+ onPress={onPress}
39
+ {...props}
40
+ >
41
+ <Text
42
+ style={[
43
+ styles.buttonText,
44
+ {
45
+ color: variant === "primary" ? "white" : "#2077E0",
46
+ },
47
+ ]}
48
+ >
49
+ {title}
50
+ </Text>
51
+ </TouchableOpacity>
52
+ );
53
+ };
54
+
55
+ export default function App() {
56
+ const [count, setCount] = useState(142347);
57
+ const [showMinusSign, setShowMinusSign] = useState(true);
58
+ const [showPlusSign, setShowPlusSign] = useState(false);
59
+ const [useGrouping, setUseGrouping] = useState(false);
60
+ const [enableCompactNotation, setEnableCompactNotation] = useState(false);
61
+ const [compactToFixed, setCompactToFixed] = useState(1);
62
+ const [toFixed, setToFixed] = useState(2);
63
+ const [fixedOnlyForCompact, setFixedOnlyForCompact] = useState(true);
64
+ const [locale, setLocale] = useState("en-US");
65
+
66
+ return (
67
+ <SafeAreaView style={styles.container}>
68
+ <ScrollView
69
+ style={{ width: Dimensions.get("screen").width }}
70
+ contentContainerStyle={styles.contentContainer}
71
+ >
72
+ <View style={{ flexDirection: "row" }}>
73
+ <Button
74
+ variant="secondary"
75
+ title="-3461997.234"
76
+ onPress={() => setCount(-3461997.234)}
77
+ />
78
+ <Button
79
+ variant="secondary"
80
+ title="+3461997.234"
81
+ onPress={() => setCount(3461997.234)}
82
+ />
83
+ </View>
84
+ <View style={{ flexDirection: "row" }}>
85
+ <Button
86
+ variant="secondary"
87
+ title=" + "
88
+ onPress={() => setCount(count + Math.round(Math.random() * count))}
89
+ style={{ minWidth: 100 }}
90
+ />
91
+ <Button
92
+ variant="secondary"
93
+ title=" - "
94
+ onPress={() => setCount(count - Math.round(Math.random() * count))}
95
+ style={{ minWidth: 100 }}
96
+ />
97
+ </View>
98
+ <AnimatedRollingNumber
99
+ containerStyle={styles.numberContainer}
100
+ value={count}
101
+ toFixed={toFixed}
102
+ useGrouping={useGrouping}
103
+ locale={locale}
104
+ // formattedText={customFormatCompactNumber(count)}
105
+ enableCompactNotation={enableCompactNotation}
106
+ compactToFixed={compactToFixed}
107
+ fixedOnlyForCompact={fixedOnlyForCompact}
108
+ showPlusSign={showPlusSign}
109
+ showMinusSign={showMinusSign}
110
+ textStyle={styles.textStyle}
111
+ // (optional) using the font-variant to avoid layout jumping when the number is updated
112
+ numberStyle={{
113
+ fontVariant: ["tabular-nums"],
114
+ }}
115
+ />
116
+ <Text style={{ fontSize: 24, fontWeight: "bold", marginBottom: 24 }}>
117
+ Props Enabled / Disabled
118
+ </Text>
119
+ <View style={{ flexDirection: "row" }}>
120
+ <Button
121
+ variant={showMinusSign ? "primary" : "secondary"}
122
+ title="Show -"
123
+ onPress={() => setShowMinusSign(!showMinusSign)}
124
+ style={{ minWidth: 100 }}
125
+ />
126
+ <Button
127
+ variant={showPlusSign ? "primary" : "secondary"}
128
+ title="Show +"
129
+ onPress={() => setShowPlusSign(!showPlusSign)}
130
+ style={{ minWidth: 100 }}
131
+ />
132
+ <Button
133
+ variant={useGrouping ? "primary" : "secondary"}
134
+ title="useGrouping"
135
+ onPress={() => setUseGrouping(!useGrouping)}
136
+ style={{ minWidth: 100 }}
137
+ />
138
+ </View>
139
+ <Button
140
+ variant={enableCompactNotation ? "primary" : "secondary"}
141
+ title="Enable Compact Notation"
142
+ onPress={() => setEnableCompactNotation(!enableCompactNotation)}
143
+ style={{ minWidth: 100 }}
144
+ />
145
+ <Button
146
+ variant={fixedOnlyForCompact ? "primary" : "secondary"}
147
+ title="Fixed Only For Compact"
148
+ onPress={() => setFixedOnlyForCompact(!fixedOnlyForCompact)}
149
+ style={{ minWidth: 100 }}
150
+ />
151
+ <Button
152
+ variant={enableCompactNotation ? "primary" : "secondary"}
153
+ disabled={!enableCompactNotation}
154
+ title={`Increase Compact toFixed : ${compactToFixed}`}
155
+ onPress={() => setCompactToFixed(Math.max(compactToFixed + 1, 0))}
156
+ style={{ minWidth: 100 }}
157
+ />
158
+ <Button
159
+ variant={!enableCompactNotation ? "secondary" : "primary"}
160
+ disabled={!enableCompactNotation}
161
+ title={`Decrease Compact toFixed : ${compactToFixed}`}
162
+ onPress={() => setCompactToFixed(Math.max(compactToFixed - 1, 0))}
163
+ style={{ minWidth: 100 }}
164
+ />
165
+ <Button
166
+ variant={!enableCompactNotation ? "primary" : "secondary"}
167
+ disabled={enableCompactNotation}
168
+ title={`Increase toFixed : ${toFixed}`}
169
+ onPress={() => setToFixed(Math.max(toFixed + 1, 0))}
170
+ style={{ minWidth: 100 }}
171
+ />
172
+ <Button
173
+ variant={!enableCompactNotation ? "primary" : "secondary"}
174
+ disabled={enableCompactNotation}
175
+ title={`Decrease toFixed : ${toFixed}`}
176
+ onPress={() => setToFixed(Math.max(toFixed - 1, 0))}
177
+ style={{ minWidth: 100 }}
178
+ />
179
+ <View style={{ flexDirection: "row" }}>
180
+ <Button
181
+ variant={locale === "en-US" ? "primary" : "secondary"}
182
+ title="locale en-US"
183
+ onPress={() => setLocale("en-US")}
184
+ />
185
+ <Button
186
+ variant={locale === "de-DE" ? "primary" : "secondary"}
187
+ title="locale de-DE"
188
+ onPress={() => setLocale("de-DE")}
189
+ />
190
+ </View>
191
+ </ScrollView>
192
+ </SafeAreaView>
193
+ );
194
+ }
195
+ const styles = StyleSheet.create({
196
+ container: {
197
+ flex: 1,
198
+ backgroundColor: "#fff",
199
+ alignItems: "center",
200
+ justifyContent: "center",
201
+ },
202
+ contentContainer: {
203
+ flexGrow: 1,
204
+ alignItems: "center",
205
+ width: Dimensions.get("screen").width,
206
+ },
207
+ button: {
208
+ backgroundColor: "#2077E0",
209
+ borderRadius: 10,
210
+ padding: 10,
211
+ alignItems: "center",
212
+ justifyContent: "center",
213
+ margin: 5,
214
+ },
215
+ buttonText: {
216
+ fontSize: 18,
217
+ fontWeight: "bold",
218
+ color: "white",
219
+ },
220
+ textStyle: {
221
+ color: "black",
222
+ fontWeight: "bold",
223
+ paddingHorizontal: 1,
224
+ fontSize: 28,
225
+ },
226
+ numberContainer: {
227
+ backgroundColor: "rgba(0,0,0,0.2)",
228
+ borderRadius: 10,
229
+ padding: 32,
230
+ marginVertical: 24,
231
+ },
232
+ });
233
+ ```
@@ -0,0 +1,54 @@
1
+ import React from "react";
2
+ import { type StyleProp, Text, type TextStyle, type ViewStyle } from "@ohos-ports/react-native";
3
+ import Animated, { type AnimationCallback, type EasingFunction, type EasingFunctionFactory, ReduceMotion } from "@ohos-ports/react-native-reanimated";
4
+ export type DigitVariant = "sign" | "number" | "compact" | "dot" | "comma";
5
+ /**
6
+ * Properties for the AnimatedDigit component.
7
+ */
8
+ export interface AnimatedDigitProps extends Omit<React.ComponentProps<typeof Animated.View>, "style"> {
9
+ /** The string value to be displayed and animated. */
10
+ value: string;
11
+ /** The height of each digit or notation, used for animation calculations. */
12
+ height: number;
13
+ /** Style for the container wrapping the animated text. */
14
+ containerStyle?: StyleProp<ViewStyle>;
15
+ /** Props for the primary text component used in the component. */
16
+ textProps?: Omit<React.ComponentProps<typeof Text>, "style">;
17
+ /** Props for the number text components. */
18
+ numberTextProps?: Omit<React.ComponentProps<typeof Text>, "style">;
19
+ /** Props for the comma text component, if used. */
20
+ commaTextProps?: Omit<React.ComponentProps<typeof Text>, "style">;
21
+ /** Props for the dot (decimal point) text component, if used. */
22
+ dotTextProps?: Omit<React.ComponentProps<typeof Text>, "style">;
23
+ /** Props for the compact notation text components (K, M, B, T). */
24
+ compactNotationTextProps?: Omit<React.ComponentProps<typeof Text>, "style">;
25
+ /** Props for the sign text component, if used. */
26
+ signTextProps?: Omit<React.ComponentProps<typeof Text>, "style">;
27
+ /** Style for the primary text component. */
28
+ textStyle?: StyleProp<TextStyle>;
29
+ /** Style for the number text components. */
30
+ numberStyle?: StyleProp<TextStyle>;
31
+ /** Style for the comma text component, if used. */
32
+ commaStyle?: StyleProp<TextStyle>;
33
+ /** Style for the dot (decimal point) text component, if used. */
34
+ dotStyle?: StyleProp<TextStyle>;
35
+ /** Style for the compact notation text components (K, M, B, T). */
36
+ compactNotationStyle?: StyleProp<TextStyle>;
37
+ /** Style for the sign text component, if used. */
38
+ signStyle?: StyleProp<TextStyle>;
39
+ /** Configuration for the animation moving the digits up and down. Defaults to a bounce animation with 500ms duration. */
40
+ spinningAnimationConfig?: {
41
+ duration?: number;
42
+ reduceMotion?: ReduceMotion;
43
+ easing?: EasingFunction | EasingFunctionFactory;
44
+ };
45
+ /** Callback function invoked when the animation completes. */
46
+ animationCallback?: AnimationCallback;
47
+ /** Custom function to animate the value change. Defaults to a bounce animation. */
48
+ animateToNewValue?: (newValue: number, variant?: DigitVariant) => number;
49
+ }
50
+ /**
51
+ * AnimatedDigit is a React component that animates numbers and compact notations (K, M, B, T)
52
+ * with customizable styles and animations.
53
+ */
54
+ export declare const AnimatedDigit: React.FC<AnimatedDigitProps>;
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __rest = (this && this.__rest) || function (s, e) {
37
+ var t = {};
38
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
39
+ t[p] = s[p];
40
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
41
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
42
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
43
+ t[p[i]] = s[p[i]];
44
+ }
45
+ return t;
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.AnimatedDigit = void 0;
49
+ var react_1 = __importStar(require("react"));
50
+ var react_native_1 = require("@ohos-ports/react-native");
51
+ var react_native_reanimated_1 = __importStar(require("@ohos-ports/react-native-reanimated"));
52
+ var constants_1 = require("../constants");
53
+ /**
54
+ * AnimatedDigit is a React component that animates numbers and compact notations (K, M, B, T)
55
+ * with customizable styles and animations.
56
+ */
57
+ var AnimatedDigit = function (_a) {
58
+ var value = _a.value, height = _a.height, containerStyle = _a.containerStyle, spinningAnimationConfig = _a.spinningAnimationConfig, _b = _a.animationCallback, animationCallback = _b === void 0 ? function () { } : _b, _c = _a.animateToNewValue, animateToNewValue = _c === void 0 ? function (newValue, variant) {
59
+ return (0, react_native_reanimated_1.withTiming)(-newValue, spinningAnimationConfig || {
60
+ duration: variant === "number" ? 600 : 100,
61
+ easing: react_native_reanimated_1.Easing.elastic(1),
62
+ }, function (finished, current) { var _a; return (_a = (0, react_native_reanimated_1.runOnJS)(animationCallback)) === null || _a === void 0 ? void 0 : _a(finished, current); });
63
+ } : _c, textProps = _a.textProps, commaTextProps = _a.commaTextProps, dotTextProps = _a.dotTextProps, compactNotationTextProps = _a.compactNotationTextProps, signTextProps = _a.signTextProps, textStyle = _a.textStyle, numberStyle = _a.numberStyle, commaStyle = _a.commaStyle, dotStyle = _a.dotStyle, signStyle = _a.signStyle, compactNotationStyle = _a.compactNotationStyle, numberTextProps = _a.numberTextProps, rest = __rest(_a, ["value", "height", "containerStyle", "spinningAnimationConfig", "animationCallback", "animateToNewValue", "textProps", "commaTextProps", "dotTextProps", "compactNotationTextProps", "signTextProps", "textStyle", "numberStyle", "commaStyle", "dotStyle", "signStyle", "compactNotationStyle", "numberTextProps"]);
64
+ var isNumeric = !isNaN(Number(value));
65
+ var animatedValue = (0, react_native_reanimated_1.useSharedValue)(isNumeric ? Number(value) : 0);
66
+ var animatedStyle = (0, react_native_reanimated_1.useAnimatedStyle)(function () { return ({
67
+ transform: [{ translateY: animatedValue.value * (height || 0) }],
68
+ }); }, [height]);
69
+ var othersTextStyle = (0, react_1.useMemo)(function () { return ({
70
+ ".": dotStyle,
71
+ ",": commaStyle,
72
+ "-": signStyle,
73
+ "+": signStyle,
74
+ }); }, [signStyle, dotStyle, commaStyle]);
75
+ var othersTextProps = (0, react_1.useMemo)(function () { return ({
76
+ ".": dotTextProps,
77
+ ",": commaTextProps,
78
+ "-": signTextProps,
79
+ "+": signTextProps,
80
+ }); }, [signTextProps, dotTextProps, commaTextProps]);
81
+ var resolvedPadding = (0, react_1.useMemo)(function () {
82
+ var _a, _b;
83
+ return (((_a = react_native_1.StyleSheet.flatten(compactNotationStyle)) === null || _a === void 0 ? void 0 : _a.fontSize) ||
84
+ ((_b = react_native_1.StyleSheet.flatten(textStyle)) === null || _b === void 0 ? void 0 : _b.fontSize) ||
85
+ 14) * 0.1;
86
+ }, [textStyle, compactNotationStyle]);
87
+ (0, react_1.useEffect)(function () {
88
+ var newValue = !isNumeric
89
+ ? constants_1.COMPACT_NOTATIONS.includes(value.toUpperCase())
90
+ ? constants_1.COMPACT_NOTATIONS.indexOf(value.toUpperCase())
91
+ : 0
92
+ : Number(value);
93
+ animatedValue.value = animateToNewValue(newValue, constants_1.DIGIT_VARIANTS[value]);
94
+ }, [value]);
95
+ return (0, react_1.useMemo)(function () { return (react_1.default.createElement(react_native_reanimated_1.default.View, __assign({ layout: react_native_reanimated_1.LinearTransition, entering: react_native_reanimated_1.FadeIn, style: [
96
+ { alignItems: "center", justifyContent: "center" },
97
+ containerStyle,
98
+ { overflow: "hidden" },
99
+ ] }, rest),
100
+ react_1.default.createElement(react_native_reanimated_1.default.View, { style: [styles.digitContainer, animatedStyle] }, isNumeric ? (constants_1.NUMBER_ARRAY.map(function (_, index) { return (react_1.default.createElement(react_native_1.Text, __assign({ key: index, style: [
101
+ textStyle,
102
+ numberStyle,
103
+ {
104
+ position: index === 0 ? "relative" : "absolute",
105
+ top: height * index,
106
+ },
107
+ ] }, textProps, numberTextProps), index)); })) : constants_1.COMPACT_NOTATIONS.includes(value.toUpperCase()) ? (constants_1.COMPACT_NOTATIONS.map(function (char, index) { return (react_1.default.createElement(react_native_1.Text, __assign({ key: index, style: [
108
+ textStyle,
109
+ compactNotationStyle,
110
+ {
111
+ paddingHorizontal: index === 0 ? resolvedPadding : 0,
112
+ position: index === 0 ? "relative" : "absolute",
113
+ top: height * index,
114
+ },
115
+ ] }, textProps, compactNotationTextProps), char)); })) : (react_1.default.createElement(react_native_1.Text, __assign({ style: [
116
+ textStyle,
117
+ othersTextStyle === null || othersTextStyle === void 0 ? void 0 : othersTextStyle[value],
118
+ ] }, textProps, othersTextProps === null || othersTextProps === void 0 ? void 0 : othersTextProps[value]), value))))); }, __DEV__
119
+ ? [
120
+ value,
121
+ height,
122
+ containerStyle,
123
+ textProps,
124
+ numberTextProps,
125
+ compactNotationTextProps,
126
+ othersTextProps,
127
+ textStyle,
128
+ numberStyle,
129
+ compactNotationStyle,
130
+ othersTextStyle,
131
+ ]
132
+ : [height, value]);
133
+ };
134
+ exports.AnimatedDigit = AnimatedDigit;
135
+ var styles = react_native_1.StyleSheet.create({
136
+ digitContainer: {
137
+ alignItems: "center",
138
+ overflow: "visible",
139
+ justifyContent: "center",
140
+ },
141
+ });
142
+ //# sourceMappingURL=AnimatedDigit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimatedDigit.js","sourceRoot":"","sources":["../../src/components/AnimatedDigit.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAkD;AAClD,6CAMsB;AACtB,iFAYiC;AACjC,0CAA+E;AAmD/E;;;GAGG;AACI,IAAM,aAAa,GAAiC,UAAC,EA4B3D;IA3BC,IAAA,KAAK,WAAA,EACL,MAAM,YAAA,EACN,cAAc,oBAAA,EACd,uBAAuB,6BAAA,EACvB,yBAA4B,EAA5B,iBAAiB,mBAAG,cAAO,CAAC,KAAA,EAC5B,yBAQG,EARH,iBAAiB,mBAAG,UAAC,QAAQ,EAAE,OAAO;QACpC,OAAA,IAAA,oCAAU,EACR,CAAC,QAAQ,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eAAe,CAAG,KAAqC,CAAC,GAE3D,KAAK,CACD,CACR,CACa,CACF,CACjB,EA/DK,CA+DL,EACD,OAAO;QACL,CAAC,CAAC;YACE,KAAK;YACL,MAAM;YACN,cAAc;YACd,SAAS;YACT,eAAe;YACf,wBAAwB;YACxB,eAAe;YACf,SAAS;YACT,WAAW;YACX,oBAAoB;YACpB,eAAe;SAChB;QACH,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CACpB,CAAC;AACJ,CAAC,CAAC;AA5JW,QAAA,aAAa,iBA4JxB;AAEF,IAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,cAAc,EAAE;QACd,UAAU,EAAE,QAAQ;QACpB,QAAQ,EAAE,SAAS;QACnB,cAAc,EAAE,QAAQ;KACzB;CACF,CAAC,CAAC"}
@@ -0,0 +1,72 @@
1
+ import React from "react";
2
+ import { type StyleProp, type ViewStyle, type TextStyle, Text } from "@ohos-ports/react-native";
3
+ import Animated, { type AnimationCallback, type EasingFunction, type EasingFunctionFactory, ReduceMotion } from "@ohos-ports/react-native-reanimated";
4
+ import { type DigitVariant } from "./AnimatedDigit";
5
+ /**
6
+ * Properties for the AnimatedRollingNumber component.
7
+ */
8
+ export interface AnimatedRollingNumberProps extends Omit<React.ComponentProps<typeof Animated.View>, "style"> {
9
+ /** The numeric value to be displayed and animated. */
10
+ value: number;
11
+ /** Whether to show the minus sign. */
12
+ showMinusSign?: boolean;
13
+ /** Whether to show the plus sign. */
14
+ showPlusSign?: boolean;
15
+ /** Number of decimal places to show in normal notation. */
16
+ toFixed?: number;
17
+ /** Whether to include commas in the number formatting (e.g., 1,000). */
18
+ useGrouping?: boolean;
19
+ /** Custom formatted text to display instead of the numeric value. */
20
+ formattedText?: string;
21
+ /** The locale to use for number formatting. Defaults to "en-US". */
22
+ locale?: Intl.LocalesArgument;
23
+ /** Whether to enable compact notation (e.g., 1K, 1M). */
24
+ enableCompactNotation?: boolean;
25
+ /** Number of decimal places to show in compact notation. */
26
+ compactToFixed?: number;
27
+ /** If true, only applies decimal fixing for compact notation. only for the notation that has M/K/B/T. in the end */
28
+ fixedOnlyForCompact?: boolean;
29
+ /** Style for the container wrapping the digits. */
30
+ containerStyle?: StyleProp<ViewStyle>;
31
+ /** Style for the container wrapping the animated text. */
32
+ digitContainerStyle?: StyleProp<ViewStyle>;
33
+ /** Props for the primary text component used in the component. */
34
+ textProps?: Omit<React.ComponentProps<typeof Text>, "style">;
35
+ /** Props for the number text components. */
36
+ numberTextProps?: Omit<React.ComponentProps<typeof Text>, "style">;
37
+ /** Props for the comma text component, if used. */
38
+ commaTextProps?: Omit<React.ComponentProps<typeof Text>, "style">;
39
+ /** Props for the dot (decimal point) text component, if used. */
40
+ dotTextProps?: Omit<React.ComponentProps<typeof Text>, "style">;
41
+ /** Props for the compact notation text components (K, M, B, T). */
42
+ compactNotationTextProps?: Omit<React.ComponentProps<typeof Text>, "style">;
43
+ /** Props for the sign text component, if used. */
44
+ signTextProps?: Omit<React.ComponentProps<typeof Text>, "style">;
45
+ /** Style for the primary text component. */
46
+ textStyle?: StyleProp<TextStyle>;
47
+ /** Style for the number text components. */
48
+ numberStyle?: StyleProp<TextStyle>;
49
+ /** Style for the comma text component, if used. */
50
+ commaStyle?: StyleProp<TextStyle>;
51
+ /** Style for the dot (decimal point) text component, if used. */
52
+ dotStyle?: StyleProp<TextStyle>;
53
+ /** Style for the compact notation text components (K, M, B, T). */
54
+ compactNotationStyle?: StyleProp<TextStyle>;
55
+ /** Style for the sign text component, if used. */
56
+ signStyle?: StyleProp<TextStyle>;
57
+ /** Configuration for the animation moving the digits up and down. Defaults to a bounce animation with 500ms duration. */
58
+ spinningAnimationConfig?: {
59
+ duration?: number;
60
+ reduceMotion?: ReduceMotion;
61
+ easing?: EasingFunction | EasingFunctionFactory;
62
+ };
63
+ /** Callback function invoked when the animation completes. */
64
+ animationCallback?: AnimationCallback;
65
+ /** Custom function to animate the value change. Defaults to a bounce animation. */
66
+ animateToNewValue?: (newValue: number, variant?: DigitVariant) => number;
67
+ }
68
+ /**
69
+ * AnimatedDigits is a React component that formats and animates numeric values,
70
+ * optionally using compact notation (K, M, B, T) and custom styling.
71
+ */
72
+ export declare const AnimatedRollingNumber: React.FC<AnimatedRollingNumberProps>;
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __rest = (this && this.__rest) || function (s, e) {
37
+ var t = {};
38
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
39
+ t[p] = s[p];
40
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
41
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
42
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
43
+ t[p[i]] = s[p[i]];
44
+ }
45
+ return t;
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.AnimatedRollingNumber = void 0;
49
+ var react_1 = __importStar(require("react"));
50
+ var react_native_1 = require("@ohos-ports/react-native");
51
+ var react_native_reanimated_1 = __importStar(require("@ohos-ports/react-native-reanimated"));
52
+ var AnimatedDigit_1 = require("./AnimatedDigit");
53
+ var utils_1 = require("../utils");
54
+ /**
55
+ * AnimatedDigits is a React component that formats and animates numeric values,
56
+ * optionally using compact notation (K, M, B, T) and custom styling.
57
+ */
58
+ var AnimatedRollingNumber = function (_a) {
59
+ var value = _a.value, _b = _a.showMinusSign, showMinusSign = _b === void 0 ? true : _b, _c = _a.showPlusSign, showPlusSign = _c === void 0 ? false : _c, toFixed = _a.toFixed, _d = _a.useGrouping, useGrouping = _d === void 0 ? false : _d, formattedText = _a.formattedText, _e = _a.locale, locale = _e === void 0 ? "en-US" : _e, enableCompactNotation = _a.enableCompactNotation, compactToFixed = _a.compactToFixed, containerStyle = _a.containerStyle, _f = _a.fixedOnlyForCompact, fixedOnlyForCompact = _f === void 0 ? true : _f, digitContainerStyle = _a.digitContainerStyle, numberTextProps = _a.numberTextProps, commaTextProps = _a.commaTextProps, dotTextProps = _a.dotTextProps, compactNotationTextProps = _a.compactNotationTextProps, signTextProps = _a.signTextProps, textStyle = _a.textStyle, numberStyle = _a.numberStyle, commaStyle = _a.commaStyle, dotStyle = _a.dotStyle, compactNotationStyle = _a.compactNotationStyle, signStyle = _a.signStyle, textProps = _a.textProps, spinningAnimationConfig = _a.spinningAnimationConfig, animationCallback = _a.animationCallback, animateToNewValue = _a.animateToNewValue, rest = __rest(_a, ["value", "showMinusSign", "showPlusSign", "toFixed", "useGrouping", "formattedText", "locale", "enableCompactNotation", "compactToFixed", "containerStyle", "fixedOnlyForCompact", "digitContainerStyle", "numberTextProps", "commaTextProps", "dotTextProps", "compactNotationTextProps", "signTextProps", "textStyle", "numberStyle", "commaStyle", "dotStyle", "compactNotationStyle", "signStyle", "textProps", "spinningAnimationConfig", "animationCallback", "animateToNewValue"]);
60
+ var _g = (0, react_1.useState)(0), height = _g[0], setHeight = _g[1];
61
+ var numberValue = value < 0 && !showMinusSign ? Math.abs(value) : value;
62
+ var formattedNumber = (0, react_1.useMemo)(function () {
63
+ return formattedText ||
64
+ (enableCompactNotation &&
65
+ (0, utils_1.formatCompactNumber)(numberValue, compactToFixed || toFixed, fixedOnlyForCompact, useGrouping, locale)) ||
66
+ numberValue.toLocaleString(locale, {
67
+ useGrouping: useGrouping,
68
+ minimumFractionDigits: toFixed,
69
+ maximumFractionDigits: toFixed,
70
+ });
71
+ }, [
72
+ formattedText,
73
+ useGrouping,
74
+ value,
75
+ compactToFixed,
76
+ enableCompactNotation,
77
+ showMinusSign,
78
+ showPlusSign,
79
+ fixedOnlyForCompact,
80
+ locale,
81
+ toFixed,
82
+ ]);
83
+ var number = (0, react_1.useMemo)(function () {
84
+ var numberWithSign = ((showPlusSign && value >= 0 ? "+" : "") + formattedNumber).split("");
85
+ if (react_native_1.I18nManager.isRTL) {
86
+ return numberWithSign.reverse();
87
+ }
88
+ return numberWithSign;
89
+ }, [formattedNumber, value, showPlusSign]);
90
+ var handleLayout = (0, react_1.useCallback)(function (e) {
91
+ if (e.nativeEvent.layout.height !== height) {
92
+ setHeight(e.nativeEvent.layout.height);
93
+ }
94
+ }, [height]);
95
+ return (react_1.default.createElement(react_native_reanimated_1.default.View, __assign({ layout: react_native_reanimated_1.LinearTransition, style: [styles.container, containerStyle] }, rest),
96
+ react_1.default.createElement(react_native_1.View, { style: styles.innerContainer, onLayout: handleLayout }, number.map(function (char, index) { return (react_1.default.createElement(AnimatedDigit_1.AnimatedDigit, { key: formattedNumber.length - index - 1, value: char, height: height, containerStyle: digitContainerStyle, textStyle: textStyle, numberTextProps: numberTextProps, commaTextProps: commaTextProps, dotTextProps: dotTextProps, compactNotationTextProps: compactNotationTextProps, signTextProps: signTextProps, numberStyle: numberStyle, commaStyle: commaStyle, dotStyle: dotStyle, compactNotationStyle: compactNotationStyle, signStyle: signStyle, spinningAnimationConfig: spinningAnimationConfig, animationCallback: animationCallback, animateToNewValue: animateToNewValue })); }))));
97
+ };
98
+ exports.AnimatedRollingNumber = AnimatedRollingNumber;
99
+ var styles = react_native_1.StyleSheet.create({
100
+ container: {
101
+ overflow: "hidden",
102
+ alignItems: "center",
103
+ justifyContent: "center",
104
+ },
105
+ innerContainer: {
106
+ flexDirection: "row",
107
+ alignItems: "center",
108
+ },
109
+ });
110
+ //# sourceMappingURL=AnimatedRollingNumber.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimatedRollingNumber.js","sourceRoot":"","sources":["../../src/components/AnimatedRollingNumber.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA8D;AAC9D,6CASsB;AACtB,iFAMiC;AACjC,iDAAmE;AACnE,kCAA+C;AAmE/C;;;GAGG;AACI,IAAM,qBAAqB,GAAyC,UAAC,EA6B3E;IA5BC,IAAA,KAAK,WAAA,EACL,qBAAoB,EAApB,aAAa,mBAAG,IAAI,KAAA,EACpB,oBAAoB,EAApB,YAAY,mBAAG,KAAK,KAAA,EACpB,OAAO,aAAA,EACP,mBAAmB,EAAnB,WAAW,mBAAG,KAAK,KAAA,EACnB,aAAa,mBAAA,EACb,cAAgB,EAAhB,MAAM,mBAAG,OAAO,KAAA,EAChB,qBAAqB,2BAAA,EACrB,cAAc,oBAAA,EACd,cAAc,oBAAA,EACd,2BAA0B,EAA1B,mBAAmB,mBAAG,IAAI,KAAA,EAC1B,mBAAmB,yBAAA,EACnB,eAAe,qBAAA,EACf,cAAc,oBAAA,EACd,YAAY,kBAAA,EACZ,wBAAwB,8BAAA,EACxB,aAAa,mBAAA,EACb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AAC;AACJ,CAAC,CAAC;AAjHW,QAAA,qBAAqB,yBAiHhC;AAEF,IAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;IACD,cAAc,EAAE;QACd,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;KACrB;CACF,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const NUMBER_ARRAY: any[];
2
+ export declare const COMPACT_NOTATIONS: string[];
3
+ export declare const DIGIT_VARIANTS: {
4
+ [key: string]: "dot" | "comma" | "sign" | "number" | "compact";
5
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DIGIT_VARIANTS = exports.COMPACT_NOTATIONS = exports.NUMBER_ARRAY = void 0;
4
+ exports.NUMBER_ARRAY = new Array(10).fill(0);
5
+ exports.COMPACT_NOTATIONS = ["K", "M", "B", "T"];
6
+ exports.DIGIT_VARIANTS = {
7
+ ".": "dot",
8
+ ",": "comma",
9
+ "-": "sign",
10
+ "+": "sign",
11
+ "0": "number",
12
+ "1": "number",
13
+ "2": "number",
14
+ "3": "number",
15
+ "4": "number",
16
+ "5": "number",
17
+ "6": "number",
18
+ "7": "number",
19
+ "8": "number",
20
+ "9": "number",
21
+ K: "compact",
22
+ M: "compact",
23
+ B: "compact",
24
+ T: "compact",
25
+ };
26
+ //# sourceMappingURL=index.js.map