react-native-nitro-input 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/CHANGELOG.md +305 -3
  2. package/NitroInput.podspec +4 -4
  3. package/README.md +378 -53
  4. package/android/CMakeLists.txt +5 -3
  5. package/android/src/main/cpp/JOutlineGeometry.hpp +1 -1
  6. package/android/src/main/cpp/JReflowEngine.cpp +132 -0
  7. package/android/src/main/cpp/{JMorphEngine.hpp → JReflowEngine.hpp} +7 -7
  8. package/android/src/main/cpp/JRollingEngine.cpp +222 -0
  9. package/android/src/main/cpp/JRollingEngine.hpp +68 -0
  10. package/android/src/main/cpp/cpp-adapter.cpp +4 -2
  11. package/android/src/main/java/com/margelo/nitro/nitroinput/AmountFormatter.kt +1 -1
  12. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroInputView.kt +1 -1
  13. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberView.kt +471 -0
  14. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputPackage.kt +2 -1
  15. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputView.kt +38 -16
  16. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroNumberView.kt +1741 -0
  17. package/android/src/main/java/com/margelo/nitro/nitroinput/{MorphEngine.kt → ReflowEngine.kt} +2 -2
  18. package/android/src/main/java/com/margelo/nitro/nitroinput/RollingEngine.kt +59 -0
  19. package/cpp/AmountFormatter.cpp +5 -0
  20. package/cpp/AmountFormatter.hpp +10 -2
  21. package/cpp/{MorphEngine.cpp → ReflowEngine.cpp} +52 -47
  22. package/cpp/{MorphEngine.hpp → ReflowEngine.hpp} +12 -4
  23. package/cpp/RollingEngine.cpp +1224 -0
  24. package/cpp/RollingEngine.hpp +468 -0
  25. package/cpp/SwiftNonCopyable.hpp +22 -0
  26. package/cpp/worklets/NitroInputWorkletsBridge.cpp +3 -3
  27. package/cpp/worklets/NitroInputWorkletsBridge.hpp +1 -1
  28. package/ios/{HybridMorphInputView.swift → HybridNitroInputView.swift} +1 -1
  29. package/ios/HybridNitroNumberView.swift +439 -0
  30. package/ios/NitroInputView.swift +69 -45
  31. package/ios/NitroNumberView.swift +1934 -0
  32. package/lib/commonjs/nitrogen/generated/shared/json/NitroNumberViewConfig.json +55 -0
  33. package/lib/commonjs/src/NitroInput.js +21 -52
  34. package/lib/commonjs/src/NitroNumber.js +139 -0
  35. package/lib/commonjs/src/index.js +4 -3
  36. package/lib/commonjs/src/specs/NitroNumber.nitro.js +2 -0
  37. package/lib/commonjs/src/styleHelpers.js +36 -0
  38. package/lib/module/nitrogen/generated/shared/json/NitroNumberViewConfig.json +55 -0
  39. package/lib/module/src/NitroInput.js +12 -43
  40. package/lib/module/src/NitroNumber.js +100 -0
  41. package/lib/module/src/index.js +1 -1
  42. package/lib/module/src/specs/NitroNumber.nitro.js +1 -0
  43. package/lib/module/src/styleHelpers.js +32 -0
  44. package/lib/typescript/src/NitroInput.d.ts +28 -21
  45. package/lib/typescript/src/NitroNumber.d.ts +211 -0
  46. package/lib/typescript/src/index.d.ts +3 -2
  47. package/lib/typescript/src/specs/NitroInput.nitro.d.ts +9 -9
  48. package/lib/typescript/src/specs/NitroNumber.nitro.d.ts +238 -0
  49. package/lib/typescript/src/styleHelpers.d.ts +3 -0
  50. package/nitro.json +10 -0
  51. package/nitrogen/generated/android/NitroInput+autolinking.cmake +4 -0
  52. package/nitrogen/generated/android/NitroInputOnLoad.cpp +20 -0
  53. package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
  54. package/nitrogen/generated/android/c++/JFunc_void_double_double.hpp +10 -10
  55. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.cpp +536 -0
  56. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.hpp +156 -0
  57. package/nitrogen/generated/android/c++/JNitroNumberAffixAlign.hpp +64 -0
  58. package/nitrogen/generated/android/c++/JNitroNumberDirection.hpp +61 -0
  59. package/nitrogen/generated/android/c++/JNitroNumberEasing.hpp +67 -0
  60. package/nitrogen/generated/android/c++/JNitroNumberRevealStyle.hpp +58 -0
  61. package/nitrogen/generated/android/c++/JNitroNumberTextAlign.hpp +64 -0
  62. package/nitrogen/generated/android/c++/JNitroNumberTransition.hpp +61 -0
  63. package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.cpp +299 -0
  64. package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.hpp +54 -0
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/Func_void.kt +78 -0
  66. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/Func_void_double_double.kt +9 -9
  67. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberViewSpec.kt +363 -0
  68. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberAffixAlign.kt +25 -0
  69. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberDirection.kt +24 -0
  70. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberEasing.kt +26 -0
  71. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberRevealStyle.kt +23 -0
  72. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberTextAlign.kt +25 -0
  73. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberTransition.kt +24 -0
  74. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroNumberViewManager.kt +96 -0
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroNumberViewStateUpdater.kt +23 -0
  76. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.cpp +25 -0
  77. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.hpp +248 -0
  78. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Umbrella.hpp +23 -0
  79. package/nitrogen/generated/ios/NitroInputAutolinking.mm +8 -0
  80. package/nitrogen/generated/ios/NitroInputAutolinking.swift +12 -0
  81. package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.cpp +11 -0
  82. package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.hpp +432 -0
  83. package/nitrogen/generated/ios/c++/views/HybridNitroNumberViewComponent.mm +414 -0
  84. package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
  85. package/nitrogen/generated/ios/swift/Func_void_double_double.swift +5 -5
  86. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec.swift +102 -0
  87. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec_cxx.swift +1243 -0
  88. package/nitrogen/generated/ios/swift/NitroNumberAffixAlign.swift +48 -0
  89. package/nitrogen/generated/ios/swift/NitroNumberDirection.swift +44 -0
  90. package/nitrogen/generated/ios/swift/NitroNumberEasing.swift +52 -0
  91. package/nitrogen/generated/ios/swift/NitroNumberRevealStyle.swift +40 -0
  92. package/nitrogen/generated/ios/swift/NitroNumberTextAlign.swift +48 -0
  93. package/nitrogen/generated/ios/swift/NitroNumberTransition.swift +44 -0
  94. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.cpp +115 -0
  95. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.hpp +175 -0
  96. package/nitrogen/generated/shared/c++/NitroNumberAffixAlign.hpp +84 -0
  97. package/nitrogen/generated/shared/c++/NitroNumberDirection.hpp +80 -0
  98. package/nitrogen/generated/shared/c++/NitroNumberEasing.hpp +88 -0
  99. package/nitrogen/generated/shared/c++/NitroNumberRevealStyle.hpp +76 -0
  100. package/nitrogen/generated/shared/c++/NitroNumberTextAlign.hpp +84 -0
  101. package/nitrogen/generated/shared/c++/NitroNumberTransition.hpp +80 -0
  102. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.cpp +124 -0
  103. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.hpp +227 -0
  104. package/nitrogen/generated/shared/json/NitroNumberViewConfig.json +55 -0
  105. package/package.json +15 -7
  106. package/src/NitroInput.tsx +37 -60
  107. package/src/NitroNumber.tsx +481 -0
  108. package/src/index.ts +20 -6
  109. package/src/specs/NitroInput.nitro.ts +9 -9
  110. package/src/specs/NitroNumber.nitro.ts +259 -0
  111. package/src/styleHelpers.ts +32 -0
  112. package/android/src/main/cpp/JMorphEngine.cpp +0 -132
  113. package/lib/commonjs/src/MorphInput.js +0 -42
  114. package/lib/module/src/MorphInput.js +0 -6
  115. package/lib/typescript/src/MorphInput.d.ts +0 -18
  116. package/src/MorphInput.tsx +0 -30
package/CHANGELOG.md CHANGED
@@ -1,6 +1,190 @@
1
1
  # Changelog
2
2
 
3
- ## 0.1.0 (unreleased)
3
+ ## 0.2.0
4
+
5
+ - `react-native-nitro-rolling-number` is part of this package now, and its
6
+ `RollingNumber` is called **`NitroNumber`**, next to `NitroInput`: it plays
7
+ more than a roll (the numeric transition, the scramble, the reveal), and
8
+ the name says which package it comes from. The props and the handle are
9
+ the same; the types follow the name (`NitroNumberProps`,
10
+ `NitroNumberHandle`, `NitroNumberTransition`, …). Its engine, views and
11
+ JNI handle build into the `NitroInput` pod and `libNitroInput.so` next to
12
+ the input's, and its JS helpers (font weights, colours) are shared with
13
+ `NitroInput` instead of copied. Replace the import and drop the old
14
+ package: `import { NitroNumber } from 'react-native-nitro-input'`.
15
+ - **Breaking:** the morph is called the reflow, which is what it does: the
16
+ characters keep their shapes and move to where the new text puts them.
17
+ `MorphInput` and the `morph` prop are gone; pass `transition="reflow"` to
18
+ `NitroInput` instead (`'none'`, the default, is the plain field). A
19
+ reflowing field sizes itself to its content unless told otherwise, as
20
+ `MorphInput` did: `autoWidth` defaults to `'auto'` with it. The C++ engine
21
+ is `ReflowEngine` (was `MorphEngine`), and the docs page moved to
22
+ `/input/reflow`, with a redirect from `/input/morph`.
23
+
24
+ ### NitroNumber
25
+
26
+ - A change of `prefix`, `suffix`, `groupingSeparator` or `decimalSeparator`
27
+ plays instead of snapping: the old text softens and fades out while the
28
+ new one comes into focus, on the numeric transition's springs, and its
29
+ width eases from one to the other (`RollingEngine::changeText`). A change
30
+ of `fractionDigits` plays too, in every transition
31
+ (`RollingEngine::changeFormat`): the digits keep their place value, the
32
+ decimal columns that go close, new ones open blank and swap or roll their
33
+ digit in, and the decimal separator fades with them. A currency switch is
34
+ one transition, as SwiftUI's numeric text makes it, even when the next one
35
+ comes before it has finished (it used to show the old amount in the new
36
+ format for a frame, "¥838,712.00").
37
+ - `transition="numeric"`: a column opens on the arriving glyph's spring and
38
+ closes on the leaving glyph's blur, instead of the transition's easing,
39
+ which lagged the glyph and left a gap where a digit had just left.
40
+ - Android: a glyph fading with its column (a separator, the sign) left the
41
+ shared paint faded, and the next frame's digits were drawn faint or not at
42
+ all; a translucent `color` also turned opaque after the first change.
43
+ - A figure that hugs its content no longer jumps when it gains or loses a
44
+ digit at the end of a row. The view takes its new width at once, and with
45
+ the digits kept to its start edge a right-pinned figure (a fee at the end
46
+ of a `space-between` row) jumped a digit to the left and then opened a gap
47
+ after its prefix. `textAlign="auto"` now keeps the digits to whichever edge
48
+ the parent keeps the view to; a view with its own width is unchanged.
49
+ - A column opening or closing (a new leading digit, a separator, the sign)
50
+ keeps its glyph whole instead of cutting it to the half-open column, where
51
+ it read as a sliver: the right edge of a "1", a ")" of a 0 rolling past.
52
+ The glyph overhangs the column's far side, faded with it.
53
+ - `transition="numeric"`: a value re-targeted while a column was still
54
+ swapping to a glyph it keeps (typing, every keystroke) no longer cuts the
55
+ swap short; the column carries on from where it was, as SwiftUI's does.
56
+ - `transition="numeric"`: a second way a value change can play, after
57
+ SwiftUI's `.contentTransition(.numericText())`. Instead of rolling through
58
+ the digits between, each changed glyph swaps in place: the old one softens,
59
+ shrinks and slides out while the new one slides in from the other side, a
60
+ little small and out of focus, and resolves; the glyphs move up when the
61
+ value grows and down when it shrinks, the change cascades from the leftmost
62
+ digit to the right, and digits that don't change stay put. The engine
63
+ plans it as a blend per wheel (`fromGlyph` → `toGlyph`, `blend`), the same
64
+ `duration` and `stagger` apply (480 ms and, for the numeric transition, a
65
+ 150 ms cascade span shared out over the digits that change; `easing` and
66
+ `bounce` are not consulted, as SwiftUI's transition does not consult its
67
+ animation either). A changing digit runs four clocks scaled to the
68
+ duration, each a damped spring's step response: the position (ζ 0.54,
69
+ about 12 % overshoot, which is the wave; the glyph travels 0.34 line
70
+ heights), the size and opacity (critically damped, settled at 65 %; the
71
+ glyph grows from 0.4× as it fades in), the arriving glyph's blur (ζ 0.85,
72
+ settled at 74 %) and the leaving glyph's (critically damped, settled at
73
+ 46 %, so the old digit goes soft at once), with 0.08 line heights of blur
74
+ at full blur, SwiftUI's own; the transition runs 1.45 durations so the
75
+ position spring rings out instead of snapping its last pixel. The figures are
76
+ SwiftUI's, fitted to its frames at 60 fps: a model of our renderers was
77
+ rendered from the real glyphs and optimised until it reproduced SwiftUI's
78
+ frames, which cut the pixel error to a twentieth, and the result agrees
79
+ with the constants react-native-numeric-text published. A spring's
80
+ overshoot past the landing used to read as
81
+ settled and snapped the glyph sharp half way through. On iOS and Android
82
+ a glyph part way out of focus is the two nearest of six blurred copies
83
+ cross-faded, not the sharp glyph cross-faded with one fully blurred copy,
84
+ which showed a sharp digit inside a glow and read as a highlight rather
85
+ than a blur. On Android the sharp copy is a mask bitmap like the blurred
86
+ ones, not hardware text: text snaps to whole pixels as it moves and a
87
+ bitmap does not, and cross-faded the two slid in and out of register as
88
+ the spring settled, a bold/pale flicker at low blur; and each glyph's
89
+ bitmap is landed on whole device pixels, since a sharp bitmap drawn
90
+ between pixels is resampled and, creeping along the spring's tail, it
91
+ cycled crisp and soft once per pixel of travel (a shimmer a blurred copy
92
+ hides), and the last swap frame is now pixel for pixel the strip that
93
+ takes over from it. The blurred glyph masks are rendered on a background
94
+ thread as soon as the numeric transition is set, immutable and uploaded
95
+ ahead of their first draw; made on demand, the first change after launch
96
+ blocked the UI thread for 120–145 ms and dropped over 30 frames on a Galaxy
97
+ A22, and now drops none to a few. The two blur levels of a glyph are now weighted so
98
+ that composited one over the other they add up to the glyph's opacity;
99
+ weighted (1 − w) and w they came out only 75 % opaque half way between
100
+ levels, and the digit pulsed at every level crossing. Every renderer
101
+ draws the pair the same way: the
102
+ glyph's sharp and a blurred image cross-faded (Core Image on iOS, a
103
+ software blur once per font on Android, a canvas filter on the web), so a
104
+ frame of the transition costs what a frame of a roll does. The effect is
105
+ our own reading of the SwiftUI one; Giulio Amato's
106
+ [react-native-numeric-text](https://github.com/AmatoGiulio/react-native-numeric-text)
107
+ is a native re-implementation of it for React Native `Text` if a whole
108
+ text should transition rather than a rolling number. Checked frame by
109
+ frame against SwiftUI's own transition (a small reference app on the
110
+ simulator, same font size and colour): the direction had been ours the
111
+ wrong way round, so a value that grows now moves the glyphs up, the way
112
+ SwiftUI and an odometer do; the glyphs come in nearly full size from half
113
+ a line height away; and the arriving glyph comes into focus on its own
114
+ slower clock (`Wheel::focus`, over the whole duration) after the spring
115
+ has landed it, which is what makes the effect read as SwiftUI's rather
116
+ than as a quick fade. On iOS the blurred glyph images are a vImage tent
117
+ convolution now instead of Core Image, whose first render of a session
118
+ stalled the main thread for longer than the swap, and the ten digits'
119
+ sharp and blurred images are rendered a turn after mount, so the first
120
+ change of a session plays whole. On Android the blurred glyph is an
121
+ `ALPHA_8` mask filled with the digit colour at draw time, a quarter of
122
+ the memory of the coloured bitmap it was, and its radius matches iOS's.
123
+ A swapping glyph is no longer clipped to its digit cell, on any platform:
124
+ a blurred glyph's haze reaches well past the cell, and cut off at it the
125
+ haze ended in a hard edge, a pale box around every digit in transit (on
126
+ iOS the swap layers now sit on an unclipped layer above the strip
127
+ containers; on Android and the web the swap is drawn without the cell's
128
+ clip rect).
129
+
130
+ - `transition="scramble"`, on the same machinery: each changed digit shows
131
+ a different random digit every few frames, never the one it is leaving or
132
+ arriving at, until it locks on its target, the lock running from the left.
133
+ The engine does all of it, a renderer draws its strip as usual. Each swap
134
+ style has its own `duration` / `easing` / `stagger` defaults (scramble
135
+ 500 ms, `linear`, 60 ms).
136
+
137
+ - The change flash and the pop, with any transition. `flashUpColor` /
138
+ `flashDownColor` light every digit whose glyph changes in the up or the
139
+ down colour, keep it lit while it moves, and fade it back over
140
+ `flashDuration` once it has landed; a snap under Reduce Motion lights and
141
+ fades at once, a `jumpTo` never flashes. The tint is the digit's own ink
142
+ mixed towards the colour, whatever it is doing: on a rolling wheel the
143
+ strip itself is drawn again in the flash colour at the strip's own
144
+ offset, so the tint rides the roll (a tinted glyph laid over a moving
145
+ strip read as a doubled digit); on a swapping wheel both glyphs, the
146
+ leaving one and the arriving one, are drawn again in the colour with the
147
+ same blur and fade as their originals (a sharp tinted glyph over a
148
+ blurred one read as a smudge, and a fade that began during the swap
149
+ showed the digit landing already half way back to blue). `popOnChange`
150
+ punches the whole figure on every change, rung out like the reveal's
151
+ landing pop and folded into the same scale the renderers already apply.
152
+ Both are engine state (`Wheel::flash`, `revealScale()`), so every
153
+ renderer reads them the same way.
154
+
155
+
156
+ ### Performance
157
+
158
+ - iOS: Swift called every read-only method of a C++ engine on a copy of
159
+ it, vectors and all, dozens of times a frame per figure. `RollingEngine`,
160
+ `ReflowEngine` and `AmountFormatter` are `SWIFT_NONCOPYABLE` now and Swift
161
+ reads them in place. On an iPhone 11 Pro with 52 figures updating, a
162
+ frame's layout work went from ~45 to ~14 ms a second.
163
+ - iOS: every figure wrapped its frame in an explicit `CATransaction` to turn
164
+ implicit animations off, which outside UIKit's own transaction is a
165
+ commit to the render server per figure per frame. The layers never
166
+ animate implicitly now (`QuietLayer`), so a frame's changes join the run
167
+ loop's one transaction; a reflowing `NitroInput`'s layers too. Roll
168
+ render ~235 → ~68 ms a second, main thread ~265 → ~190.
169
+ - The numeric transition's blurred glyphs are kept while they are in use.
170
+ A cache that started over at a fixed count dropped glyphs about to be
171
+ drawn again on a screen with a few fonts and colours: on iOS ~2,900
172
+ vImage blurs a second (render ~750 → ~140 ms a second, 52 → 60 fps on
173
+ the 11 Pro); on Android the masks are bounded by size and each font set
174
+ keeps its own (numeric draw 6.9 → 4.4 ms a frame on a Galaxy A22).
175
+ A screen of many styles keeps more memory for them (~14 MB for a
176
+ 52-figure dashboard in nine font/colour pairs on iOS), released on a
177
+ memory warning.
178
+ - Android: prefixes, suffixes and separators are shaped once and drawn as
179
+ glyphs (`TextRunShaper` + `Canvas.drawGlyphs`, API 31+) instead of
180
+ re-shaped by `drawText` every frame: ~45 → ~5 µs a draw on a Galaxy A22,
181
+ a frame's draw for 52 figures 5.9 → 4.4 ms. A resting wheel is one bitmap
182
+ copy. A reflowing `NitroInput` draws its glyphs the same way: its draw
183
+ per animation frame halved (2.0–2.2 → 1.0–1.1 ms).
184
+
185
+ ## 0.1.0
186
+
187
+ ### NitroInput
4
188
 
5
189
  - Memory: a dropped field is freed when Fabric drops it. The Nitro hybrid
6
190
  behind a view is kept alive by its C++ part until the JS handle from
@@ -19,7 +203,7 @@
19
203
  colour as the platform default.
20
204
 
21
205
  - Initial release: native single-line text / amount input (iOS + Android) with Torph-style text morphing, built with Nitro Modules.
22
- - One shared C++ engine (`cpp/MorphEngine`): caret matching for edits (grouping separators paired from the units end), place matching for programmatic sets, longest-common-subsequence for text; digits slide through the line box, separators from below, text fades and scales; entering and leaving characters ride with their nearest persisting neighbour; `expo` / `easeOut` / `easeInOut` / `linear` / `spring` timing; Reduce Motion snaps.
206
+ - One shared C++ engine (`cpp/ReflowEngine`): caret matching for edits (grouping separators paired from the units end), place matching for programmatic sets, longest-common-subsequence for text; digits slide through the line box, separators from below, text fades and scales; entering and leaving characters ride with their nearest persisting neighbour; `expo` / `easeOut` / `easeInOut` / `linear` / `spring` timing; Reduce Motion snaps.
23
207
  - `mode="number"`: every edit is formatted natively before a frame is drawn (`cpp/AmountFormatter`): grouping, one decimal, `fractionDigits` / `maxIntegerDigits` limits that reject the keystroke, backspace over a separator removes the digit before it, a decimal typed in the integer part moves the decimal point, `prefix` / `suffix` with their own sizes and alignment.
24
208
  - Controlled `value` with the `text` + `mostRecentEventCount` handshake (a stale value never fights the user); `onChangeText`, `onChangeValue`, `onFocus` / `onBlur`, `onSubmitEditing`; `focus` / `blur` / `clear` / `setText` / `setValue` / `getText` / `getValue` / `isFocused`.
25
209
  - Worklets (optional, with `react-native-worklets`): a `transform` worklet and `'worklet'`-marked `onChangeText` / `onChangeValue` run synchronously on the UI thread inside the native edit, via a `NitroInputWorklets` bridge that holds the worklets UI runtime; no-ops when the package is not installed.
@@ -52,7 +236,7 @@
52
236
  - iOS: `focus()` / `blur()`, `Keyboard.dismiss()` and a ScrollView's auto-blur now reach a multiline field (the Fabric command only looked for a `UITextField`). `maxIntegerDigits` accepts up to 30, as on Android. Turning `morph` back on after plain mode no longer leaves the field blank until the next edit.
53
237
  - Android: toggling `secureTextEntry` at runtime re-feeds the glyphs (the real characters used to stay on screen until the next edit); `maxLength` no longer clips a mask's own punctuation (it applies to `mode="text"` only, as on iOS); `focus()` and `autoFocus` respect `showSoftInputOnFocus={false}`; a `lineHeight` removed at runtime resets the spacing; tabular figures in text mode too, matching iOS.
54
238
  - Less work per frame and per keystroke: iOS keeps one layer entry per glyph and re-uses it (no per-glyph allocation per frame), positions the caret once per step and caches the right-to-left caret blocks when a frame is published; Android resolves its theme colours once instead of per draw, reads the animator duration scale once (refreshed by a settings observer) instead of querying the settings provider per keystroke below API 33, and the outlined frame's geometry is written into a reused buffer instead of two vectors per draw.
55
- - Removed dead code: `MaskEngine::format` / `totalTextLength` / `totalValueLength` / `placeholder`, the worklets bridge's `uninstallRuntime` and `isReady`, `MorphEngine::rightToLeft`, the unused JNI bindings behind them, and an unreachable pre-iOS-15 branch.
239
+ - Removed dead code: `MaskEngine::format` / `totalTextLength` / `totalValueLength` / `placeholder`, the worklets bridge's `uninstallRuntime` and `isReady`, `ReflowEngine::rightToLeft`, the unused JNI bindings behind them, and an unreachable pre-iOS-15 branch.
56
240
  - Android build: the Android Gradle plugin is only pinned when the library builds on its own, Java 17 source/target, an unused `kotlinVersion` property removed, `cmake_minimum_required` before `project()`.
57
241
  - Fixed: in a plain (text-mode) field with `morph` on, the decimal point of a number typed by hand dipped and rose again on every keystroke after it, although it never moved. The engine took a lone `.` or `,` for a grouping separator and re-paired it from the units end on each edit; it is the decimal point now, part of the typed sequence like the digits. Repeated punctuation (`192.168.0.1`, `21.09.2026`) is still structure.
58
242
  - `onChangeMask` reports the same way on both platforms: whenever the text changes, from a keystroke, `setText` / `clear` or the `value` prop. iOS used to report the untouched empty text once at mount, and Android never reported a prop change. Found by the new on-device suite.
@@ -61,3 +245,121 @@
61
245
  - The handle queues `focus()`, `blur()`, `clear()`, `setText()`, `setValue()` and `setSelection()` sent before the native view has attached and replays them the moment it does, as React Native queues a `TextInput`'s view commands; `useEffect(() => ref.current?.focus(), [])` and a `focus()` in a ref callback used to be silent no-ops. Found by the on-device suite that mirrors React Native's own `TextInput` tests.
62
246
  - `aria-busy`, `aria-checked`, `aria-disabled`, `aria-expanded` and `aria-selected` fold into `accessibilityState`, `aria-hidden` hides the element, and `aria-labelledby` reaches the host, the way `TextInput` resolves them (a Nitro view is handed the raw props, which the native parser drops). `NitroInput` and `MorphInput` carry a `displayName`.
63
247
  - Docs page with a live demo running the same engine and formatter compiled to WebAssembly.
248
+
249
+ ### RollingNumber (react-native-nitro-rolling-number 0.1.0)
250
+
251
+ - Android: the digit strip is a software-rendered bitmap inside a layer, and
252
+ it is recorded again when the renderer drops it. Two things were wrong with
253
+ the strip as a layer of GPU-rasterized text. Its digits came out thinner
254
+ and paler than the sign and affixes drawn as glyphs beside them, visibly on
255
+ a small red change value; text the software renderer rasterizes into a
256
+ bitmap has the pixels it should, and the bitmap goes into a layer once
257
+ because drawing it per wheel costs the renderer several milliseconds a
258
+ frame more than a layer does. And HWUI deletes a node's display list the
259
+ moment nothing in the view tree draws it, so once every rolling number on
260
+ screen had been unmounted and new ones mounted (or the app had been in the
261
+ background) the next ones reported their value to accessibility and painted
262
+ blank; the strip is recorded again whenever its display list is gone. At
263
+ rest the window lands on whole device pixels so a small digit is not
264
+ resampled soft. Found by the example's new Recycle check screen and
265
+ `scripts/ui/recycle-check.mjs`, which drive a 400-row list through argent
266
+ and compare what every visible row reports with what it painted, frames
267
+ in the middle of a roll included.
268
+
269
+ - Memory: a dropped rolling number is freed when Fabric drops it. The Nitro
270
+ hybrid behind a view is kept alive by its C++ part until the JS handle from
271
+ `hybridRef` is garbage-collected, and Hermes collects a handle it takes for
272
+ an empty object only when the JS heap fills up. On Android the hybrid held
273
+ the platform view, so in a mount/unmount loop on a Galaxy A22 every dropped
274
+ view stayed allocated: 24 more live `View`s per cycle, each with a digit-
275
+ strip texture, about 1 MB of resident memory a cycle, linear for as long as
276
+ the loop ran (the same for the fields of `react-native-nitro-input`). Now
277
+ the Android hybrid lets go of its view on drop (unless Fabric is recycling
278
+ it), so what lingers is a shell; iOS, where Fabric pools the component view
279
+ and reuses it, releases the display link, the element layers, the engine's
280
+ wheels and the buffers on drop. The digit strips (Android `RenderNode`s, iOS
281
+ glyph and strip images) are shared by every rolling number drawn with the
282
+ same font, colour and density instead of rasterized per view, and the
283
+ hybrid reports its `memorySize` to Nitro so the handle is collected in
284
+ time. `dispose()` on the ref does the same release eagerly.
285
+ - Android draws a settled wheel from a shared digit strip (one layer per
286
+ font and blank-zero variant, recorded once, drawn at an offset) instead of
287
+ two `drawText`s per wheel per frame, the way iOS has moved a `CALayer`
288
+ strip since the layer renderer. On a Galaxy A22 at 90 Hz
289
+ with 24 numbers fed a new value every frame, `onDraw` recording went from
290
+ 9.4 ms to 2.6 ms a frame and the `value` prop path from 72 fps with 91
291
+ dropped frames in five seconds to 89 fps with 7; needs Android 10, older
292
+ devices keep the text path (so does a wheel still growing or shrinking).
293
+ - A value change no longer re-applies the whole configuration. The wrapper
294
+ sent `NaN` for an unset colour, Nitro only calls a native setter when a
295
+ prop's value changed, and NaN never equals itself, so every render re-set
296
+ the colour, marked the configuration dirty and had the format, timing,
297
+ typography and shimmer applied again on each value. The sentinel is
298
+ `Infinity` now (both platforms already read a non-finite colour as the
299
+ platform default).
300
+ - iOS renders a roll from the display link's tick only: `animate(to:)` also
301
+ rendered the layers immediately, so a value stream did two layer passes per
302
+ view per frame. And a frame now sets only the layer properties that moved
303
+ (affixes, separators and wheels at rest were re-set every frame; each Core
304
+ Animation setter costs a transaction entry and a KVO round trip).
305
+ - The roll runs at a ProMotion panel's full rate: the display link asks for
306
+ the screen's maximum refresh rate (as a Reanimated animation does); a
307
+ default display link stays at 60 Hz on a 120 Hz iPhone.
308
+
309
+ - `jumpTo` and `animateTo` now agree on large figures: `jumpTo` clamped the
310
+ scaled magnitude at 10^15 while a roll clamped at 10^17, so with 9 fraction
311
+ digits any value above 10^6 jumped to "1,000,000" but rolled to the right
312
+ digits. Both paths share one limit (10^17, the 18 wheels); a double has no
313
+ exact integers past 2^53 either way.
314
+ - The digits follow a light/dark switch again when no `color` is set. iOS
315
+ rasterizes the glyphs with the resolved label color and re-rasterizes on a
316
+ trait change (also when the view moves to a display with another scale, and
317
+ the pixel density now comes from the view's traits instead of the deprecated
318
+ `UIScreen.main`); Android rebuilds its paints on a configuration change.
319
+ - Less work per frame: iOS reuses its wheel and element buffers, keys the
320
+ glyph caches by a value type and compares layers in place instead of
321
+ building arrays to compare; Android pools its layout elements, splits the
322
+ affixes once per format and slides one cached shimmer gradient instead of
323
+ allocating one per frame. Both platforms format the accessibility text only
324
+ when VoiceOver / TalkBack asks for it, instead of on every value update.
325
+ - Android reads the animator duration scale once (refreshed by a settings
326
+ observer) instead of querying the settings provider on every `animateTo`
327
+ below API 33.
328
+ - The `ref` handle is created once per mount; `getValue()` reads the latest
329
+ prop through a ref instead of the handle being rebuilt on every value change.
330
+ - Packaging: `lib/` now ships an ES module build (`lib/module`), a CommonJS
331
+ build (`lib/commonjs`) and the declarations (`lib/typescript`), with
332
+ `import` / `require` conditions in `exports`; the previous output was ES
333
+ modules only, which a CommonJS consumer could not load. `@types/node` and
334
+ `@types/react-test-renderer` are declared instead of relying on hoisting.
335
+ - Android build: the Android Gradle plugin is only pinned when the library
336
+ builds on its own (an app's root project already provides it), Java 17
337
+ source/target, an unused `kotlinVersion` property removed, and
338
+ `cmake_minimum_required` before `project()`.
339
+ - Removed dead code: the engine's unused `revealFraction`, the allocating
340
+ `frame()` JNI method (the view uses `frameInto`).
341
+
342
+ - The native prop behind `direction` is now `rollDirection`. The public prop is
343
+ unchanged — the wrapper maps it — but `direction` is Yoga's layout property,
344
+ and because a Hybrid View's props derive from `ViewProps` React Native parsed
345
+ ours too, logging `Could not parse yoga::Direction: up` on every update.
346
+
347
+ - Initial release: native rolling number view (iOS + Android) built with Nitro Modules.
348
+ - `value`-driven digit roll with easing/spring, `stagger` and `direction`.
349
+ - Formatting: fraction digits, grouping and decimal separators, prefix/suffix with independent font sizes and `top` / `bottom` / `baseline` / `center` pinning, zero padding, negatives.
350
+ - `adjustsFontSizeToFit` / `minimumFontScale` with a continuous scale that keeps the box fixed.
351
+ - `loading` shine glint (`shimmerColor`, `shimmerDuration`).
352
+ - Imperative `animateTo` / `jumpTo` / `getValue` via ref.
353
+ - VoiceOver / TalkBack read the formatted amount; Reduce Motion / "remove animations" snap instead of rolling.
354
+ - `allowFontScaling` / `maxFontSizeMultiplier` (off by default).
355
+ - View recycling (`RecyclableView`) for long lists.
356
+ - Rapid updates: a value that arrives mid-roll continues with the ease-out half of the curve instead of restarting from rest, so per-frame `value` updates keep rolling.
357
+ - Auto-size: when the settled width shrinks mid-roll the smaller size is reported after the roll finishes, so `adjustsFontSizeToFit` no longer squeezes the still-rolling digits and the amount no longer dips and grows back.
358
+ - Android: the per-frame engine bridge fills a reused array instead of allocating one.
359
+ - iOS renders with Core Animation layers (a wheel is a clipped strip of pre-rasterized digits that moves per frame) instead of redrawing a bitmap; the Core Graphics path is only used while the loading glint shows. `jumpTo` / `animateTo` coalesce to the newest value per main-thread turn on both platforms. See `BENCHMARKS.md`.
360
+ - Jackpot reveal (`reveal`, `revealStyle`, `revealDuration`, `revealBounce`, `revealStagger`, `revealMilestones`, `revealMilestoneHold`, `onRevealMilestone`, `onRevealEnd`, `revealTo()`): the casino win-meter rollup (count from 0, digits swapping in place, leading digits appearing as the count reaches them, tiers that punch and hold with equal time per tier) and the slot-reel reveal (reels spin, then lock from the left with a mechanical bounce), both landing with a spring pop. All in the shared engine; snaps under Reduce Motion.
361
+ - `affixAlign="bottom"` now pins the bottom of the glyphs' ink (a currency code sits on the digits' baseline) instead of the line boxes, which hung the affix down to where a comma's tail reaches.
362
+ - Docs site (`docs/`) with live demos driven by the engine compiled to WebAssembly.
363
+ - The count reveal now tallies like a slot's win counter (after the gaming-machine patents US 9,495,843 and US 9,111,423): a constant rate per tier that winds up out of each milestone and crawls into the next, the figure opening smaller and growing to full size over the count (`revealGrow`, default 0.2), and punches that are a single overshoot settling back without dipping under the resting size (`revealBounce` default 0.12).
364
+ - Reveal callbacks survive view recycling: a recycled view (Fabric reuses instances when a screen is swapped) dropped the hybrid's `onRevealEnd` / `onRevealMilestone` wiring, so no reveal reported its end after the first screen change on iOS.
365
+ - The wrapper always sends every native prop with an explicit value (defaults, `''` for fonts, `NaN` for "platform default" colors, `[]` for no milestones, a numeric `revealState`): removing an optional prop used to reach native as `null`, which Nitro's parser rejects and React Native turns into a fatal error.
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
11
11
  s.authors = package["author"]
12
12
 
13
13
  s.platforms = { :ios => min_ios_version_supported, :visionos => 1.0 }
14
- s.source = { :git => "https://github.com/ronickg/react-native-nitro-rolling-number.git", :tag => "nitro-input-v#{s.version}" }
14
+ s.source = { :git => "https://github.com/ronickg/react-native-nitro-input.git", :tag => "nitro-input-v#{s.version}" }
15
15
 
16
16
  s.source_files = [
17
17
  # Implementation (Swift)
@@ -22,10 +22,10 @@ Pod::Spec.new do |s|
22
22
  "cpp/**/*.{hpp,cpp}",
23
23
  ]
24
24
 
25
- # The shared C++ engine and formatter are public headers so the pod's Swift
25
+ # The shared C++ engines and formatter are public headers so the pod's Swift
26
26
  # sources can call them directly through Swift/C++ interop (enabled by Nitro below).
27
27
  s.public_header_files = ["cpp/**/*.hpp"]
28
- # The engine's unit tests build as a host executable (`bun run test:cpp`).
28
+ # The engines' unit tests build as a host executable (`bun run test:cpp`).
29
29
  s.exclude_files = ["cpp/__tests__/**"]
30
30
 
31
31
  # Worklets are optional: with react-native-worklets in the app, `transform`
@@ -40,7 +40,7 @@ Pod::Spec.new do |s|
40
40
  Pod::UI.puts "[NitroInput] react-native-worklets found, worklet support enabled"
41
41
  s.dependency 'RNWorklets'
42
42
  s.pod_target_xcconfig = {
43
- "GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) MORPH_INPUT_WORKLETS=1",
43
+ "GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) NITRO_INPUT_WORKLETS=1",
44
44
  "HEADER_SEARCH_PATHS" => "$(inherited) \"$(PODS_ROOT)/Headers/Public/RNWorklets\"",
45
45
  }
46
46
  end