react-native-nitro-input 0.3.0 → 0.3.2

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 (150) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +120 -5
  3. package/android/src/main/cpp/JMaskEngine.cpp +45 -0
  4. package/android/src/main/cpp/JMaskEngine.hpp +9 -0
  5. package/android/src/main/cpp/JReflowEngine.cpp +32 -0
  6. package/android/src/main/cpp/JReflowEngine.hpp +13 -0
  7. package/android/src/main/cpp/JRollingEngine.cpp +42 -2
  8. package/android/src/main/cpp/JRollingEngine.hpp +9 -1
  9. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroInputView.kt +24 -0
  10. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatform.kt +76 -1
  11. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberView.kt +88 -0
  12. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroTextMeasure.kt +25 -0
  13. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroTextView.kt +140 -0
  14. package/android/src/main/java/com/margelo/nitro/nitroinput/MaskEngine.kt +16 -0
  15. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputPackage.kt +2 -1
  16. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputView.kt +96 -6
  17. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroNumberView.kt +388 -136
  18. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroTextView.kt +868 -0
  19. package/android/src/main/java/com/margelo/nitro/nitroinput/ReflowEngine.kt +21 -0
  20. package/android/src/main/java/com/margelo/nitro/nitroinput/RollingEngine.kt +13 -2
  21. package/cpp/MaskEngine.cpp +294 -33
  22. package/cpp/MaskEngine.hpp +68 -0
  23. package/cpp/RollingEngine.cpp +92 -8
  24. package/cpp/RollingEngine.hpp +36 -2
  25. package/ios/HybridNitroInputView.swift +18 -0
  26. package/ios/HybridNitroNumberFormatPlatform.swift +87 -9
  27. package/ios/HybridNitroNumberView.swift +82 -1
  28. package/ios/HybridNitroTextView.swift +134 -0
  29. package/ios/NitroInputView.swift +125 -7
  30. package/ios/NitroNumberView.swift +368 -135
  31. package/ios/NitroTextView.swift +583 -0
  32. package/lib/commonjs/nitrogen/generated/shared/json/NitroInputViewConfig.json +6 -0
  33. package/lib/commonjs/nitrogen/generated/shared/json/NitroNumberViewConfig.json +20 -0
  34. package/lib/commonjs/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
  35. package/lib/commonjs/src/NitroInput.js +15 -2
  36. package/lib/commonjs/src/NitroNumber.js +52 -3
  37. package/lib/commonjs/src/NitroText.js +138 -0
  38. package/lib/commonjs/src/NitroTime.js +65 -0
  39. package/lib/commonjs/src/formatProps.js +76 -16
  40. package/lib/commonjs/src/index.js +6 -1
  41. package/lib/commonjs/src/specs/NitroText.nitro.js +2 -0
  42. package/lib/module/nitrogen/generated/shared/json/NitroInputViewConfig.json +6 -0
  43. package/lib/module/nitrogen/generated/shared/json/NitroNumberViewConfig.json +20 -0
  44. package/lib/module/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
  45. package/lib/module/src/NitroInput.js +15 -2
  46. package/lib/module/src/NitroNumber.js +53 -4
  47. package/lib/module/src/NitroText.js +98 -0
  48. package/lib/module/src/NitroTime.js +29 -0
  49. package/lib/module/src/formatProps.js +76 -17
  50. package/lib/module/src/index.js +2 -0
  51. package/lib/module/src/specs/NitroText.nitro.js +1 -0
  52. package/lib/typescript/src/NitroInput.d.ts +39 -1
  53. package/lib/typescript/src/NitroNumber.d.ts +79 -1
  54. package/lib/typescript/src/NitroText.d.ts +67 -0
  55. package/lib/typescript/src/NitroTime.d.ts +19 -0
  56. package/lib/typescript/src/formatProps.d.ts +30 -4
  57. package/lib/typescript/src/index.d.ts +5 -2
  58. package/lib/typescript/src/specs/NitroInput.nitro.d.ts +43 -0
  59. package/lib/typescript/src/specs/NitroNumber.nitro.d.ts +67 -0
  60. package/lib/typescript/src/specs/NitroText.nitro.d.ts +60 -0
  61. package/nitro.json +20 -0
  62. package/nitrogen/generated/android/NitroInput+autolinking.cmake +6 -0
  63. package/nitrogen/generated/android/NitroInputOnLoad.cpp +34 -0
  64. package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.cpp +102 -0
  65. package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.hpp +12 -0
  66. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.cpp +243 -0
  67. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.hpp +40 -0
  68. package/nitrogen/generated/android/c++/JHybridNitroTextMeasureSpec.cpp +58 -0
  69. package/nitrogen/generated/android/c++/JHybridNitroTextMeasureSpec.hpp +64 -0
  70. package/nitrogen/generated/android/c++/JHybridNitroTextViewSpec.cpp +253 -0
  71. package/nitrogen/generated/android/c++/JHybridNitroTextViewSpec.hpp +104 -0
  72. package/nitrogen/generated/android/c++/JNitroInputCharacterMapping.hpp +61 -0
  73. package/nitrogen/generated/android/c++/JNitroInputMaskAffinity.hpp +64 -0
  74. package/nitrogen/generated/android/c++/JNitroInputTextCase.hpp +61 -0
  75. package/nitrogen/generated/android/c++/JNitroNumberShimmerDirection.hpp +61 -0
  76. package/nitrogen/generated/android/c++/JNitroNumberSignDisplay.hpp +67 -0
  77. package/nitrogen/generated/android/c++/views/JHybridNitroInputViewStateUpdater.cpp +30 -0
  78. package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.cpp +100 -0
  79. package/nitrogen/generated/android/c++/views/JHybridNitroTextViewStateUpdater.cpp +174 -0
  80. package/nitrogen/generated/android/c++/views/JHybridNitroTextViewStateUpdater.hpp +54 -0
  81. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroInputViewSpec.kt +36 -0
  82. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberViewSpec.kt +136 -0
  83. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroTextMeasureSpec.kt +60 -0
  84. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroTextViewSpec.kt +179 -0
  85. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputCharacterMapping.kt +56 -0
  86. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputMaskAffinity.kt +25 -0
  87. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputTextCase.kt +24 -0
  88. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberShimmerDirection.kt +24 -0
  89. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberSignDisplay.kt +26 -0
  90. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroTextViewManager.kt +96 -0
  91. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroTextViewStateUpdater.kt +23 -0
  92. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.cpp +34 -0
  93. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.hpp +146 -11
  94. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Umbrella.hpp +25 -0
  95. package/nitrogen/generated/ios/NitroInputAutolinking.mm +16 -0
  96. package/nitrogen/generated/ios/NitroInputAutolinking.swift +24 -0
  97. package/nitrogen/generated/ios/c++/HybridNitroInputViewSpecSwift.hpp +50 -0
  98. package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.hpp +146 -0
  99. package/nitrogen/generated/ios/c++/HybridNitroTextMeasureSpecSwift.cpp +11 -0
  100. package/nitrogen/generated/ios/c++/HybridNitroTextMeasureSpecSwift.hpp +90 -0
  101. package/nitrogen/generated/ios/c++/HybridNitroTextViewSpecSwift.cpp +11 -0
  102. package/nitrogen/generated/ios/c++/HybridNitroTextViewSpecSwift.hpp +233 -0
  103. package/nitrogen/generated/ios/c++/views/HybridNitroInputViewComponent.mm +36 -0
  104. package/nitrogen/generated/ios/c++/views/HybridNitroNumberViewComponent.mm +120 -0
  105. package/nitrogen/generated/ios/c++/views/HybridNitroTextViewComponent.mm +264 -0
  106. package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec.swift +6 -0
  107. package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec_cxx.swift +78 -0
  108. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec.swift +20 -0
  109. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec_cxx.swift +493 -0
  110. package/nitrogen/generated/ios/swift/HybridNitroTextMeasureSpec.swift +56 -0
  111. package/nitrogen/generated/ios/swift/HybridNitroTextMeasureSpec_cxx.swift +150 -0
  112. package/nitrogen/generated/ios/swift/HybridNitroTextViewSpec.swift +75 -0
  113. package/nitrogen/generated/ios/swift/HybridNitroTextViewSpec_cxx.swift +608 -0
  114. package/nitrogen/generated/ios/swift/NitroInputCharacterMapping.swift +34 -0
  115. package/nitrogen/generated/ios/swift/NitroInputMaskAffinity.swift +48 -0
  116. package/nitrogen/generated/ios/swift/NitroInputTextCase.swift +44 -0
  117. package/nitrogen/generated/ios/swift/NitroNumberShimmerDirection.swift +44 -0
  118. package/nitrogen/generated/ios/swift/NitroNumberSignDisplay.swift +52 -0
  119. package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.cpp +12 -0
  120. package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.hpp +21 -0
  121. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.cpp +40 -0
  122. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.hpp +46 -0
  123. package/nitrogen/generated/shared/c++/HybridNitroTextMeasureSpec.cpp +22 -0
  124. package/nitrogen/generated/shared/c++/HybridNitroTextMeasureSpec.hpp +63 -0
  125. package/nitrogen/generated/shared/c++/HybridNitroTextViewSpec.cpp +62 -0
  126. package/nitrogen/generated/shared/c++/HybridNitroTextViewSpec.hpp +115 -0
  127. package/nitrogen/generated/shared/c++/NitroInputCharacterMapping.hpp +87 -0
  128. package/nitrogen/generated/shared/c++/NitroInputMaskAffinity.hpp +84 -0
  129. package/nitrogen/generated/shared/c++/NitroInputTextCase.hpp +80 -0
  130. package/nitrogen/generated/shared/c++/NitroNumberShimmerDirection.hpp +80 -0
  131. package/nitrogen/generated/shared/c++/NitroNumberSignDisplay.hpp +88 -0
  132. package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.cpp +12 -0
  133. package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.hpp +21 -0
  134. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.cpp +40 -0
  135. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.hpp +62 -0
  136. package/nitrogen/generated/shared/c++/views/HybridNitroTextViewComponent.cpp +74 -0
  137. package/nitrogen/generated/shared/c++/views/HybridNitroTextViewComponent.hpp +149 -0
  138. package/nitrogen/generated/shared/json/NitroInputViewConfig.json +6 -0
  139. package/nitrogen/generated/shared/json/NitroNumberViewConfig.json +20 -0
  140. package/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
  141. package/package.json +2 -2
  142. package/src/NitroInput.tsx +73 -0
  143. package/src/NitroNumber.tsx +183 -9
  144. package/src/NitroText.tsx +166 -0
  145. package/src/NitroTime.tsx +68 -0
  146. package/src/formatProps.ts +108 -18
  147. package/src/index.ts +8 -0
  148. package/src/specs/NitroInput.nitro.ts +46 -0
  149. package/src/specs/NitroNumber.nitro.ts +69 -0
  150. package/src/specs/NitroText.nitro.ts +65 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,85 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.2
4
+
5
+ - **`keepPlaceholder`**: the rest of a mask's placeholder stays visible,
6
+ greyed, after what has been typed ("1234 5" then "678 9012"); without a
7
+ `placeholder` the mask itself is shown, empty slots as
8
+ `maskSlotPlaceholder` (`_`): `+1 (212) ___-____`. Plain and reflowing
9
+ fields, both platforms.
10
+ - **`maskAffinityFormats`** and **`maskAffinityStrategy`**: several patterns
11
+ for one field, the best kept on every edit (a 4-6-5 Amex card beside
12
+ 4-4-4-4). Compared on the value characters, and a tie keeps the format that
13
+ is showing, so the grouping does not flip back and forth while typing.
14
+ - **`maskTextCase`** uppercases or lowercases letters as they arrive, and
15
+ **`maskCharacterMap`** replaces characters before masking (Cyrillic
16
+ look-alikes, a comma for a dot).
17
+ - Letter slots (`[A]`, `[a]`) take letters beyond ASCII: Latin with
18
+ diacritics, Greek, Cyrillic, Armenian, Hebrew, Arabic, Devanagari, Thai,
19
+ Hangul, kana and CJK.
20
+ - A paste that repeats a mask's leading constants ("+63…" into
21
+ `+63 [000] [000] [0000]`) loses the repeat when it would otherwise overflow.
22
+ - **Fixed**: a constant the mask inserts right at the caret now puts the
23
+ caret after it when typing and before it when deleting (the gravity was the
24
+ wrong way round), as RedMadRobot's input-mask does.
25
+ - **Fixed**: an ellipsis after an optional slot (`[9…]`, `[a…]`) repeats that
26
+ slot; the format sanitizer used to move it to the front, where it took any
27
+ character.
28
+ - **Fixed (iOS)**: changing `mask` (or a number format) re-masks the text and
29
+ reports it through `onChangeText` / `onChangeMask` / `getText()`, as Android
30
+ does; the field showed the new text while JS kept the old one.
31
+ - The mask engine is checked against ~1,900 cases ported from RedMadRobot's
32
+ input-mask (Android and iOS), maska and react-native-advanced-input-mask.
33
+
34
+ ## 0.3.1
35
+
36
+ - **Signs**: `signDisplay` (`'auto'`, `'always'`, `'exceptZero'`,
37
+ `'negative'`, `'never'`, as `Intl.NumberFormat`'s) puts a plus on gains,
38
+ and a plus that turns into a minus swaps like any other glyph; `plusSign`
39
+ and `minusSign` set the glyphs. A `format` gives its sign display and its
40
+ locale's minus.
41
+ - **Styled parts**: `prefixColor`, `suffixColor`, and `fractionFontSize`,
42
+ `fractionColor` and `fractionAlign` for smaller, dimmer or superscript
43
+ cents.
44
+ - **`onAnimationStart` / `onAnimationEnd`**: when the figure sets off from
45
+ rest and when it comes to rest, once for a run of changes.
46
+ - **`NitroTime`**: seconds as a clock, timer or countdown (`m:ss`,
47
+ `h:mm:ss`…), its tens of seconds and minutes wrapping after 5 so 0:59 →
48
+ 1:00 turns them one step. Built on `digits` (the highest digit a position
49
+ shows before it wraps, as NumberFlow's) and `groupingSizes`, both open to
50
+ any figure.
51
+ - **Compact figures**: a compact `format` rolls the figure it shows and swaps
52
+ its suffix ("950" → "1.5K" → "2.3M").
53
+ - **`continuous`**: the wheels below the highest one that changes turn a full
54
+ turn too, so a roll seems to pass through every value between.
55
+ - **Native digits and grouping**: `digitGlyphs` and `groupingSizes`, or a
56
+ `format`'s numbering system and group sizes (`ar-EG`'s ٠١٢٣…, `en-IN`'s
57
+ 12,34,567).
58
+ - **`animated={false}`** shows every change at once, and
59
+ **`respectReduceMotion={false}`** animates under Reduce Motion.
60
+ - **`NitroText`**: a single line of text that morphs natively, shared
61
+ characters gliding to their new places ("Sign in" → "Signing in…",
62
+ "$1,204" → "$1,318"), as Torph does on the web. Its own native view: one
63
+ draw of cached glyphs at rest like a label, sized by a synchronous native
64
+ measurement in the render that mounts it, with the loading shimmer and its
65
+ options. Only the props you set cross to native, a static label never
66
+ touches the reflow engine, and a reused view keeps its drawn line: 1000
67
+ labels mount in 113 ms of main thread on an iPhone 11 Pro and 510 ms on a
68
+ Galaxy A22 (`Text`: 140 and 790, `react-native-plain-text`: 112 and 620).
69
+ - **Shimmer options**: `shimmerAngle`, `shimmerWidth`, `shimmerBaseColor`
70
+ (a skeleton), `shimmerDirection` (following the layout direction by
71
+ default, so a right-to-left layout now sweeps right to left) and
72
+ `shimmerDelay`.
73
+ - Fixed: on iOS the loading glint was drawn in the label colour (black
74
+ on dark text, so invisible) unless `shimmerColor` was given; it uses the
75
+ documented light neutral now.
76
+ - Fixed: `NumberFormat` with `notation: 'compact'` dropped the currency and
77
+ the percent sign ("950" for "$950"; Android printed a compact currency in
78
+ full) and signDisplay's plus. It prints them as V8 does now.
79
+ - Android: `NitroText` crosses JNI to the reflow engine once per text
80
+ change and once per frame, rather than once per character and several
81
+ times a frame.
82
+
3
83
  ## 0.3.0
4
84
 
5
85
  - **`NumberFormat`**: `Intl.NumberFormat`'s API, formatted natively.
package/README.md CHANGED
@@ -107,8 +107,9 @@ The pattern is compiled once into a linked state machine in C++ and shared by
107
107
  both platforms, so the formatting, the caret and the "what is still missing"
108
108
  tail all come from one place and cannot drift apart. `[…]` is an editable
109
109
  block, `{…}` a literal the engine inserts for you. Built-in slots: `0` a
110
- required digit, `9` an optional one, `A`/`a` letters, `_` any character, `…`
111
- repeats the previous slot.
110
+ required digit, `9` an optional one, `A`/`a` letters (Latin, Greek, Cyrillic
111
+ and the other common scripts), `_`/`-` a letter or digit, `…` repeats the
112
+ previous slot.
112
113
 
113
114
  Add your own with `maskNotations`:
114
115
 
@@ -125,6 +126,26 @@ before them is satisfied; `maskAutoSkip` (default `false`) lets a backspace
125
126
  step back over them. Autocompletion only runs when the caret is at the end, so
126
127
  editing in the middle of a value does not fight you.
127
128
 
129
+ Keep what is still to come in view, pick between several shapes, and fix the
130
+ case as the user types:
131
+
132
+ ```tsx
133
+ <NitroInput
134
+ mode="mask"
135
+ mask="[0000] [0000] [0000] [0000]"
136
+ // Amex numbers take the 4-6-5 grouping
137
+ maskAffinityFormats={['{34}[00] [000000] [00000]', '{37}[00] [000000] [00000]']}
138
+ placeholder="1234 5678 9012 3456"
139
+ keepPlaceholder // "4111 1" then "678 9012 3456" greyed
140
+ />
141
+
142
+ <NitroInput mode="mask" mask="[AAAA][AA][__][___]" maskTextCase="upper" /> // a BIC
143
+ <NitroInput mode="mask" mask="[099999].[99]" maskCharacterMap={{ ',': '.' }} />
144
+ ```
145
+
146
+ A paste that repeats the mask's leading constants (`+639123456789` into
147
+ `+63 [000] [000] [0000]`) loses the repeat when it would otherwise overflow.
148
+
128
149
  ### Outlined and filled frames
129
150
 
130
151
  ```tsx
@@ -402,10 +423,16 @@ rather than renumbering the columns.
402
423
  | `maxIntegerDigits` | `number` | `15` | `number`: most integer digits accepted; further digits are rejected. |
403
424
  | `groupingSeparator` | `string` | `','` | `number`: every three integer digits; `''` disables grouping. |
404
425
  | `decimalSeparator` | `string` | `'.'` | `number`: between integer and fraction digits. |
405
- | `mask` | `string` | `''` | `mask`: the pattern. `[…]` an editable block, `{…}` a literal the engine inserts. Slots: `0` required digit, `9` optional digit, `A`/`a` letter, `_` any, `…` repeat. |
426
+ | `mask` | `string` | `''` | `mask`: the pattern. `[…]` an editable block, `{…}` a literal the engine inserts. Slots: `0` required digit, `9` optional digit, `A`/`a` letter, `_`/`-` letter or digit, `…` repeat. |
406
427
  | `maskNotations` | `{ character, characterSet, isOptional }[]` | `[]` | `mask`: caller-defined slots beyond the built-ins. |
407
428
  | `maskAutocomplete` | `boolean` | `true` | `mask`: insert literals as soon as the slot before them is filled. Only while the caret is at the end. |
408
429
  | `maskAutoSkip` | `boolean` | `false` | `mask`: let a backspace step back over inserted literals. |
430
+ | `keepPlaceholder` | `boolean` | `false` | `mask`: keep the rest of the placeholder (or, without one, the mask) greyed after the typed text. |
431
+ | `maskSlotPlaceholder` | `string` | `'_'` with `keepPlaceholder`, else `''` | `mask`: what an empty slot shows in the kept placeholder and `onChangeMask`'s tail. |
432
+ | `maskAffinityFormats` | `string[]` | `[]` | `mask`: more patterns the text may take; the best one wins each edit, `mask` wins ties. |
433
+ | `maskAffinityStrategy` | `'wholeString' \| 'prefix' \| 'capacity' \| 'extractedValueCapacity'` | `'wholeString'` | `mask`: how the best of `maskAffinityFormats` is chosen. |
434
+ | `maskTextCase` | `'none' \| 'upper' \| 'lower'` | `'none'` | `mask`: fold letters as they are typed or pasted. |
435
+ | `maskCharacterMap` | `Record<string, string>` | `{}` | `mask`: characters replaced before masking (`{ ',': '.' }`); an empty replacement drops one. |
409
436
  | `variant` | `'none' \| 'outlined' \| 'filled'` | `'none'` | Draws a frame for itself. The outlined notch is a real hole in the stroke. |
410
437
  | `label` | `string` | `''` | Floating label. Also becomes the field's accessible name when nothing else gives it one. |
411
438
  | `labelBehavior` | `'float' \| 'always'` | `'float'` | `always` keeps it floated even when empty and blurred. |
@@ -541,6 +568,13 @@ ticker), or SwiftUI's `.contentTransition(.numericText())`, or a scramble.
541
568
  - A currency switch plays as one change: prefix, suffix and separators blur
542
569
  across, decimal columns open and close, the digits swap or roll.
543
570
  - `animateTo` / `jumpTo` on the Nitro object work from a Reanimated worklet.
571
+ - Signs (`signDisplay`: a plus on gains that swaps into the minus), styled
572
+ affixes and cents (`prefixColor`, `fractionFontSize`, superscript
573
+ `fractionAlign`), native digits and grouping (`ar-EG`'s ٠١٢٣, `en-IN`'s
574
+ 12,34,567), compact figures that roll ("950" → "1.5K"), `continuous` rolls,
575
+ and `onAnimationStart` / `onAnimationEnd`.
576
+ - `NitroTime` shows seconds as a clock, timer or countdown whose tens wrap
577
+ after 5, as a clock's wheels do.
544
578
 
545
579
  Guide: **https://ronickg.github.io/react-native-nitro-input/docs/nitro-number**
546
580
 
@@ -726,6 +760,24 @@ Hand the final value back to React when the feed stops (`scheduleOnRN`) so the
726
760
  `value` prop matches the screen; posting every tick queues them up while JS is
727
761
  busy and replays them afterwards.
728
762
 
763
+ ### Clocks and timers
764
+
765
+ `NitroTime` is a `NitroNumber` with a number of seconds as its figure. The tens
766
+ of seconds and of minutes wrap after 5, so 0:59 → 1:00 turns them one step
767
+ instead of rolling back through 4, 3, 2, 1.
768
+
769
+ ```tsx
770
+ import { NitroTime } from 'react-native-nitro-input'
771
+
772
+ <NitroTime seconds={elapsed} /> // 12:07
773
+ <NitroTime seconds={remaining} timeFormat="h:mm:ss" /> // 1:00:05
774
+ ```
775
+
776
+ `timeFormat` is `'m:ss'` (the default; minutes run past 59), `'mm:ss'`,
777
+ `'h:mm:ss'` or `'hh:mm:ss'`; `separator` defaults to `':'`. Every other
778
+ `NitroNumber` prop applies. The wheels are open to any figure through `digits`
779
+ (a position's highest digit) and `groupingSizes`.
780
+
729
781
  ## NitroNumber props
730
782
 
731
783
  | Prop | Type | Default | Description |
@@ -733,9 +785,18 @@ busy and replays them afterwards.
733
785
  | `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
786
  | `fractionDigits` | `number` | `0` | Digits after the decimal separator. |
735
787
  | `minimumIntegerDigits` | `number` | `1` | Zero-pads the integer part. |
736
- | `groupingSeparator` | `string` | `''` | Inserted every three integer digits. |
788
+ | `groupingSeparator` | `string` | `''` | Inserted between digit groups. |
789
+ | `groupingSizes` | `number[]` | `[3]` | Group sizes from the decimal point: `[3, 2]` is Indian grouping (12,34,567). |
737
790
  | `decimalSeparator` | `string` | `'.'` | Between integer and fraction digits. |
738
791
  | `prefix` / `suffix` | `string` | `''` | Static text around the number. |
792
+ | `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. |
793
+ | `plusSign` / `minusSign` | `string` | `'+'` / `'-'` | The sign glyphs (e.g. `'−'`, U+2212). |
794
+ | `digitGlyphs` | `string[]` | `'0'`…`'9'` | Ten glyphs for native digits (Arabic-Indic, Devanagari…). |
795
+ | `digits` | `Record<number, { max }>` | – | The highest digit a position shows before it wraps (a clock's tens: `{ 1: { max: 5 } }`). |
796
+ | `continuous` | `boolean` | `false` | Rolls turn the lower wheels a full turn too, so the figure seems to pass through every value. |
797
+ | `animated` | `boolean` | `true` | `false` shows every change at once. |
798
+ | `respectReduceMotion` | `boolean` | `true` | Snap while the system's Reduce Motion is on. |
799
+ | `onAnimationStart` / `onAnimationEnd` | `() => void` / `(value) => void` | – | The figure set off from rest / came to rest, once for a run of changes. |
739
800
  | `duration` | `number` | `500` | Roll duration in ms; `0` snaps. |
740
801
  | `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
802
  | `bounce` | `number` | `0.15` | Overshoot of the `spring` easing (0–1). |
@@ -758,6 +819,11 @@ busy and replays them afterwards.
758
819
  | `loading` | `boolean` | `false` | "Shine" glint: a slanted, text-wide band sweeps through the ink; cross-fades on toggle. |
759
820
  | `shimmerColor` | `ColorValue` | light neutral | Color of the glint's core (`#D6D9E1`, `#2B2E37` in dark mode). |
760
821
  | `shimmerDuration` | `number` | `950` | ms per sweep (linear, repeating). |
822
+ | `shimmerAngle` | `number` | `31` | The band's slant in degrees (0 upright). |
823
+ | `shimmerWidth` | `number` | `1` | The band's width, a fraction of the number's. |
824
+ | `shimmerBaseColor` | `ColorValue` | `color` | The glyphs' colour outside the band: a skeleton. |
825
+ | `shimmerDirection` | `'auto' \| 'ltr' \| 'rtl'` | `'auto'` | Sweep direction; `'auto'` follows the layout direction. |
826
+ | `shimmerDelay` | `number` | `0` | ms of pause after each sweep. |
761
827
  | `fontSize` | `number` | `32` | Font size of the digits in points. |
762
828
  | `prefixFontSize` / `suffixFontSize` | `number` | `fontSize` | Smaller (or larger) prefix/suffix, e.g. a currency symbol or code. |
763
829
  | `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 +831,10 @@ busy and replays them afterwards.
765
831
  | `letterSpacing` | number | `0` | Points added after every glyph, like `Text`'s; a smaller affix gets it in proportion to its size. |
766
832
  | `prefixSpacing` / `suffixSpacing` | number | the letter spacing | Points between the prefix and the digits, and between the digits and the suffix. |
767
833
  | `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. |
834
+ | `prefixColor` / `suffixColor` | `ColorValue` | `color` | The affixes' colours. |
835
+ | `fractionFontSize` / `fractionColor` | `number` / `ColorValue` | `fontSize` / `color` | Smaller, dimmer cents (the decimal separator follows). |
836
+ | `fractionAlign` | `'baseline' \| 'center' \| 'top' \| 'bottom'` | `'baseline'` | `'top'`: superscript cents. |
837
+ | `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
838
  | `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
839
  | `adjustsFontSizeToFit` | `boolean` | `false` | Shrink the whole number to fit the view's fixed `width`; the view keeps its full height. |
771
840
  | `minimumFontScale` | `number` | `0.5` | Lower bound for `adjustsFontSizeToFit`. |
@@ -782,6 +851,44 @@ The view reports its intrinsic size from native and sizes itself. Give it an
782
851
  explicit `width` in `style` plus `textAlign="right"` if you don't want the layout
783
852
  to reflow while digits appear (e.g. a counter that grows past `999`).
784
853
 
854
+ ## NitroText
855
+
856
+ A single line of text that morphs to the next, natively: the characters two
857
+ strings share glide to their new places and the rest fade, as
858
+ [Torph](https://torph.lochie.me) does on the web. Digits match by place, so
859
+ "Total $1,204" → "Total $1,318" rolls the hundreds and tens.
860
+
861
+ ```tsx
862
+ import { NitroText } from 'react-native-nitro-input'
863
+
864
+ <NitroText fontSize={17} fontWeight="600">{busy ? 'Signing in…' : 'Sign in'}</NitroText>
865
+ ```
866
+
867
+ It is its own native view, not a text field: at rest it draws its line in one
868
+ pass, like a label, and only a morph draws each character on its own. It
869
+ measures its text natively while it renders, so it lays out in the commit that
870
+ mounts it, and only the props you set cross to native. Mounting 1000 labels
871
+ (Release, into reused views) costs about what `react-native-plain-text` does
872
+ and less than `Text`: 113 ms of main thread on an iPhone 11 Pro (PlainText
873
+ 112, Text 140) and 510 ms on a Galaxy A22 (PlainText 620, Text 790). A label
874
+ that never changes never touches the morph engine.
875
+
876
+ | Prop | Default | |
877
+ | --- | --- | --- |
878
+ | `children` | – | The text: a string or a number. A change morphs to it. |
879
+ | `fontSize` / `fontWeight` / `fontFamily` | `17` / `'normal'` / system | As `Text`'s. Digits are tabular, so a column keeps its width while it morphs. |
880
+ | `color` | label colour | |
881
+ | `letterSpacing` | `0` | Points after every character. |
882
+ | `textAlign` | `'auto'` | `'left'`, `'center'` or `'right'` in a wider view; `'auto'` is the start edge. |
883
+ | `allowFontScaling` / `maxFontSizeMultiplier` | `false` / none | Scale with the system text size, like `Text`. |
884
+ | `duration` / `easing` / `bounce` / `effect` | `400` / `'expo'` / `0.15` / `'auto'` | The morph's timing, as the [reflow](#how-the-reflow-decides-what-moves)'s. |
885
+ | `respectReduceMotion` | `true` | Snap while Reduce Motion (iOS) or "Remove animations" (Android) is on. |
886
+ | `loading` and `shimmer*` | `false` | The loading glint, with every option of `NitroNumber`'s. |
887
+
888
+ It is one line (no wrapping). Scripts that shape by context (Arabic, Indic)
889
+ and characters from fallback fonts (emoji, CJK) are drawn as strings, so they
890
+ render correctly, but they are laid out character by character.
891
+
785
892
  ## Accessibility and threading
786
893
 
787
894
  ### NitroInput
@@ -797,6 +904,14 @@ to reflow while digits appear (e.g. a counter that grows past `999`).
797
904
  `mostRecentEventCount` (the user typed since) is ignored, like React
798
905
  Native's own `TextInput`.
799
906
 
907
+ ### NitroText
908
+
909
+ - The view is the accessibility element, read as text with its string (and
910
+ "loading" while the shimmer runs); an `accessibilityLabel` replaces it.
911
+ - Reduce Motion (iOS) and "Remove animations" (Android) snap a morph.
912
+ - The view implements `RecyclableView`: a reused view keeps its drawn line, so
913
+ an element with the same text and style draws nothing.
914
+
800
915
  ### NitroNumber
801
916
 
802
917
  - VoiceOver / TalkBack read the formatted amount (prefix, sign, grouped digits,
@@ -29,6 +29,15 @@ void JMaskEngine::registerNatives() {
29
29
  makeNativeMethod("lastExtracted", JMaskEngine::lastExtracted),
30
30
  makeNativeMethod("lastTailPlaceholder", JMaskEngine::lastTailPlaceholder),
31
31
  makeNativeMethod("lastComplete", JMaskEngine::lastComplete),
32
+ makeNativeMethod("lastFormatIndex", JMaskEngine::lastFormatIndex),
33
+ makeNativeMethod("clearAffinityFormats", JMaskEngine::clearAffinityFormats),
34
+ makeNativeMethod("addAffinityFormat", JMaskEngine::addAffinityFormat),
35
+ makeNativeMethod("setAffinityStrategy", JMaskEngine::setAffinityStrategy),
36
+ makeNativeMethod("setTextCase", JMaskEngine::setTextCase),
37
+ makeNativeMethod("clearCharacterMap", JMaskEngine::clearCharacterMap),
38
+ makeNativeMethod("addCharacterMapping", JMaskEngine::addCharacterMapping),
39
+ makeNativeMethod("setSlotPlaceholder", JMaskEngine::setSlotPlaceholder),
40
+ makeNativeMethod("isActive", JMaskEngine::isActive),
32
41
  });
33
42
  }
34
43
 
@@ -78,4 +87,40 @@ bool JMaskEngine::lastComplete() {
78
87
  return last_.complete;
79
88
  }
80
89
 
90
+ void JMaskEngine::clearAffinityFormats() {
91
+ engine_.clearAffinityFormats();
92
+ }
93
+
94
+ void JMaskEngine::addAffinityFormat(jni::alias_ref<jni::JString> format) {
95
+ engine_.addAffinityFormat(str(format));
96
+ }
97
+
98
+ void JMaskEngine::setAffinityStrategy(int strategy) {
99
+ engine_.setAffinityStrategy(strategy);
100
+ }
101
+
102
+ void JMaskEngine::setTextCase(int textCase) {
103
+ engine_.setTextCase(textCase);
104
+ }
105
+
106
+ void JMaskEngine::clearCharacterMap() {
107
+ engine_.clearCharacterMap();
108
+ }
109
+
110
+ void JMaskEngine::addCharacterMapping(jni::alias_ref<jni::JString> from, jni::alias_ref<jni::JString> to) {
111
+ engine_.addCharacterMapping(str(from), str(to));
112
+ }
113
+
114
+ void JMaskEngine::setSlotPlaceholder(jni::alias_ref<jni::JString> character) {
115
+ engine_.setSlotPlaceholder(str(character));
116
+ }
117
+
118
+ bool JMaskEngine::isActive() {
119
+ return engine_.isActive();
120
+ }
121
+
122
+ int JMaskEngine::lastFormatIndex() {
123
+ return last_.formatIndex;
124
+ }
125
+
81
126
  } // namespace margelo::nitro::nitroinput
@@ -27,6 +27,14 @@ public:
27
27
  void clearNotations();
28
28
  void addNotation(jni::alias_ref<jni::JString> character, jni::alias_ref<jni::JString> characterSet, bool isOptional);
29
29
  bool setFormat(jni::alias_ref<jni::JString> format);
30
+ void clearAffinityFormats();
31
+ void addAffinityFormat(jni::alias_ref<jni::JString> format);
32
+ void setAffinityStrategy(int strategy);
33
+ void setTextCase(int textCase);
34
+ void clearCharacterMap();
35
+ void addCharacterMapping(jni::alias_ref<jni::JString> from, jni::alias_ref<jni::JString> to);
36
+ void setSlotPlaceholder(jni::alias_ref<jni::JString> character);
37
+ bool isActive();
30
38
 
31
39
  /// Replaces code points [start, end) of `current` with `replacement`.
32
40
  jni::local_ref<jni::JString> applyEdit(jni::alias_ref<jni::JString> current, int start, int end,
@@ -39,6 +47,7 @@ public:
39
47
  jni::local_ref<jni::JString> lastExtracted();
40
48
  jni::local_ref<jni::JString> lastTailPlaceholder();
41
49
  bool lastComplete();
50
+ int lastFormatIndex();
42
51
 
43
52
  private:
44
53
  friend HybridBase;
@@ -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);
@@ -91,6 +91,18 @@ class HybridNitroInputView(private val context: ThemedReactContext) : HybridNitr
91
91
  set(value) { field = value; markConfigDirty() }
92
92
  override var maskAutoSkip: Boolean = false
93
93
  set(value) { field = value; markConfigDirty() }
94
+ override var maskAffinityFormats: Array<String> = emptyArray()
95
+ set(value) { field = value; markConfigDirty() }
96
+ override var maskAffinityStrategy: NitroInputMaskAffinity = NitroInputMaskAffinity.WHOLESTRING
97
+ set(value) { field = value; markConfigDirty() }
98
+ override var maskTextCase: NitroInputTextCase = NitroInputTextCase.NONE
99
+ set(value) { field = value; markConfigDirty() }
100
+ override var maskCharacterMap: Array<NitroInputCharacterMapping> = emptyArray()
101
+ set(value) { field = value; markConfigDirty() }
102
+ override var maskSlotPlaceholder: String = ""
103
+ set(value) { field = value; markConfigDirty() }
104
+ override var keepPlaceholder: Boolean = false
105
+ set(value) { field = value; markConfigDirty() }
94
106
  override var mode: NitroInputMode = NitroInputMode.TEXT
95
107
  set(v) { field = v; markConfigDirty() }
96
108
  override var fractionDigits: Double = 2.0
@@ -373,6 +385,12 @@ class HybridNitroInputView(private val context: ThemedReactContext) : HybridNitr
373
385
  maskNotations = emptyArray()
374
386
  maskAutocomplete = true
375
387
  maskAutoSkip = false
388
+ maskAffinityFormats = emptyArray()
389
+ maskAffinityStrategy = NitroInputMaskAffinity.WHOLESTRING
390
+ maskTextCase = NitroInputTextCase.NONE
391
+ maskCharacterMap = emptyArray()
392
+ maskSlotPlaceholder = ""
393
+ keepPlaceholder = false
376
394
  mode = NitroInputMode.TEXT
377
395
  fractionDigits = 2.0
378
396
  maxIntegerDigits = 15.0
@@ -570,6 +588,12 @@ class HybridNitroInputView(private val context: ThemedReactContext) : HybridNitr
570
588
  },
571
589
  maskAutocomplete = maskAutocomplete,
572
590
  maskAutoSkip = maskAutoSkip,
591
+ maskAffinityFormats = maskAffinityFormats.toList(),
592
+ maskAffinityStrategy = maskAffinityStrategy.value,
593
+ maskTextCase = maskTextCase.value,
594
+ maskCharacterMap = maskCharacterMap.map { NitroInputView.MaskMapping(it.from, it.to) },
595
+ maskSlotPlaceholder = maskSlotPlaceholder,
596
+ keepPlaceholder = keepPlaceholder,
573
597
  fractionDigits = clampInt(fractionDigits, 0, 9, 2),
574
598
  maxIntegerDigits = clampInt(maxIntegerDigits, 1, 30, 15),
575
599
  groupingSeparator = groupingSeparator,