react-native-nitro-input 0.3.0 → 0.3.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 (108) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +90 -2
  3. package/android/src/main/cpp/JReflowEngine.cpp +32 -0
  4. package/android/src/main/cpp/JReflowEngine.hpp +13 -0
  5. package/android/src/main/cpp/JRollingEngine.cpp +42 -2
  6. package/android/src/main/cpp/JRollingEngine.hpp +9 -1
  7. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatform.kt +76 -1
  8. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberView.kt +88 -0
  9. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroTextMeasure.kt +25 -0
  10. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroTextView.kt +140 -0
  11. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputPackage.kt +2 -1
  12. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroNumberView.kt +388 -136
  13. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroTextView.kt +868 -0
  14. package/android/src/main/java/com/margelo/nitro/nitroinput/ReflowEngine.kt +21 -0
  15. package/android/src/main/java/com/margelo/nitro/nitroinput/RollingEngine.kt +13 -2
  16. package/cpp/RollingEngine.cpp +92 -8
  17. package/cpp/RollingEngine.hpp +36 -2
  18. package/ios/HybridNitroNumberFormatPlatform.swift +87 -9
  19. package/ios/HybridNitroNumberView.swift +82 -1
  20. package/ios/HybridNitroTextView.swift +134 -0
  21. package/ios/NitroNumberView.swift +368 -135
  22. package/ios/NitroTextView.swift +583 -0
  23. package/lib/commonjs/nitrogen/generated/shared/json/NitroNumberViewConfig.json +20 -0
  24. package/lib/commonjs/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
  25. package/lib/commonjs/src/NitroNumber.js +52 -3
  26. package/lib/commonjs/src/NitroText.js +138 -0
  27. package/lib/commonjs/src/NitroTime.js +65 -0
  28. package/lib/commonjs/src/formatProps.js +76 -16
  29. package/lib/commonjs/src/index.js +6 -1
  30. package/lib/commonjs/src/specs/NitroText.nitro.js +2 -0
  31. package/lib/module/nitrogen/generated/shared/json/NitroNumberViewConfig.json +20 -0
  32. package/lib/module/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
  33. package/lib/module/src/NitroNumber.js +53 -4
  34. package/lib/module/src/NitroText.js +98 -0
  35. package/lib/module/src/NitroTime.js +29 -0
  36. package/lib/module/src/formatProps.js +76 -17
  37. package/lib/module/src/index.js +2 -0
  38. package/lib/module/src/specs/NitroText.nitro.js +1 -0
  39. package/lib/typescript/src/NitroNumber.d.ts +79 -1
  40. package/lib/typescript/src/NitroText.d.ts +67 -0
  41. package/lib/typescript/src/NitroTime.d.ts +19 -0
  42. package/lib/typescript/src/formatProps.d.ts +30 -4
  43. package/lib/typescript/src/index.d.ts +4 -1
  44. package/lib/typescript/src/specs/NitroNumber.nitro.d.ts +67 -0
  45. package/lib/typescript/src/specs/NitroText.nitro.d.ts +60 -0
  46. package/nitro.json +20 -0
  47. package/nitrogen/generated/android/NitroInput+autolinking.cmake +6 -0
  48. package/nitrogen/generated/android/NitroInputOnLoad.cpp +34 -0
  49. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.cpp +243 -0
  50. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.hpp +40 -0
  51. package/nitrogen/generated/android/c++/JHybridNitroTextMeasureSpec.cpp +58 -0
  52. package/nitrogen/generated/android/c++/JHybridNitroTextMeasureSpec.hpp +64 -0
  53. package/nitrogen/generated/android/c++/JHybridNitroTextViewSpec.cpp +253 -0
  54. package/nitrogen/generated/android/c++/JHybridNitroTextViewSpec.hpp +104 -0
  55. package/nitrogen/generated/android/c++/JNitroNumberShimmerDirection.hpp +61 -0
  56. package/nitrogen/generated/android/c++/JNitroNumberSignDisplay.hpp +67 -0
  57. package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.cpp +100 -0
  58. package/nitrogen/generated/android/c++/views/JHybridNitroTextViewStateUpdater.cpp +174 -0
  59. package/nitrogen/generated/android/c++/views/JHybridNitroTextViewStateUpdater.hpp +54 -0
  60. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberViewSpec.kt +136 -0
  61. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroTextMeasureSpec.kt +60 -0
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroTextViewSpec.kt +179 -0
  63. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberShimmerDirection.kt +24 -0
  64. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberSignDisplay.kt +26 -0
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroTextViewManager.kt +96 -0
  66. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroTextViewStateUpdater.kt +23 -0
  67. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.cpp +34 -0
  68. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.hpp +132 -11
  69. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Umbrella.hpp +16 -0
  70. package/nitrogen/generated/ios/NitroInputAutolinking.mm +16 -0
  71. package/nitrogen/generated/ios/NitroInputAutolinking.swift +24 -0
  72. package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.hpp +146 -0
  73. package/nitrogen/generated/ios/c++/HybridNitroTextMeasureSpecSwift.cpp +11 -0
  74. package/nitrogen/generated/ios/c++/HybridNitroTextMeasureSpecSwift.hpp +90 -0
  75. package/nitrogen/generated/ios/c++/HybridNitroTextViewSpecSwift.cpp +11 -0
  76. package/nitrogen/generated/ios/c++/HybridNitroTextViewSpecSwift.hpp +233 -0
  77. package/nitrogen/generated/ios/c++/views/HybridNitroNumberViewComponent.mm +120 -0
  78. package/nitrogen/generated/ios/c++/views/HybridNitroTextViewComponent.mm +264 -0
  79. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec.swift +20 -0
  80. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec_cxx.swift +493 -0
  81. package/nitrogen/generated/ios/swift/HybridNitroTextMeasureSpec.swift +56 -0
  82. package/nitrogen/generated/ios/swift/HybridNitroTextMeasureSpec_cxx.swift +150 -0
  83. package/nitrogen/generated/ios/swift/HybridNitroTextViewSpec.swift +75 -0
  84. package/nitrogen/generated/ios/swift/HybridNitroTextViewSpec_cxx.swift +608 -0
  85. package/nitrogen/generated/ios/swift/NitroNumberShimmerDirection.swift +44 -0
  86. package/nitrogen/generated/ios/swift/NitroNumberSignDisplay.swift +52 -0
  87. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.cpp +40 -0
  88. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.hpp +46 -0
  89. package/nitrogen/generated/shared/c++/HybridNitroTextMeasureSpec.cpp +22 -0
  90. package/nitrogen/generated/shared/c++/HybridNitroTextMeasureSpec.hpp +63 -0
  91. package/nitrogen/generated/shared/c++/HybridNitroTextViewSpec.cpp +62 -0
  92. package/nitrogen/generated/shared/c++/HybridNitroTextViewSpec.hpp +115 -0
  93. package/nitrogen/generated/shared/c++/NitroNumberShimmerDirection.hpp +80 -0
  94. package/nitrogen/generated/shared/c++/NitroNumberSignDisplay.hpp +88 -0
  95. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.cpp +40 -0
  96. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.hpp +62 -0
  97. package/nitrogen/generated/shared/c++/views/HybridNitroTextViewComponent.cpp +74 -0
  98. package/nitrogen/generated/shared/c++/views/HybridNitroTextViewComponent.hpp +149 -0
  99. package/nitrogen/generated/shared/json/NitroNumberViewConfig.json +20 -0
  100. package/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
  101. package/package.json +1 -1
  102. package/src/NitroNumber.tsx +183 -9
  103. package/src/NitroText.tsx +166 -0
  104. package/src/NitroTime.tsx +68 -0
  105. package/src/formatProps.ts +108 -18
  106. package/src/index.ts +5 -0
  107. package/src/specs/NitroNumber.nitro.ts +69 -0
  108. package/src/specs/NitroText.nitro.ts +65 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.1
4
+
5
+ - **Signs**: `signDisplay` (`'auto'`, `'always'`, `'exceptZero'`,
6
+ `'negative'`, `'never'`, as `Intl.NumberFormat`'s) puts a plus on gains,
7
+ and a plus that turns into a minus swaps like any other glyph; `plusSign`
8
+ and `minusSign` set the glyphs. A `format` gives its sign display and its
9
+ locale's minus.
10
+ - **Styled parts**: `prefixColor`, `suffixColor`, and `fractionFontSize`,
11
+ `fractionColor` and `fractionAlign` for smaller, dimmer or superscript
12
+ cents.
13
+ - **`onAnimationStart` / `onAnimationEnd`**: when the figure sets off from
14
+ rest and when it comes to rest, once for a run of changes.
15
+ - **`NitroTime`**: seconds as a clock, timer or countdown (`m:ss`,
16
+ `h:mm:ss`…), its tens of seconds and minutes wrapping after 5 so 0:59 →
17
+ 1:00 turns them one step. Built on `digits` (the highest digit a position
18
+ shows before it wraps, as NumberFlow's) and `groupingSizes`, both open to
19
+ any figure.
20
+ - **Compact figures**: a compact `format` rolls the figure it shows and swaps
21
+ its suffix ("950" → "1.5K" → "2.3M").
22
+ - **`continuous`**: the wheels below the highest one that changes turn a full
23
+ turn too, so a roll seems to pass through every value between.
24
+ - **Native digits and grouping**: `digitGlyphs` and `groupingSizes`, or a
25
+ `format`'s numbering system and group sizes (`ar-EG`'s ٠١٢٣…, `en-IN`'s
26
+ 12,34,567).
27
+ - **`animated={false}`** shows every change at once, and
28
+ **`respectReduceMotion={false}`** animates under Reduce Motion.
29
+ - **`NitroText`**: a single line of text that morphs natively, shared
30
+ characters gliding to their new places ("Sign in" → "Signing in…",
31
+ "$1,204" → "$1,318"), as Torph does on the web. Its own native view: one
32
+ draw of cached glyphs at rest like a label, sized by a synchronous native
33
+ measurement in the render that mounts it, with the loading shimmer and its
34
+ options. Only the props you set cross to native, a static label never
35
+ touches the reflow engine, and a reused view keeps its drawn line: 1000
36
+ labels mount in 113 ms of main thread on an iPhone 11 Pro and 510 ms on a
37
+ Galaxy A22 (`Text`: 140 and 790, `react-native-plain-text`: 112 and 620).
38
+ - **Shimmer options**: `shimmerAngle`, `shimmerWidth`, `shimmerBaseColor`
39
+ (a skeleton), `shimmerDirection` (following the layout direction by
40
+ default, so a right-to-left layout now sweeps right to left) and
41
+ `shimmerDelay`.
42
+ - Fixed: on iOS the loading glint was drawn in the label colour (black
43
+ on dark text, so invisible) unless `shimmerColor` was given; it uses the
44
+ documented light neutral now.
45
+ - Fixed: `NumberFormat` with `notation: 'compact'` dropped the currency and
46
+ the percent sign ("950" for "$950"; Android printed a compact currency in
47
+ full) and signDisplay's plus. It prints them as V8 does now.
48
+ - Android: `NitroText` crosses JNI to the reflow engine once per text
49
+ change and once per frame, rather than once per character and several
50
+ times a frame.
51
+
3
52
  ## 0.3.0
4
53
 
5
54
  - **`NumberFormat`**: `Intl.NumberFormat`'s API, formatted natively.
package/README.md CHANGED
@@ -541,6 +541,13 @@ ticker), or SwiftUI's `.contentTransition(.numericText())`, or a scramble.
541
541
  - A currency switch plays as one change: prefix, suffix and separators blur
542
542
  across, decimal columns open and close, the digits swap or roll.
543
543
  - `animateTo` / `jumpTo` on the Nitro object work from a Reanimated worklet.
544
+ - Signs (`signDisplay`: a plus on gains that swaps into the minus), styled
545
+ affixes and cents (`prefixColor`, `fractionFontSize`, superscript
546
+ `fractionAlign`), native digits and grouping (`ar-EG`'s ٠١٢٣, `en-IN`'s
547
+ 12,34,567), compact figures that roll ("950" → "1.5K"), `continuous` rolls,
548
+ and `onAnimationStart` / `onAnimationEnd`.
549
+ - `NitroTime` shows seconds as a clock, timer or countdown whose tens wrap
550
+ after 5, as a clock's wheels do.
544
551
 
545
552
  Guide: **https://ronickg.github.io/react-native-nitro-input/docs/nitro-number**
546
553
 
@@ -726,6 +733,24 @@ Hand the final value back to React when the feed stops (`scheduleOnRN`) so the
726
733
  `value` prop matches the screen; posting every tick queues them up while JS is
727
734
  busy and replays them afterwards.
728
735
 
736
+ ### Clocks and timers
737
+
738
+ `NitroTime` is a `NitroNumber` with a number of seconds as its figure. The tens
739
+ of seconds and of minutes wrap after 5, so 0:59 → 1:00 turns them one step
740
+ instead of rolling back through 4, 3, 2, 1.
741
+
742
+ ```tsx
743
+ import { NitroTime } from 'react-native-nitro-input'
744
+
745
+ <NitroTime seconds={elapsed} /> // 12:07
746
+ <NitroTime seconds={remaining} timeFormat="h:mm:ss" /> // 1:00:05
747
+ ```
748
+
749
+ `timeFormat` is `'m:ss'` (the default; minutes run past 59), `'mm:ss'`,
750
+ `'h:mm:ss'` or `'hh:mm:ss'`; `separator` defaults to `':'`. Every other
751
+ `NitroNumber` prop applies. The wheels are open to any figure through `digits`
752
+ (a position's highest digit) and `groupingSizes`.
753
+
729
754
  ## NitroNumber props
730
755
 
731
756
  | Prop | Type | Default | Description |
@@ -733,9 +758,18 @@ busy and replays them afterwards.
733
758
  | `value` | `number` | – | The number to display. Shown with at most 18 digits: `|value| × 10^fractionDigits` is clamped at 10^17, and a JS number carries exact integers only up to 2^53. |
734
759
  | `fractionDigits` | `number` | `0` | Digits after the decimal separator. |
735
760
  | `minimumIntegerDigits` | `number` | `1` | Zero-pads the integer part. |
736
- | `groupingSeparator` | `string` | `''` | Inserted every three integer digits. |
761
+ | `groupingSeparator` | `string` | `''` | Inserted between digit groups. |
762
+ | `groupingSizes` | `number[]` | `[3]` | Group sizes from the decimal point: `[3, 2]` is Indian grouping (12,34,567). |
737
763
  | `decimalSeparator` | `string` | `'.'` | Between integer and fraction digits. |
738
764
  | `prefix` / `suffix` | `string` | `''` | Static text around the number. |
765
+ | `signDisplay` | `'auto' \| 'always' \| 'exceptZero' \| 'negative' \| 'never'` | `'auto'` | Which values carry a sign; `'exceptZero'` puts a plus on gains, and a plus that turns into a minus swaps. |
766
+ | `plusSign` / `minusSign` | `string` | `'+'` / `'-'` | The sign glyphs (e.g. `'−'`, U+2212). |
767
+ | `digitGlyphs` | `string[]` | `'0'`…`'9'` | Ten glyphs for native digits (Arabic-Indic, Devanagari…). |
768
+ | `digits` | `Record<number, { max }>` | – | The highest digit a position shows before it wraps (a clock's tens: `{ 1: { max: 5 } }`). |
769
+ | `continuous` | `boolean` | `false` | Rolls turn the lower wheels a full turn too, so the figure seems to pass through every value. |
770
+ | `animated` | `boolean` | `true` | `false` shows every change at once. |
771
+ | `respectReduceMotion` | `boolean` | `true` | Snap while the system's Reduce Motion is on. |
772
+ | `onAnimationStart` / `onAnimationEnd` | `() => void` / `(value) => void` | – | The figure set off from rest / came to rest, once for a run of changes. |
739
773
  | `duration` | `number` | `500` | Roll duration in ms; `0` snaps. |
740
774
  | `easing` | `'linear' \| 'easeIn' \| 'easeOut' \| 'easeInOut' \| 'spring'` | `'easeInOut'` | Roll timing curve. A value that arrives while the wheels are still rolling continues with the ease-out half of the curve, so rapid updates never stall. |
741
775
  | `bounce` | `number` | `0.15` | Overshoot of the `spring` easing (0–1). |
@@ -758,6 +792,11 @@ busy and replays them afterwards.
758
792
  | `loading` | `boolean` | `false` | "Shine" glint: a slanted, text-wide band sweeps through the ink; cross-fades on toggle. |
759
793
  | `shimmerColor` | `ColorValue` | light neutral | Color of the glint's core (`#D6D9E1`, `#2B2E37` in dark mode). |
760
794
  | `shimmerDuration` | `number` | `950` | ms per sweep (linear, repeating). |
795
+ | `shimmerAngle` | `number` | `31` | The band's slant in degrees (0 upright). |
796
+ | `shimmerWidth` | `number` | `1` | The band's width, a fraction of the number's. |
797
+ | `shimmerBaseColor` | `ColorValue` | `color` | The glyphs' colour outside the band: a skeleton. |
798
+ | `shimmerDirection` | `'auto' \| 'ltr' \| 'rtl'` | `'auto'` | Sweep direction; `'auto'` follows the layout direction. |
799
+ | `shimmerDelay` | `number` | `0` | ms of pause after each sweep. |
761
800
  | `fontSize` | `number` | `32` | Font size of the digits in points. |
762
801
  | `prefixFontSize` / `suffixFontSize` | `number` | `fontSize` | Smaller (or larger) prefix/suffix, e.g. a currency symbol or code. |
763
802
  | `affixAlign` | `'baseline' \| 'center' \| 'top' \| 'bottom'` | `'baseline'` | How prefix/suffix line up with the digits: `top` pins the glyph tops (cap height), `bottom` the bottom of the glyphs' ink (a currency code sits on the digits' baseline, not down where a comma's tail reaches). |
@@ -765,7 +804,10 @@ busy and replays them afterwards.
765
804
  | `letterSpacing` | number | `0` | Points added after every glyph, like `Text`'s; a smaller affix gets it in proportion to its size. |
766
805
  | `prefixSpacing` / `suffixSpacing` | number | the letter spacing | Points between the prefix and the digits, and between the digits and the suffix. |
767
806
  | `prefixOffset` / `suffixOffset` | number | `0` | Points an affix is moved down after its alignment (negative: up). |
768
- | `format` | `NumberFormat` | none | The number follows it: prefix and suffix, separators, fraction and minimum integer digits. The individual props override it. |
807
+ | `prefixColor` / `suffixColor` | `ColorValue` | `color` | The affixes' colours. |
808
+ | `fractionFontSize` / `fractionColor` | `number` / `ColorValue` | `fontSize` / `color` | Smaller, dimmer cents (the decimal separator follows). |
809
+ | `fractionAlign` | `'baseline' \| 'center' \| 'top' \| 'bottom'` | `'baseline'` | `'top'`: superscript cents. |
810
+ | `format` | `NumberFormat` | none | The number follows it: prefix and suffix, separators and group sizes, fraction and minimum integer digits, sign display, native digits; a compact format rolls its figure and swaps its suffix ("950" → "1.5K"). The individual props override it. |
769
811
  | `tabularNums` | boolean | `true` | `false` lays each digit out at its own width (proportional figures); a changing column eases once from the old digit's width to the new one's. |
770
812
  | `adjustsFontSizeToFit` | `boolean` | `false` | Shrink the whole number to fit the view's fixed `width`; the view keeps its full height. |
771
813
  | `minimumFontScale` | `number` | `0.5` | Lower bound for `adjustsFontSizeToFit`. |
@@ -782,6 +824,44 @@ The view reports its intrinsic size from native and sizes itself. Give it an
782
824
  explicit `width` in `style` plus `textAlign="right"` if you don't want the layout
783
825
  to reflow while digits appear (e.g. a counter that grows past `999`).
784
826
 
827
+ ## NitroText
828
+
829
+ A single line of text that morphs to the next, natively: the characters two
830
+ strings share glide to their new places and the rest fade, as
831
+ [Torph](https://torph.lochie.me) does on the web. Digits match by place, so
832
+ "Total $1,204" → "Total $1,318" rolls the hundreds and tens.
833
+
834
+ ```tsx
835
+ import { NitroText } from 'react-native-nitro-input'
836
+
837
+ <NitroText fontSize={17} fontWeight="600">{busy ? 'Signing in…' : 'Sign in'}</NitroText>
838
+ ```
839
+
840
+ It is its own native view, not a text field: at rest it draws its line in one
841
+ pass, like a label, and only a morph draws each character on its own. It
842
+ measures its text natively while it renders, so it lays out in the commit that
843
+ mounts it, and only the props you set cross to native. Mounting 1000 labels
844
+ (Release, into reused views) costs about what `react-native-plain-text` does
845
+ and less than `Text`: 113 ms of main thread on an iPhone 11 Pro (PlainText
846
+ 112, Text 140) and 510 ms on a Galaxy A22 (PlainText 620, Text 790). A label
847
+ that never changes never touches the morph engine.
848
+
849
+ | Prop | Default | |
850
+ | --- | --- | --- |
851
+ | `children` | – | The text: a string or a number. A change morphs to it. |
852
+ | `fontSize` / `fontWeight` / `fontFamily` | `17` / `'normal'` / system | As `Text`'s. Digits are tabular, so a column keeps its width while it morphs. |
853
+ | `color` | label colour | |
854
+ | `letterSpacing` | `0` | Points after every character. |
855
+ | `textAlign` | `'auto'` | `'left'`, `'center'` or `'right'` in a wider view; `'auto'` is the start edge. |
856
+ | `allowFontScaling` / `maxFontSizeMultiplier` | `false` / none | Scale with the system text size, like `Text`. |
857
+ | `duration` / `easing` / `bounce` / `effect` | `400` / `'expo'` / `0.15` / `'auto'` | The morph's timing, as the [reflow](#how-the-reflow-decides-what-moves)'s. |
858
+ | `respectReduceMotion` | `true` | Snap while Reduce Motion (iOS) or "Remove animations" (Android) is on. |
859
+ | `loading` and `shimmer*` | `false` | The loading glint, with every option of `NitroNumber`'s. |
860
+
861
+ It is one line (no wrapping). Scripts that shape by context (Arabic, Indic)
862
+ and characters from fallback fonts (emoji, CJK) are drawn as strings, so they
863
+ render correctly, but they are laid out character by character.
864
+
785
865
  ## Accessibility and threading
786
866
 
787
867
  ### NitroInput
@@ -797,6 +877,14 @@ to reflow while digits appear (e.g. a counter that grows past `999`).
797
877
  `mostRecentEventCount` (the user typed since) is ignored, like React
798
878
  Native's own `TextInput`.
799
879
 
880
+ ### NitroText
881
+
882
+ - The view is the accessibility element, read as text with its string (and
883
+ "loading" while the shimmer runs); an `accessibilityLabel` replaces it.
884
+ - Reduce Motion (iOS) and "Remove animations" (Android) snap a morph.
885
+ - The view implements `RecyclableView`: a reused view keeps its drawn line, so
886
+ an element with the same text and style draws nothing.
887
+
800
888
  ### NitroNumber
801
889
 
802
890
  - VoiceOver / TalkBack read the formatted amount (prefix, sign, grouped digits,
@@ -5,6 +5,8 @@
5
5
 
6
6
  #include "JReflowEngine.hpp"
7
7
 
8
+ #include <algorithm>
9
+
8
10
  namespace margelo::nitro::nitroinput {
9
11
 
10
12
  jni::local_ref<JReflowEngine::jhybriddata> JReflowEngine::initHybrid(jni::alias_ref<jhybridobject>) {
@@ -31,6 +33,8 @@ void JReflowEngine::registerNatives() {
31
33
  makeNativeMethod("caretX", JReflowEngine::caretX),
32
34
  makeNativeMethod("reset", JReflowEngine::reset),
33
35
  makeNativeMethod("frameInto", JReflowEngine::frameInto),
36
+ makeNativeMethod("commitLine", JReflowEngine::commitLine),
37
+ makeNativeMethod("tickInto", JReflowEngine::tickInto),
34
38
  });
35
39
  }
36
40
 
@@ -129,4 +133,32 @@ int JReflowEngine::frameInto(jni::alias_ref<jni::JArrayDouble> out) {
129
133
  return static_cast<int>(needed);
130
134
  }
131
135
 
136
+ bool JReflowEngine::commitLine(jni::alias_ref<jni::JArrayInt> characters, jni::alias_ref<jni::JArrayInt> kinds,
137
+ jni::alias_ref<jni::JArrayDouble> widths, int count, int role, bool reduceMotion,
138
+ int caret, double now) {
139
+ const size_t n = static_cast<size_t>(std::max(0, count));
140
+ lineChars_.resize(n);
141
+ lineKinds_.resize(n);
142
+ lineWidths_.resize(n);
143
+ if (n > 0) {
144
+ characters->getRegion(0, static_cast<jsize>(n), lineChars_.data());
145
+ kinds->getRegion(0, static_cast<jsize>(n), lineKinds_.data());
146
+ widths->getRegion(0, static_cast<jsize>(n), lineWidths_.data());
147
+ }
148
+ engine_.setReduceMotion(reduceMotion);
149
+ engine_.beginText();
150
+ for (size_t i = 0; i < n; ++i) {
151
+ engine_.addGlyph(static_cast<uint32_t>(lineChars_[i]), role, lineKinds_[i], lineWidths_[i], false);
152
+ }
153
+ engine_.commitText(caret, now);
154
+ return engine_.needsFrames();
155
+ }
156
+
157
+ int JReflowEngine::tickInto(double now, jni::alias_ref<jni::JArrayDouble> out) {
158
+ engine_.tick(now);
159
+ const int written = frameInto(out);
160
+ const int more = engine_.needsFrames() ? kMoreFrames : 0;
161
+ return written < 0 ? -1 : (written | more);
162
+ }
163
+
132
164
  } // namespace margelo::nitro::nitroinput
@@ -43,12 +43,25 @@ public:
43
43
  /// without allocating once warm; returns the number of doubles written, or
44
44
  /// -1 if `out` is too small.
45
45
  int frameInto(jni::alias_ref<jni::JArrayDouble> out);
46
+ /// A whole line in one crossing: `setReduceMotion`, `beginText`, an
47
+ /// `addGlyph` per character (in `role`, never a placeholder) and
48
+ /// `commitText`. Returns `needsFrames()`.
49
+ bool commitLine(jni::alias_ref<jni::JArrayInt> characters, jni::alias_ref<jni::JArrayInt> kinds,
50
+ jni::alias_ref<jni::JArrayDouble> widths, int count, int role, bool reduceMotion, int caret, double now);
51
+ /// `tick` and `frameInto` in one crossing: the number of doubles written
52
+ /// (or -1 if `out` is too small, after ticking), plus `kMoreFrames` while
53
+ /// the engine still needs frames.
54
+ int tickInto(double now, jni::alias_ref<jni::JArrayDouble> out);
55
+ static constexpr int kMoreFrames = 1 << 30;
46
56
 
47
57
  private:
48
58
  friend HybridBase;
49
59
  JReflowEngine() = default;
50
60
  ReflowEngine engine_;
51
61
  std::vector<double> scratch_;
62
+ std::vector<jint> lineChars_;
63
+ std::vector<jint> lineKinds_;
64
+ std::vector<double> lineWidths_;
52
65
  };
53
66
 
54
67
  } // namespace margelo::nitro::nitroinput
@@ -20,6 +20,13 @@ void JRollingEngine::registerNatives() {
20
20
  makeNativeMethod("setFlash", JRollingEngine::setFlash),
21
21
  makeNativeMethod("setPopOnChange", JRollingEngine::setPopOnChange),
22
22
  makeNativeMethod("setReduceMotion", JRollingEngine::setReduceMotion),
23
+ makeNativeMethod("setContinuous", JRollingEngine::setContinuous),
24
+ makeNativeMethod("setDigitMax", JRollingEngine::setDigitMax),
25
+ makeNativeMethod("clearDigitMax", JRollingEngine::clearDigitMax),
26
+ makeNativeMethod("wheelModulus", JRollingEngine::wheelModulus),
27
+ makeNativeMethod("setSignDisplay", JRollingEngine::setSignDisplay),
28
+ makeNativeMethod("signPositive", JRollingEngine::signPositive),
29
+ makeNativeMethod("signFactor", JRollingEngine::signFactor),
23
30
  makeNativeMethod("changeText", JRollingEngine::changeText),
24
31
  makeNativeMethod("changeFormat", JRollingEngine::changeFormat),
25
32
  makeNativeMethod("setValue", JRollingEngine::setValue),
@@ -73,6 +80,34 @@ void JRollingEngine::setReduceMotion(bool reduceMotion) {
73
80
  engine_.setReduceMotion(reduceMotion);
74
81
  }
75
82
 
83
+ void JRollingEngine::setContinuous(bool continuous) {
84
+ engine_.setContinuous(continuous);
85
+ }
86
+
87
+ void JRollingEngine::setDigitMax(int power, int max) {
88
+ engine_.setDigitMax(power, max);
89
+ }
90
+
91
+ void JRollingEngine::clearDigitMax() {
92
+ engine_.clearDigitMax();
93
+ }
94
+
95
+ int JRollingEngine::wheelModulus(int index) {
96
+ return engine_.wheelModulus(index);
97
+ }
98
+
99
+ void JRollingEngine::setSignDisplay(int mode) {
100
+ engine_.setSignDisplay(mode);
101
+ }
102
+
103
+ bool JRollingEngine::signPositive() {
104
+ return engine_.signPositive();
105
+ }
106
+
107
+ double JRollingEngine::signFactor() {
108
+ return engine_.signFactor();
109
+ }
110
+
76
111
  void JRollingEngine::changeText(int slot, double now) {
77
112
  engine_.changeText(slot, now);
78
113
  }
@@ -153,12 +188,15 @@ int JRollingEngine::frameInto(jni::alias_ref<jni::JArrayDouble> out) {
153
188
  const auto& wheels = engine_.wheels();
154
189
  const size_t count = wheels.size();
155
190
  constexpr size_t kMaxWheels = 32;
191
+ // Doubles per wheel: the engine's `Wheel`, then the places it wraps after
192
+ // (`wheelModulus`: 10, or fewer on a clock's wheel).
193
+ constexpr size_t kWheelFields = 15;
156
194
  // Then each text slot's swap (`RollingEngine::changeText`): grow, focus,
157
195
  // blurOut, active.
158
196
  // Then the decimal columns laid out and the decimal separator's factor.
159
197
  constexpr size_t kText = RollingEngine::kTextSlots * 4 + 2;
160
- double data[4 + kMaxWheels * 14 + kText];
161
- const size_t needed = 4 + count * 14 + kText;
198
+ double data[4 + kMaxWheels * kWheelFields + kText];
199
+ const size_t needed = 4 + count * kWheelFields + kText;
162
200
  if (count > kMaxWheels || static_cast<size_t>(out->size()) < needed) {
163
201
  return -1;
164
202
  }
@@ -167,6 +205,7 @@ int JRollingEngine::frameInto(jni::alias_ref<jni::JArrayDouble> out) {
167
205
  data[2] = engine_.revealScale();
168
206
  data[3] = static_cast<double>(count);
169
207
  size_t i = 4;
208
+ int index = 0;
170
209
  for (const auto& w : wheels) {
171
210
  data[i++] = w.position;
172
211
  data[i++] = w.width;
@@ -182,6 +221,7 @@ int JRollingEngine::frameInto(jni::alias_ref<jni::JArrayDouble> out) {
182
221
  data[i++] = w.grow;
183
222
  data[i++] = w.blurOut;
184
223
  data[i++] = w.progress;
224
+ data[i++] = static_cast<double>(engine_.wheelModulus(index++));
185
225
  }
186
226
  for (int slot = 0; slot < RollingEngine::kTextSlots; slot++) {
187
227
  const RollingEngine::TextChange t = engine_.textChange(slot);
@@ -28,6 +28,13 @@ public:
28
28
  void setFlash(double seconds);
29
29
  void setPopOnChange(double overshoot);
30
30
  void setReduceMotion(bool reduceMotion);
31
+ void setContinuous(bool continuous);
32
+ void setDigitMax(int power, int max);
33
+ void clearDigitMax();
34
+ int wheelModulus(int index);
35
+ void setSignDisplay(int mode);
36
+ bool signPositive();
37
+ double signFactor();
31
38
  void changeText(int slot, double now);
32
39
  void changeFormat(int fractionDigits, int minimumIntegerDigits, double now);
33
40
  void setValue(double value);
@@ -49,7 +56,8 @@ public:
49
56
  double revealMilestoneValue(int index);
50
57
  /// Writes the render state into `out` without allocating:
51
58
  /// `[signFactor, loadingProgress, revealScale, wheelCount, then (position,
52
- /// width, linear, blankZero) per wheel]`. Returns the number of doubles
59
+ /// width, linear, blankZero, …, progress, modulus) per wheel]`, then the
60
+ /// text slots and the decimal columns. Returns the number of doubles
53
61
  /// written, or -1 if `out` is too small.
54
62
  int frameInto(jni::alias_ref<jni::JArrayDouble> out);
55
63
  double shimmerPhase(double now, double periodSeconds);
@@ -1,5 +1,10 @@
1
1
  package com.margelo.nitro.nitroinput
2
2
 
3
+ import android.icu.number.LocalizedNumberFormatter
4
+ import android.icu.number.Notation
5
+ import android.icu.number.NumberFormatter
6
+ import android.icu.number.Precision
7
+ import android.icu.number.Scale
3
8
  import android.icu.text.CompactDecimalFormat
4
9
  import android.icu.text.DecimalFormat
5
10
  import android.icu.text.DecimalFormatSymbols
@@ -71,6 +76,13 @@ class HybridNitroPlatformNumberFormatter(o: NumberFormatPlatformOptions) : Hybri
71
76
  private val measureFormat: MeasureFormat?
72
77
  /** `unit: 'percent'`, which MeasureFormat prints without its sign: a percent formatter that does not multiply. */
73
78
  private val percentUnit: NumberFormat?
79
+ /**
80
+ * Compact notation with a currency or a percent, or a signDisplay plus:
81
+ * CompactDecimalFormat prints bare numbers ("1.5K" for "$1.5K"). Android 11+
82
+ * has ICU's number formatter, which prints the locale's compact patterns;
83
+ * before it, the compact number goes inside the style's own affixes.
84
+ */
85
+ private val compact: ((BigDecimal) -> String)?
74
86
  override val symbols: NumberFormatPlatformSymbols
75
87
 
76
88
  init {
@@ -84,7 +96,7 @@ class HybridNitroPlatformNumberFormatter(o: NumberFormatPlatformOptions) : Hybri
84
96
  else -> if (o.currencySign == NumberFormatCurrencySign.ACCOUNTING) NumberFormat.ACCOUNTINGCURRENCYSTYLE else NumberFormat.CURRENCYSTYLE
85
97
  }
86
98
  format = when {
87
- o.notation == NumberFormatNotation.COMPACT && o.style != NumberFormatStyle.CURRENCY -> CompactDecimalFormat.getInstance(
99
+ o.notation == NumberFormatNotation.COMPACT -> CompactDecimalFormat.getInstance(
88
100
  locale,
89
101
  if (o.compactDisplay == NumberFormatCompactDisplay.LONG) CompactDecimalFormat.CompactStyle.LONG else CompactDecimalFormat.CompactStyle.SHORT,
90
102
  )
@@ -141,6 +153,26 @@ class HybridNitroPlatformNumberFormatter(o: NumberFormatPlatformOptions) : Hybri
141
153
  }
142
154
  }
143
155
 
156
+ compact = if (o.notation != NumberFormatNotation.COMPACT) {
157
+ null
158
+ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
159
+ modernCompact(o, locale)
160
+ } else if (o.style == NumberFormatStyle.CURRENCY || o.style == NumberFormatStyle.PERCENT) {
161
+ // The style's own pattern around the compact number: "$" + "1.5K", "1.2M" + "%".
162
+ val pattern = NumberFormat.getInstance(locale, if (o.style == NumberFormatStyle.PERCENT) NumberFormat.PERCENTSTYLE else currencyStyle) as DecimalFormat
163
+ if (o.style == NumberFormatStyle.CURRENCY && code != null) pattern.currency = Currency.getInstance(code)
164
+ val plus = o.signDisplay == NumberFormatSignDisplay.ALWAYS || o.signDisplay == NumberFormatSignDisplay.EXCEPTZERO
165
+ val positivePrefix = (if (plus) pattern.decimalFormatSymbols.plusSign.toString() else "") + pattern.positivePrefix
166
+ val scale = if (o.style == NumberFormatStyle.PERCENT) 100 else 1
167
+ val number = format
168
+ { value ->
169
+ val body = number.format(value.abs().multiply(BigDecimal(scale)))
170
+ if (value.signum() < 0) pattern.negativePrefix + body + pattern.negativeSuffix else positivePrefix + body + pattern.positiveSuffix
171
+ }
172
+ } else {
173
+ null
174
+ }
175
+
144
176
  if (o.style == NumberFormatStyle.UNIT && o.unit == "percent") {
145
177
  percentUnit = (NumberFormat.getInstance(locale, NumberFormat.PERCENTSTYLE) as DecimalFormat).also { p ->
146
178
  p.multiplier = 1
@@ -192,6 +224,7 @@ class HybridNitroPlatformNumberFormatter(o: NumberFormatPlatformOptions) : Hybri
192
224
 
193
225
  @Synchronized
194
226
  override fun format(value: Double): String {
227
+ compact?.let { if (value.isFinite()) return it(BigDecimal(value)) }
195
228
  percentUnit?.let { return it.format(value) }
196
229
  val measure = measureFormat
197
230
  return if (measure != null) measure.format(Measure(value, unit)) else format.format(value)
@@ -202,8 +235,50 @@ class HybridNitroPlatformNumberFormatter(o: NumberFormatPlatformOptions) : Hybri
202
235
  if (value == "NaN") return format(Double.NaN)
203
236
  if (value.endsWith("Infinity")) return format(if (value.startsWith("-")) Double.NEGATIVE_INFINITY else Double.POSITIVE_INFINITY)
204
237
  val number = BigDecimal(value)
238
+ compact?.let { return it(number) }
205
239
  percentUnit?.let { return it.format(number) }
206
240
  val measure = measureFormat
207
241
  return if (measure != null) measure.format(Measure(number, unit)) else format.format(number)
208
242
  }
243
+
244
+ private companion object {
245
+ /** ICU's number formatter (Android 11+): compact currency, percent and signs as CLDR writes them. */
246
+ @androidx.annotation.RequiresApi(Build.VERSION_CODES.R)
247
+ fun modernCompact(o: NumberFormatPlatformOptions, locale: ULocale): (BigDecimal) -> String {
248
+ var f: LocalizedNumberFormatter = NumberFormatter.withLocale(locale)
249
+ .notation(if (o.compactDisplay == NumberFormatCompactDisplay.LONG) Notation.compactLong() else Notation.compactShort())
250
+ // Compact numbers group from five digits ("9876", "12,345"): ECMA-402's
251
+ // default for compact notation is "min2", which is what this receives as true.
252
+ .grouping(if (o.useGrouping) NumberFormatter.GroupingStrategy.MIN2 else NumberFormatter.GroupingStrategy.OFF)
253
+ f = if (o.minimumSignificantDigits > 0) {
254
+ f.precision(Precision.minMaxSignificantDigits(o.minimumSignificantDigits.toInt(), o.maximumSignificantDigits.toInt()))
255
+ } else {
256
+ f.precision(Precision.minMaxFraction(o.minimumFractionDigits.toInt(), o.maximumFractionDigits.toInt()))
257
+ }
258
+ val code = o.currency
259
+ if (o.style == NumberFormatStyle.CURRENCY && code != null) {
260
+ f = f.unit(Currency.getInstance(code)).unitWidth(
261
+ when (o.currencyDisplay) {
262
+ NumberFormatCurrencyDisplay.CODE -> NumberFormatter.UnitWidth.ISO_CODE
263
+ NumberFormatCurrencyDisplay.NAME -> NumberFormatter.UnitWidth.FULL_NAME
264
+ NumberFormatCurrencyDisplay.NARROWSYMBOL -> NumberFormatter.UnitWidth.NARROW
265
+ else -> NumberFormatter.UnitWidth.SHORT
266
+ }
267
+ )
268
+ } else if (o.style == NumberFormatStyle.PERCENT) {
269
+ f = f.unit(MeasureUnit.PERCENT).scale(Scale.powerOfTen(2))
270
+ }
271
+ val accounting = o.currencySign == NumberFormatCurrencySign.ACCOUNTING
272
+ f = f.sign(
273
+ when (o.signDisplay) {
274
+ NumberFormatSignDisplay.ALWAYS -> if (accounting) NumberFormatter.SignDisplay.ACCOUNTING_ALWAYS else NumberFormatter.SignDisplay.ALWAYS
275
+ NumberFormatSignDisplay.EXCEPTZERO -> if (accounting) NumberFormatter.SignDisplay.ACCOUNTING_EXCEPT_ZERO else NumberFormatter.SignDisplay.EXCEPT_ZERO
276
+ NumberFormatSignDisplay.NEVER -> NumberFormatter.SignDisplay.NEVER
277
+ else -> if (accounting) NumberFormatter.SignDisplay.ACCOUNTING else NumberFormatter.SignDisplay.AUTO
278
+ }
279
+ )
280
+ val formatter = f
281
+ return { value -> formatter.format(value).toString() }
282
+ }
283
+ }
209
284
  }
@@ -52,6 +52,8 @@ class HybridNitroNumberView(private val context: ThemedReactContext) : HybridNit
52
52
  }
53
53
  rollingView.onRevealEnd = { onRevealEnd?.invoke() }
54
54
  rollingView.onRevealMilestone = { index, milestone -> onRevealMilestone?.invoke(index.toDouble(), milestone) }
55
+ rollingView.onAnimationStart = { onAnimationStart?.invoke() }
56
+ rollingView.onAnimationEnd = { value -> onAnimationEnd?.invoke(value) }
55
57
  }
56
58
 
57
59
  // region Props
@@ -129,6 +131,16 @@ class HybridNitroNumberView(private val context: ThemedReactContext) : HybridNit
129
131
  set(v) { field = v; markConfigDirty() }
130
132
  override var shimmerDuration: Double? = null
131
133
  set(v) { field = v; markConfigDirty() }
134
+ override var shimmerAngle: Double? = null
135
+ set(v) { field = v; markConfigDirty() }
136
+ override var shimmerWidth: Double? = null
137
+ set(v) { field = v; markConfigDirty() }
138
+ override var shimmerBaseColor: Double? = null
139
+ set(v) { field = v; markConfigDirty() }
140
+ override var shimmerDirection: NitroNumberShimmerDirection? = null
141
+ set(v) { field = v; markConfigDirty() }
142
+ override var shimmerDelay: Double? = null
143
+ set(v) { field = v; markConfigDirty() }
132
144
  override var fontSize: Double? = null
133
145
  set(v) { field = v; markConfigDirty() }
134
146
  override var prefixFontSize: Double? = null
@@ -153,6 +165,34 @@ class HybridNitroNumberView(private val context: ThemedReactContext) : HybridNit
153
165
  set(v) { field = v; markConfigDirty() }
154
166
  override var tabularNums: Boolean? = null
155
167
  set(v) { field = v; markConfigDirty() }
168
+ override var signDisplay: NitroNumberSignDisplay? = null
169
+ set(v) { field = v; markConfigDirty() }
170
+ override var plusSign: String? = null
171
+ set(v) { field = v; markConfigDirty() }
172
+ override var minusSign: String? = null
173
+ set(v) { field = v; markConfigDirty() }
174
+ override var digitGlyphs: Array<String>? = null
175
+ set(v) { field = v; markConfigDirty() }
176
+ override var groupingSizes: DoubleArray? = null
177
+ set(v) { field = v; markConfigDirty() }
178
+ override var digitMax: DoubleArray? = null
179
+ set(v) { field = v; markConfigDirty() }
180
+ override var continuous: Boolean? = null
181
+ set(v) { field = v; markConfigDirty() }
182
+ override var prefixColor: Double? = null
183
+ set(v) { field = v; markConfigDirty() }
184
+ override var suffixColor: Double? = null
185
+ set(v) { field = v; markConfigDirty() }
186
+ override var fractionColor: Double? = null
187
+ set(v) { field = v; markConfigDirty() }
188
+ override var fractionFontSize: Double? = null
189
+ set(v) { field = v; markConfigDirty() }
190
+ override var fractionAlign: NitroNumberAffixAlign? = null
191
+ set(v) { field = v; markConfigDirty() }
192
+ override var respectReduceMotion: Boolean? = null
193
+ set(v) { field = v; markConfigDirty() }
194
+ override var onAnimationStart: (() -> Unit)? = null
195
+ override var onAnimationEnd: ((value: Double) -> Unit)? = null
156
196
  override var adjustsFontSizeToFit: Boolean? = null
157
197
  set(v) { field = v; markConfigDirty() }
158
198
  override var minimumFontScale: Double? = null
@@ -315,6 +355,11 @@ class HybridNitroNumberView(private val context: ThemedReactContext) : HybridNit
315
355
  loading = null
316
356
  shimmerColor = null
317
357
  shimmerDuration = null
358
+ shimmerAngle = null
359
+ shimmerWidth = null
360
+ shimmerBaseColor = null
361
+ shimmerDirection = null
362
+ shimmerDelay = null
318
363
  fontSize = null
319
364
  prefixFontSize = null
320
365
  suffixFontSize = null
@@ -327,6 +372,21 @@ class HybridNitroNumberView(private val context: ThemedReactContext) : HybridNit
327
372
  prefixOffset = null
328
373
  suffixOffset = null
329
374
  tabularNums = null
375
+ signDisplay = null
376
+ plusSign = null
377
+ minusSign = null
378
+ digitGlyphs = null
379
+ groupingSizes = null
380
+ digitMax = null
381
+ continuous = null
382
+ prefixColor = null
383
+ suffixColor = null
384
+ fractionColor = null
385
+ fractionFontSize = null
386
+ fractionAlign = null
387
+ respectReduceMotion = null
388
+ onAnimationStart = null
389
+ onAnimationEnd = null
330
390
  adjustsFontSizeToFit = null
331
391
  minimumFontScale = null
332
392
  allowFontScaling = null
@@ -401,6 +461,12 @@ class HybridNitroNumberView(private val context: ThemedReactContext) : HybridNit
401
461
  prefixOffset = (prefixOffset ?: 0.0).takeIf { it.isFinite() }?.toFloat() ?: 0f,
402
462
  suffixOffset = (suffixOffset ?: 0.0).takeIf { it.isFinite() }?.toFloat() ?: 0f,
403
463
  tabularNums = tabularNums ?: true,
464
+ prefixColor = prefixColor?.let { colorFromARGB(it) },
465
+ suffixColor = suffixColor?.let { colorFromARGB(it) },
466
+ fractionColor = fractionColor?.let { colorFromARGB(it) },
467
+ fractionFontSize = fractionFontSize?.takeIf { it.isFinite() && it > 0 }?.toFloat(),
468
+ fractionAlign = mapAffixAlign(fractionAlign),
469
+ digitGlyphs = digitGlyphs?.toList() ?: emptyList(),
404
470
  adjustsFontSizeToFit = adjustsFontSizeToFit ?: false,
405
471
  minimumFontScale = (minimumFontScale ?: 0.5).coerceIn(0.05, 1.0).toFloat(),
406
472
  allowFontScaling = allowFontScaling ?: false,
@@ -413,6 +479,17 @@ class HybridNitroNumberView(private val context: ThemedReactContext) : HybridNit
413
479
  decimalSeparator = decimalSeparator ?: ".",
414
480
  prefix = prefix ?: "",
415
481
  suffix = suffix ?: "",
482
+ signDisplay = when (signDisplay) {
483
+ NitroNumberSignDisplay.ALWAYS -> 1
484
+ NitroNumberSignDisplay.EXCEPTZERO -> 2
485
+ NitroNumberSignDisplay.NEGATIVE -> 3
486
+ NitroNumberSignDisplay.NEVER -> 4
487
+ NitroNumberSignDisplay.AUTO, null -> 0
488
+ },
489
+ plusSign = plusSign?.takeIf { it.isNotEmpty() } ?: "+",
490
+ minusSign = minusSign?.takeIf { it.isNotEmpty() } ?: "-",
491
+ groupingSizes = groupingSizes?.map { if (it.isFinite()) Math.max(0, Math.rint(it).toInt()) else 0 } ?: emptyList(),
492
+ digitMax = digitMax?.map { if (it.isFinite()) Math.rint(it).toInt() else 9 } ?: emptyList(),
416
493
  )
417
494
  rollingView.timing = NitroNumberView.Timing(
418
495
  transition = when (transition) {
@@ -446,11 +523,22 @@ class HybridNitroNumberView(private val context: ThemedReactContext) : HybridNit
446
523
  },
447
524
  revealStaggerMs = Math.max(0.0, revealStagger ?: 200.0).toLong(),
448
525
  revealMilestoneHoldMs = Math.max(0.0, revealMilestoneHold ?: 0.0).toLong(),
526
+ continuous = continuous ?: false,
527
+ respectReduceMotion = respectReduceMotion ?: true,
449
528
  )
450
529
  rollingView.revealMilestones = revealMilestones ?: DoubleArray(0)
451
530
  rollingView.shimmer = NitroNumberView.Shimmer(
452
531
  color = shimmerColor?.let { colorFromARGB(it) },
453
532
  durationMs = Math.max(200.0, shimmerDuration ?: 950.0).toLong(),
533
+ angle = (shimmerAngle?.takeIf { it.isFinite() } ?: 31.0).toFloat(),
534
+ width = (shimmerWidth?.takeIf { it.isFinite() && it > 0 } ?: 1.0).toFloat(),
535
+ baseColor = shimmerBaseColor?.let { colorFromARGB(it) },
536
+ leftToRight = when (shimmerDirection) {
537
+ NitroNumberShimmerDirection.LTR -> true
538
+ NitroNumberShimmerDirection.RTL -> false
539
+ else -> null
540
+ },
541
+ delayMs = Math.max(0.0, shimmerDelay?.takeIf { it.isFinite() } ?: 0.0).toLong(),
454
542
  )
455
543
  rollingView.flash = NitroNumberView.Flash(
456
544
  upColor = flashUpColor?.let { colorFromARGB(it) },