react-native-nitro-input 0.1.0 → 0.3.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 (221) hide show
  1. package/CHANGELOG.md +343 -3
  2. package/NitroInput.podspec +4 -4
  3. package/README.md +420 -53
  4. package/android/CMakeLists.txt +9 -3
  5. package/android/gradle.properties +1 -1
  6. package/android/src/main/cpp/JOutlineGeometry.hpp +1 -1
  7. package/android/src/main/cpp/JReflowEngine.cpp +132 -0
  8. package/android/src/main/cpp/{JMorphEngine.hpp → JReflowEngine.hpp} +7 -7
  9. package/android/src/main/cpp/JRollingEngine.cpp +223 -0
  10. package/android/src/main/cpp/JRollingEngine.hpp +68 -0
  11. package/android/src/main/cpp/cpp-adapter.cpp +4 -2
  12. package/android/src/main/java/com/margelo/nitro/nitroinput/AmountFormatter.kt +1 -1
  13. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroInputView.kt +21 -1
  14. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatform.kt +209 -0
  15. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberView.kt +496 -0
  16. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputPackage.kt +2 -1
  17. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputView.kt +107 -26
  18. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroNumberView.kt +1881 -0
  19. package/android/src/main/java/com/margelo/nitro/nitroinput/{MorphEngine.kt → ReflowEngine.kt} +2 -2
  20. package/android/src/main/java/com/margelo/nitro/nitroinput/RollingEngine.kt +60 -0
  21. package/cpp/AmountFormatter.cpp +5 -0
  22. package/cpp/AmountFormatter.hpp +10 -2
  23. package/cpp/{MorphEngine.cpp → ReflowEngine.cpp} +52 -47
  24. package/cpp/{MorphEngine.hpp → ReflowEngine.hpp} +12 -4
  25. package/cpp/RollingEngine.cpp +1234 -0
  26. package/cpp/RollingEngine.hpp +475 -0
  27. package/cpp/SwiftNonCopyable.hpp +22 -0
  28. package/cpp/numberformat/HybridNitroNumberFormat.cpp +498 -0
  29. package/cpp/numberformat/HybridNitroNumberFormat.hpp +74 -0
  30. package/cpp/numberformat/HybridNitroNumberFormatFactory.hpp +11 -0
  31. package/cpp/numberformat/NumberFormatCore.cpp +629 -0
  32. package/cpp/numberformat/NumberFormatCore.hpp +154 -0
  33. package/cpp/numberformat/NumberFormatProbe.cpp +354 -0
  34. package/cpp/numberformat/NumberFormatProbe.hpp +63 -0
  35. package/cpp/worklets/NitroInputWorkletsBridge.cpp +3 -3
  36. package/cpp/worklets/NitroInputWorkletsBridge.hpp +1 -1
  37. package/ios/{HybridMorphInputView.swift → HybridNitroInputView.swift} +16 -1
  38. package/ios/HybridNitroNumberFormatPlatform.swift +348 -0
  39. package/ios/HybridNitroNumberView.swift +458 -0
  40. package/ios/NitroInputView.swift +148 -64
  41. package/ios/NitroNumberView.swift +2074 -0
  42. package/lib/commonjs/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
  43. package/lib/commonjs/nitrogen/generated/shared/json/NitroNumberViewConfig.json +61 -0
  44. package/lib/commonjs/src/NitroInput.js +27 -56
  45. package/lib/commonjs/src/NitroNumber.js +141 -0
  46. package/lib/commonjs/src/NumberFormat.js +525 -0
  47. package/lib/commonjs/src/formatProps.js +48 -0
  48. package/lib/commonjs/src/index.js +6 -3
  49. package/lib/commonjs/src/specs/NitroNumber.nitro.js +2 -0
  50. package/lib/commonjs/src/specs/NumberFormat.nitro.js +2 -0
  51. package/lib/commonjs/src/styleHelpers.js +36 -0
  52. package/lib/module/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
  53. package/lib/module/nitrogen/generated/shared/json/NitroNumberViewConfig.json +61 -0
  54. package/lib/module/src/NitroInput.js +18 -47
  55. package/lib/module/src/NitroNumber.js +102 -0
  56. package/lib/module/src/NumberFormat.js +521 -0
  57. package/lib/module/src/formatProps.js +45 -0
  58. package/lib/module/src/index.js +2 -1
  59. package/lib/module/src/specs/NitroNumber.nitro.js +1 -0
  60. package/lib/module/src/specs/NumberFormat.nitro.js +1 -0
  61. package/lib/module/src/styleHelpers.js +32 -0
  62. package/lib/typescript/src/NitroInput.d.ts +50 -21
  63. package/lib/typescript/src/NitroNumber.d.ts +246 -0
  64. package/lib/typescript/src/NumberFormat.d.ts +47 -0
  65. package/lib/typescript/src/formatProps.d.ts +21 -0
  66. package/lib/typescript/src/index.d.ts +5 -2
  67. package/lib/typescript/src/specs/NitroInput.nitro.d.ts +19 -9
  68. package/lib/typescript/src/specs/NitroNumber.nitro.d.ts +250 -0
  69. package/lib/typescript/src/specs/NumberFormat.nitro.d.ts +139 -0
  70. package/lib/typescript/src/styleHelpers.d.ts +3 -0
  71. package/nitro.json +26 -0
  72. package/nitrogen/generated/android/NitroInput+autolinking.cmake +10 -0
  73. package/nitrogen/generated/android/NitroInputOnLoad.cpp +48 -0
  74. package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
  75. package/nitrogen/generated/android/c++/JFunc_void_double_double.hpp +10 -10
  76. package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.cpp +45 -0
  77. package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.hpp +10 -0
  78. package/nitrogen/generated/android/c++/JHybridNitroNumberFormatPlatformSpec.cpp +118 -0
  79. package/nitrogen/generated/android/c++/JHybridNitroNumberFormatPlatformSpec.hpp +64 -0
  80. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.cpp +590 -0
  81. package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.hpp +168 -0
  82. package/nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.cpp +65 -0
  83. package/nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.hpp +64 -0
  84. package/nitrogen/generated/android/c++/JNitroNumberAffixAlign.hpp +64 -0
  85. package/nitrogen/generated/android/c++/JNitroNumberDirection.hpp +64 -0
  86. package/nitrogen/generated/android/c++/JNitroNumberEasing.hpp +67 -0
  87. package/nitrogen/generated/android/c++/JNitroNumberRevealStyle.hpp +58 -0
  88. package/nitrogen/generated/android/c++/JNitroNumberTextAlign.hpp +64 -0
  89. package/nitrogen/generated/android/c++/JNitroNumberTransition.hpp +61 -0
  90. package/nitrogen/generated/android/c++/JNumberFormatCompactDisplay.hpp +58 -0
  91. package/nitrogen/generated/android/c++/JNumberFormatCurrencyDisplay.hpp +64 -0
  92. package/nitrogen/generated/android/c++/JNumberFormatCurrencySign.hpp +58 -0
  93. package/nitrogen/generated/android/c++/JNumberFormatNotation.hpp +64 -0
  94. package/nitrogen/generated/android/c++/JNumberFormatPlatformOptions.hpp +161 -0
  95. package/nitrogen/generated/android/c++/JNumberFormatPlatformSymbols.hpp +89 -0
  96. package/nitrogen/generated/android/c++/JNumberFormatRoundingMode.hpp +79 -0
  97. package/nitrogen/generated/android/c++/JNumberFormatSignDisplay.hpp +67 -0
  98. package/nitrogen/generated/android/c++/JNumberFormatStyle.hpp +64 -0
  99. package/nitrogen/generated/android/c++/JNumberFormatUnitDisplay.hpp +61 -0
  100. package/nitrogen/generated/android/c++/views/JHybridNitroInputViewStateUpdater.cpp +25 -0
  101. package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.cpp +329 -0
  102. package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.hpp +54 -0
  103. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/Func_void.kt +78 -0
  104. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/Func_void_double_double.kt +9 -9
  105. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroInputViewSpec.kt +30 -0
  106. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatformSpec.kt +60 -0
  107. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberViewSpec.kt +399 -0
  108. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroPlatformNumberFormatterSpec.kt +62 -0
  109. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberAffixAlign.kt +25 -0
  110. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberDirection.kt +25 -0
  111. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberEasing.kt +26 -0
  112. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberRevealStyle.kt +23 -0
  113. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberTextAlign.kt +25 -0
  114. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberTransition.kt +24 -0
  115. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCompactDisplay.kt +23 -0
  116. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCurrencyDisplay.kt +25 -0
  117. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCurrencySign.kt +23 -0
  118. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatNotation.kt +25 -0
  119. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatPlatformOptions.kt +136 -0
  120. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatPlatformSymbols.kt +91 -0
  121. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatRoundingMode.kt +30 -0
  122. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatSignDisplay.kt +26 -0
  123. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatStyle.kt +25 -0
  124. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatUnitDisplay.kt +24 -0
  125. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroNumberViewManager.kt +96 -0
  126. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroNumberViewStateUpdater.kt +23 -0
  127. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.cpp +59 -0
  128. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.hpp +311 -0
  129. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Umbrella.hpp +63 -0
  130. package/nitrogen/generated/ios/NitroInputAutolinking.mm +26 -0
  131. package/nitrogen/generated/ios/NitroInputAutolinking.swift +24 -0
  132. package/nitrogen/generated/ios/c++/HybridNitroInputViewSpecSwift.hpp +30 -0
  133. package/nitrogen/generated/ios/c++/HybridNitroNumberFormatPlatformSpecSwift.cpp +11 -0
  134. package/nitrogen/generated/ios/c++/HybridNitroNumberFormatPlatformSpecSwift.hpp +122 -0
  135. package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.cpp +11 -0
  136. package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.hpp +474 -0
  137. package/nitrogen/generated/ios/c++/HybridNitroPlatformNumberFormatterSpecSwift.cpp +11 -0
  138. package/nitrogen/generated/ios/c++/HybridNitroPlatformNumberFormatterSpecSwift.hpp +94 -0
  139. package/nitrogen/generated/ios/c++/views/HybridNitroInputViewComponent.mm +30 -0
  140. package/nitrogen/generated/ios/c++/views/HybridNitroNumberViewComponent.mm +450 -0
  141. package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
  142. package/nitrogen/generated/ios/swift/Func_void_double_double.swift +5 -5
  143. package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec.swift +5 -0
  144. package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec_cxx.swift +55 -0
  145. package/nitrogen/generated/ios/swift/HybridNitroNumberFormatPlatformSpec.swift +56 -0
  146. package/nitrogen/generated/ios/swift/HybridNitroNumberFormatPlatformSpec_cxx.swift +159 -0
  147. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec.swift +108 -0
  148. package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec_cxx.swift +1387 -0
  149. package/nitrogen/generated/ios/swift/HybridNitroPlatformNumberFormatterSpec.swift +56 -0
  150. package/nitrogen/generated/ios/swift/HybridNitroPlatformNumberFormatterSpec_cxx.swift +155 -0
  151. package/nitrogen/generated/ios/swift/NitroNumberAffixAlign.swift +48 -0
  152. package/nitrogen/generated/ios/swift/NitroNumberDirection.swift +48 -0
  153. package/nitrogen/generated/ios/swift/NitroNumberEasing.swift +52 -0
  154. package/nitrogen/generated/ios/swift/NitroNumberRevealStyle.swift +40 -0
  155. package/nitrogen/generated/ios/swift/NitroNumberTextAlign.swift +48 -0
  156. package/nitrogen/generated/ios/swift/NitroNumberTransition.swift +44 -0
  157. package/nitrogen/generated/ios/swift/NumberFormatCompactDisplay.swift +40 -0
  158. package/nitrogen/generated/ios/swift/NumberFormatCurrencyDisplay.swift +48 -0
  159. package/nitrogen/generated/ios/swift/NumberFormatCurrencySign.swift +40 -0
  160. package/nitrogen/generated/ios/swift/NumberFormatNotation.swift +48 -0
  161. package/nitrogen/generated/ios/swift/NumberFormatPlatformOptions.swift +159 -0
  162. package/nitrogen/generated/ios/swift/NumberFormatPlatformSymbols.swift +69 -0
  163. package/nitrogen/generated/ios/swift/NumberFormatRoundingMode.swift +68 -0
  164. package/nitrogen/generated/ios/swift/NumberFormatSignDisplay.swift +52 -0
  165. package/nitrogen/generated/ios/swift/NumberFormatStyle.swift +48 -0
  166. package/nitrogen/generated/ios/swift/NumberFormatUnitDisplay.swift +44 -0
  167. package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.cpp +10 -0
  168. package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.hpp +10 -0
  169. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatFactorySpec.cpp +22 -0
  170. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatFactorySpec.hpp +70 -0
  171. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatPlatformSpec.cpp +22 -0
  172. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatPlatformSpec.hpp +70 -0
  173. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatSpec.cpp +23 -0
  174. package/nitrogen/generated/shared/c++/HybridNitroNumberFormatSpec.hpp +71 -0
  175. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.cpp +127 -0
  176. package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.hpp +187 -0
  177. package/nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.cpp +23 -0
  178. package/nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.hpp +65 -0
  179. package/nitrogen/generated/shared/c++/NitroNumberAffixAlign.hpp +84 -0
  180. package/nitrogen/generated/shared/c++/NitroNumberDirection.hpp +84 -0
  181. package/nitrogen/generated/shared/c++/NitroNumberEasing.hpp +88 -0
  182. package/nitrogen/generated/shared/c++/NitroNumberRevealStyle.hpp +76 -0
  183. package/nitrogen/generated/shared/c++/NitroNumberTextAlign.hpp +84 -0
  184. package/nitrogen/generated/shared/c++/NitroNumberTransition.hpp +80 -0
  185. package/nitrogen/generated/shared/c++/NumberFormatCompactDisplay.hpp +76 -0
  186. package/nitrogen/generated/shared/c++/NumberFormatCurrencyDisplay.hpp +84 -0
  187. package/nitrogen/generated/shared/c++/NumberFormatCurrencySign.hpp +76 -0
  188. package/nitrogen/generated/shared/c++/NumberFormatGrouping.hpp +80 -0
  189. package/nitrogen/generated/shared/c++/NumberFormatNotation.hpp +84 -0
  190. package/nitrogen/generated/shared/c++/NumberFormatOptions.hpp +193 -0
  191. package/nitrogen/generated/shared/c++/NumberFormatPart.hpp +87 -0
  192. package/nitrogen/generated/shared/c++/NumberFormatPlatformOptions.hpp +176 -0
  193. package/nitrogen/generated/shared/c++/NumberFormatPlatformSymbols.hpp +115 -0
  194. package/nitrogen/generated/shared/c++/NumberFormatRoundingMode.hpp +104 -0
  195. package/nitrogen/generated/shared/c++/NumberFormatRoundingPriority.hpp +80 -0
  196. package/nitrogen/generated/shared/c++/NumberFormatSignDisplay.hpp +88 -0
  197. package/nitrogen/generated/shared/c++/NumberFormatStyle.hpp +84 -0
  198. package/nitrogen/generated/shared/c++/NumberFormatTrailingZeroDisplay.hpp +76 -0
  199. package/nitrogen/generated/shared/c++/NumberFormatUnitDisplay.hpp +80 -0
  200. package/nitrogen/generated/shared/c++/ResolvedNumberFormatOptions.hpp +197 -0
  201. package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.cpp +10 -0
  202. package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.hpp +15 -0
  203. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.cpp +136 -0
  204. package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.hpp +245 -0
  205. package/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
  206. package/nitrogen/generated/shared/json/NitroNumberViewConfig.json +61 -0
  207. package/package.json +15 -7
  208. package/src/NitroInput.tsx +79 -67
  209. package/src/NitroNumber.tsx +531 -0
  210. package/src/NumberFormat.ts +563 -0
  211. package/src/formatProps.ts +59 -0
  212. package/src/index.ts +38 -6
  213. package/src/specs/NitroInput.nitro.ts +19 -9
  214. package/src/specs/NitroNumber.nitro.ts +271 -0
  215. package/src/specs/NumberFormat.nitro.ts +145 -0
  216. package/src/styleHelpers.ts +32 -0
  217. package/android/src/main/cpp/JMorphEngine.cpp +0 -132
  218. package/lib/commonjs/src/MorphInput.js +0 -42
  219. package/lib/module/src/MorphInput.js +0 -6
  220. package/lib/typescript/src/MorphInput.d.ts +0 -18
  221. package/src/MorphInput.tsx +0 -30
package/src/index.ts CHANGED
@@ -8,15 +8,10 @@ export {
8
8
  type NitroInputFocusEvent,
9
9
  type NitroInputSelectionEvent,
10
10
  type NitroInputKeyPressEvent,
11
+ type NitroInputTransition,
11
12
  type InputMode,
12
13
  type EnterKeyHint,
13
14
  } from './NitroInput'
14
- export {
15
- MorphInput,
16
- type MorphInputProps,
17
- type MorphInputHandle,
18
- type MorphInputRef,
19
- } from './MorphInput'
20
15
  export {
21
16
  isWorklet,
22
17
  type NitroInputSelection,
@@ -53,3 +48,40 @@ export type {
53
48
  NitroInputView,
54
49
  } from './specs/NitroInput.nitro'
55
50
  export type { NitroInputWorklets } from './specs/NitroInputWorklets.nitro'
51
+
52
+ export {
53
+ NitroNumber,
54
+ NativeNitroNumberView,
55
+ type NitroNumberProps,
56
+ type NitroNumberHandle,
57
+ type NitroNumberRef,
58
+ } from './NitroNumber'
59
+ export type {
60
+ NitroNumberAffixAlign,
61
+ NitroNumberDirection,
62
+ NitroNumberTransition,
63
+ NitroNumberEasing,
64
+ NitroNumberRevealStyle,
65
+ NitroNumberTextAlign,
66
+ NitroNumberMethods,
67
+ NitroNumberProps as NativeNitroNumberProps,
68
+ NitroNumberView,
69
+ } from './specs/NitroNumber.nitro'
70
+
71
+ export { NumberFormat, type NumberFormatConstructor, type NumberFormatRangePart } from './NumberFormat'
72
+ export type {
73
+ NumberFormatOptions,
74
+ NumberFormatPart,
75
+ ResolvedNumberFormatOptions,
76
+ NumberFormatStyle,
77
+ NumberFormatCurrencyDisplay,
78
+ NumberFormatCurrencySign,
79
+ NumberFormatUnitDisplay,
80
+ NumberFormatNotation,
81
+ NumberFormatCompactDisplay,
82
+ NumberFormatSignDisplay,
83
+ NumberFormatRoundingMode,
84
+ NumberFormatRoundingPriority,
85
+ NumberFormatTrailingZeroDisplay,
86
+ NumberFormatGrouping,
87
+ } from './specs/NumberFormat.nitro'
@@ -25,7 +25,7 @@ export interface NitroInputNotation {
25
25
  }
26
26
 
27
27
  /**
28
- * Timing curve of the morph. `'expo'` is Torph's default
28
+ * Timing curve of the reflow. `'expo'` is Torph's default
29
29
  * (`cubic-bezier(0.19, 1, 0.22, 1)`): a fast take-off that settles gently.
30
30
  */
31
31
  export type NitroInputEasing =
@@ -74,7 +74,7 @@ export type NitroInputTextAlignVertical = 'auto' | 'top' | 'center' | 'bottom'
74
74
  * `'beforeAffix'` (the default) reads `-$1,234.56`, which is how a locale that
75
75
  * leads with its symbol writes it. `'afterAffix'` reads `$-1,234.56`, which
76
76
  * suits a symbol styled as an ornament rather than read as part of the number -
77
- * small, raised, in another colour. Only the morph honours it: a plain field's
77
+ * small, raised, in another colour. Only the reflow honours it: a plain field's
78
78
  * affixes are accessory views that sit outside the text, so it is always
79
79
  * `'afterAffix'`.
80
80
  */
@@ -136,7 +136,7 @@ export interface NitroInputProps extends HybridViewProps {
136
136
  /** `'text'`, `'number'` or `'mask'`. Default: `'text'`. */
137
137
  mode: NitroInputMode
138
138
  /**
139
- * Draw the text with the system field itself and skip the morph overlay
139
+ * Draw the text with the system field itself and skip the reflow overlay
140
140
  * entirely: no glyph engine, no per-glyph layers, no custom caret. This is
141
141
  * what `NitroInput` renders — an ordinary native input that keeps the rest of
142
142
  * the component (native formatting, the focus path, the text-input registry
@@ -220,13 +220,23 @@ export interface NitroInputProps extends HybridViewProps {
220
220
  prefixAlign: NitroInputAffixAlign
221
221
  /** Vertical alignment of `suffix` relative to the text (the wrapper folds its `affixAlign` into this). */
222
222
  suffixAlign: NitroInputAffixAlign
223
- /** Shown (and morphed away) while the field is empty. Default: `''`. */
223
+ /** Points added after every glyph, like `Text`'s `letterSpacing`; an affix gets it in proportion to its size. */
224
+ letterSpacing: number
225
+ /** Points between the prefix and the text, in place of the letter spacing there. Not finite: the letter spacing. */
226
+ prefixSpacing: number
227
+ /** Points between the text and the suffix, in place of the letter spacing there. Not finite: the letter spacing. */
228
+ suffixSpacing: number
229
+ /** Points the prefix is moved down after its alignment (negative: up). */
230
+ prefixOffset: number
231
+ /** Points the suffix is moved down after its alignment (negative: up). */
232
+ suffixOffset: number
233
+ /** Shown (and reflowed away) while the field is empty. Default: `''`. */
224
234
  placeholder: string
225
235
  /** Color of the placeholder as a processed ARGB integer; `NaN` = platform default. */
226
236
  placeholderColor: number
227
- /** Duration in ms of the morph played on every change. `0` snaps. Default: `400`. */
237
+ /** Duration in ms of the reflow played on every change. `0` snaps. Default: `400`. */
228
238
  duration: number
229
- /** Timing curve of the morph. Default: `'expo'`. */
239
+ /** Timing curve of the reflow. Default: `'expo'`. */
230
240
  easing: NitroInputEasing
231
241
  /** Overshoot of the `'spring'` easing, `0`–`1`. Default: `0.15`. */
232
242
  bounce: number
@@ -292,9 +302,9 @@ export interface NitroInputProps extends HybridViewProps {
292
302
  * Let the text wrap onto more than one line.
293
303
  *
294
304
  * A multiline field is always drawn by the system view — the glyph engine
295
- * lays one run out on one baseline, so it cannot morph wrapped text — and it
305
+ * lays one run out on one baseline, so it cannot reflow wrapped text — and it
296
306
  * is always `'text'` mode, since an amount and a mask are single-line ideas.
297
- * Setting `morph`, `'number'` or `'mask'` alongside it is ignored, with a
307
+ * Setting `transition="reflow"`, `'number'` or `'mask'` alongside it is ignored, with a
298
308
  * warning. Default: `false`.
299
309
  */
300
310
  multiline: boolean
@@ -411,7 +421,7 @@ export interface NitroInputProps extends HybridViewProps {
411
421
  export interface NitroInputMethods extends HybridViewMethods {
412
422
  focus(): void
413
423
  blur(): void
414
- /** Empties the field (morphing the characters away). */
424
+ /** Empties the field (reflowing the characters away). */
415
425
  clear(): void
416
426
  /**
417
427
  * Replaces the text (formatted in `'number'` mode), caret at the end.
@@ -0,0 +1,271 @@
1
+ import type {
2
+ HybridView,
3
+ HybridViewMethods,
4
+ HybridViewProps,
5
+ } from 'react-native-nitro-modules'
6
+
7
+ /** Horizontal alignment of the number inside the view's frame. */
8
+ /**
9
+ * `'auto'` is the start edge of the layout direction - left in a left-to-right
10
+ * app, right in a right-to-left one - which is what `Text` does with no
11
+ * `textAlign`; in a view that hugs the number it is the edge the parent keeps
12
+ * the view to (the end of a row: right), so the digits open and close against
13
+ * it. `'left'` and `'right'` are absolute, whatever the direction.
14
+ */
15
+ export type NitroNumberTextAlign = 'auto' | 'left' | 'center' | 'right'
16
+
17
+ /** Timing curve used when a value change is rolled natively. */
18
+ export type NitroNumberEasing =
19
+ | 'linear'
20
+ | 'easeIn'
21
+ | 'easeOut'
22
+ | 'easeInOut'
23
+ | 'spring'
24
+
25
+ /** Which way the digits roll: `'auto'` follows the sign of the change. */
26
+ export type NitroNumberDirection = 'auto' | 'up' | 'down' | 'shortest'
27
+
28
+ /**
29
+ * How a value change plays. `'roll'` is the odometer: every changed digit
30
+ * rolls through the digits between its old and new glyph. `'numeric'` is the
31
+ * numeric transition of SwiftUI's `.contentTransition(.numericText())`: each
32
+ * changed glyph swaps in place, the old one softening, shrinking and sliding
33
+ * out while the new one slides in from the other side and comes into focus,
34
+ * digits cascading from the left; the unchanged digits stay put. `'scramble'`
35
+ * shows a different random digit every few frames until each changed digit
36
+ * locks on its target, from the left.
37
+ */
38
+ export type NitroNumberTransition = 'roll' | 'numeric' | 'scramble'
39
+
40
+ /**
41
+ * How a jackpot reveal plays: `'count'` is the casino win-meter rollup (the
42
+ * figure counts up from 0, digits swapping in place); `'spin'` is the jackpot
43
+ * reels (every digit spins like a slot reel, then the reels lock one at a
44
+ * time from the left).
45
+ */
46
+ export type NitroNumberRevealStyle = 'count' | 'spin'
47
+
48
+ /**
49
+ * How a prefix/suffix drawn at a different size lines up with the digits:
50
+ * `top` pins glyph tops (cap height), `bottom` pins the bottom of the line
51
+ * boxes, `baseline` shares the digits' baseline, `center` centres the boxes.
52
+ */
53
+ export type NitroNumberAffixAlign = 'baseline' | 'center' | 'top' | 'bottom'
54
+
55
+ export interface NitroNumberProps extends HybridViewProps {
56
+ /**
57
+ * The number to display.
58
+ *
59
+ * When this prop changes, every digit rolls natively from its old glyph to
60
+ * its new glyph (in the direction of the change), using `duration` and
61
+ * `easing`. The very first value is displayed without an animation.
62
+ *
63
+ * Reading it on the hybrid ref returns the value the view is currently
64
+ * showing or rolling towards (also after `jumpTo` / `animateTo`).
65
+ *
66
+ * At most 18 digits are shown: `|value| × 10^fractionDigits` is clamped at
67
+ * 10^17 (the same limit for a jump and a roll), and a JS number carries exact
68
+ * integers only up to 2^53.
69
+ */
70
+ value: number
71
+ /** Digits shown after the decimal separator. Default: `0`. */
72
+ fractionDigits?: number
73
+ /** Zero-pads the integer part to at least this many digits. Default: `1`. */
74
+ minimumIntegerDigits?: number
75
+ /** Inserted between every three integer digits. Empty string disables grouping. Default: `''`. */
76
+ groupingSeparator?: string
77
+ /** Placed between the integer and fraction digits. Default: `'.'`. */
78
+ decimalSeparator?: string
79
+ /** Static text drawn before the number (e.g. `'$'`). Default: `''`. */
80
+ prefix?: string
81
+ /** Static text drawn after the number (e.g. `'%'`). Default: `''`. */
82
+ suffix?: string
83
+ /**
84
+ * Duration in milliseconds of the native roll that plays when `value` changes.
85
+ * `0` snaps to the new value immediately. Default: `500`.
86
+ */
87
+ duration?: number
88
+ /** Timing curve of the native roll. Default: `'easeInOut'`. */
89
+ easing?: NitroNumberEasing
90
+ /** Overshoot of the `'spring'` easing, from `0` (none) to `1`. Default: `0.15`. */
91
+ bounce?: number
92
+ /**
93
+ * Delay in ms between the start of each digit's roll, from the least
94
+ * significant digit upwards (a cascading carry). Default: `0`.
95
+ */
96
+ stagger?: number
97
+ /**
98
+ * How a value change plays: the odometer roll, or the numeric transition
99
+ * (glyphs swap in place). Default: `'roll'`.
100
+ */
101
+ transition?: NitroNumberTransition
102
+ /**
103
+ * The change flash: every digit whose glyph changes lights up in this
104
+ * colour when the value grew, fading back over `flashDuration`. A processed
105
+ * ARGB integer; `Infinity` (the wrapper's "unset") turns the flash off.
106
+ */
107
+ flashUpColor?: number
108
+ /** The change flash's colour when the value shrank. `Infinity` = off. */
109
+ flashDownColor?: number
110
+ /** Milliseconds a change flash takes to fade. Default: `600`. */
111
+ flashDuration?: number
112
+ /**
113
+ * A punch of the whole figure on every value change, its peak overshoot
114
+ * as a fraction of the size, `0` (none, the default) to `1`; rung out like
115
+ * the reveal's landing pop.
116
+ */
117
+ popOnChange?: number
118
+ /**
119
+ * Which way the digits roll. Default: `'auto'`.
120
+ *
121
+ * Named `rollDirection` and not `direction` because a Hybrid View's props
122
+ * derive from `react::ViewProps`, so React Native parses every name we
123
+ * declare as well: `direction` is Yoga's layout property, and it logged
124
+ * `Could not parse yoga::Direction: up` on every update. The public prop the
125
+ * wrapper exposes is still `direction`; see `NitroNumber.tsx`.
126
+ */
127
+ rollDirection?: NitroNumberDirection
128
+ /**
129
+ * Jackpot reveal state. `0` (default): a normal NitroNumber, `value`
130
+ * changes roll. `1`: the view shows the opening frame of `value`, its layout
131
+ * with every digit blank except the mandatory ones ("$0.00"). `2`: the
132
+ * figure plays its `revealStyle` (counts up from 0, or spins its reels) to
133
+ * `value` and lands with a pop. The JS wrapper maps its `reveal` boolean to
134
+ * this; it is a number so the wrapper can always pass it (an optional prop
135
+ * that is removed reaches native as `null`, which Nitro's parser rejects).
136
+ */
137
+ revealState?: number
138
+ /** How the reveal plays. Default: `'count'`. */
139
+ revealStyle?: NitroNumberRevealStyle
140
+ /** Duration of the reveal in ms (the count, or the time until the last reel locks). Default: `2200`. */
141
+ revealDuration?: number
142
+ /** Peak overshoot of the reveal's landing pop, `0` (none) to `1`. Default: `0.12`. */
143
+ revealBounce?: number
144
+ /**
145
+ * `'count'` style: how much smaller the figure opens, as a fraction of its
146
+ * size, growing to full size over the count (a big win's meter is enlarged
147
+ * as it climbs). `0` = no growth. Default: `0.2`.
148
+ */
149
+ revealGrow?: number
150
+ /**
151
+ * `'spin'` style: delay in ms between one reel locking and the next, from
152
+ * the left. Shortened automatically when the reels wouldn't fit `revealDuration`. Default: `200`.
153
+ */
154
+ revealStagger?: number
155
+ /**
156
+ * `'count'` style: win tiers, in the figure's units. When the count reaches
157
+ * one the figure punches, pauses on it for `revealMilestoneHold` and
158
+ * `onRevealMilestone` fires. Values at or above `value` are ignored.
159
+ */
160
+ revealMilestones?: number[]
161
+ /** `'count'` style: ms the count pauses on each milestone. Default: `0`. */
162
+ revealMilestoneHold?: number
163
+ /**
164
+ * Shows a "shine" glint over the number: the ink keeps its color while a
165
+ * slanted, text-wide band of `shimmerColor` sweeps through the glyphs.
166
+ * Toggling fades the glint in/out. Default: `false`.
167
+ */
168
+ loading?: boolean
169
+ /**
170
+ * Color of the glint's core as a processed ARGB integer. Defaults to a light
171
+ * neutral (`#D6D9E1`, or `#2B2E37` in dark mode).
172
+ */
173
+ shimmerColor?: number
174
+ /** Duration of one sweep in ms (linear, repeating). Default: `950`. */
175
+ shimmerDuration?: number
176
+ /** Font size of the digits in points. Default: `32`. */
177
+ fontSize?: number
178
+ /** Font size of `prefix` in points. Defaults to `fontSize`. */
179
+ prefixFontSize?: number
180
+ /** Font size of `suffix` in points. Defaults to `fontSize`. */
181
+ suffixFontSize?: number
182
+ /** Vertical alignment of prefix and suffix relative to the digits. Default: `'baseline'`. */
183
+ affixAlign?: NitroNumberAffixAlign
184
+ /** Vertical alignment of `prefix` only. Defaults to `affixAlign`. */
185
+ prefixAlign?: NitroNumberAffixAlign
186
+ /** Vertical alignment of `suffix` only. Defaults to `affixAlign`. */
187
+ suffixAlign?: NitroNumberAffixAlign
188
+ /** Points added after every glyph, like `Text`'s `letterSpacing`; an affix gets it in proportion to its size. Default: `0`. */
189
+ letterSpacing?: number
190
+ /** Points between the prefix and the digits, in place of the letter spacing there. Not finite: the letter spacing. */
191
+ prefixSpacing?: number
192
+ /** Points between the digits and the suffix, in place of the letter spacing there. Not finite: the letter spacing. */
193
+ suffixSpacing?: number
194
+ /** Points the prefix is moved down after its alignment (negative: up). Default: `0`. */
195
+ prefixOffset?: number
196
+ /** Points the suffix is moved down after its alignment (negative: up). Default: `0`. */
197
+ suffixOffset?: number
198
+ /** Every digit as wide as the widest (`true`, the default), or each digit at its own width. */
199
+ tabularNums?: boolean
200
+ /**
201
+ * When the view is narrower than the number (e.g. it has a fixed `width` or
202
+ * `maxWidth`), scale the whole number down so it fits. Default: `false`.
203
+ */
204
+ adjustsFontSizeToFit?: boolean
205
+ /** Smallest scale `adjustsFontSizeToFit` may apply, `0`–`1`. Default: `0.5`. */
206
+ minimumFontScale?: number
207
+ /**
208
+ * Scale the fonts with the user's system text size (Dynamic Type / Android
209
+ * font scale), like `Text`. Off by default so amounts keep their design size.
210
+ */
211
+ allowFontScaling?: boolean
212
+ /** Upper bound for `allowFontScaling`, e.g. `1.3`. `0` means no cap. Default: `0`. */
213
+ maxFontSizeMultiplier?: number
214
+ /** Numeric font weight, `100`–`900`. Default: `400`. */
215
+ fontWeight?: number
216
+ /** Font family name. Defaults to the system font. */
217
+ fontFamily?: string
218
+ /** Text color as a processed ARGB integer (from `processColor`). Defaults to the platform label color. */
219
+ color?: number
220
+ /** Where the number sits inside the view when the view is wider than the number. Default: `'auto'`, the start edge. */
221
+ textAlign?: NitroNumberTextAlign
222
+ /**
223
+ * Lay the figure out right-to-left: `'auto'` alignment resolves to the right
224
+ * edge, the prefix moves to the right and the suffix to the left, and the
225
+ * digits still read left to right. Fabric does not hand a Hybrid View its
226
+ * layout direction, so the JS side resolves it - from the view's
227
+ * `style.direction`, else `I18nManager.isRTL` - the way React Native
228
+ * resolves its own views. Default: `false`.
229
+ */
230
+ rightToLeft?: boolean
231
+ /**
232
+ * Called whenever the settled (target) intrinsic size of the number changes,
233
+ * e.g. after the first layout, when a digit column appears/disappears, or
234
+ * when the font changes. `NitroNumber` uses this to size itself.
235
+ */
236
+ onSizeChange?: (width: number, height: number) => void
237
+ /**
238
+ * Called when a reveal has landed: the count reached `value` and the landing
239
+ * pop has rung out. Sequence whatever follows the figure (a haptic, the next
240
+ * block of copy) from here.
241
+ */
242
+ onRevealEnd?: () => void
243
+ /**
244
+ * Called when a count-style reveal reaches a milestone, with its index in
245
+ * the sorted usable milestones and its value: the moment to swap the win
246
+ * banner, fire the confetti and play the sting.
247
+ */
248
+ onRevealMilestone?: (index: number, value: number) => void
249
+ }
250
+
251
+ export interface NitroNumberMethods extends HybridViewMethods {
252
+ /**
253
+ * Displays `value` immediately, positioning the digit columns continuously
254
+ * (odometer style: `12.5` shows the last digit half way between `2` and `3`).
255
+ * No animation is started and any running roll is cancelled. Useful for
256
+ * scrubbing (scroll / drag handlers). Safe to call from any thread.
257
+ */
258
+ jumpTo(value: number): void
259
+ /** Rolls to `value` natively, exactly like changing the `value` prop. Safe to call from any thread. */
260
+ animateTo(value: number): void
261
+ /**
262
+ * Plays a jackpot reveal to `value` in the current `revealStyle` (see the
263
+ * `reveal` prop) regardless of the prop's state. Safe to call from any thread.
264
+ */
265
+ revealTo(value: number): void
266
+ }
267
+
268
+ export type NitroNumberView = HybridView<
269
+ NitroNumberProps,
270
+ NitroNumberMethods
271
+ >
@@ -0,0 +1,145 @@
1
+ import type { HybridObject, Int64 } from 'react-native-nitro-modules'
2
+
3
+ // The option types of `Intl.NumberFormat` (ECMA-402), for the native `NumberFormat`.
4
+
5
+ export type NumberFormatStyle = 'decimal' | 'currency' | 'percent' | 'unit'
6
+ export type NumberFormatCurrencyDisplay = 'symbol' | 'narrowSymbol' | 'code' | 'name'
7
+ export type NumberFormatCurrencySign = 'standard' | 'accounting'
8
+ export type NumberFormatUnitDisplay = 'short' | 'narrow' | 'long'
9
+ export type NumberFormatNotation = 'standard' | 'scientific' | 'engineering' | 'compact'
10
+ export type NumberFormatCompactDisplay = 'short' | 'long'
11
+ export type NumberFormatSignDisplay = 'auto' | 'never' | 'always' | 'exceptZero' | 'negative'
12
+ export type NumberFormatRoundingMode = 'ceil' | 'floor' | 'expand' | 'trunc' | 'halfCeil' | 'halfFloor' | 'halfExpand' | 'halfTrunc' | 'halfEven'
13
+ export type NumberFormatRoundingPriority = 'auto' | 'morePrecision' | 'lessPrecision'
14
+ export type NumberFormatTrailingZeroDisplay = 'auto' | 'stripIfInteger'
15
+ export type NumberFormatGrouping = 'always' | 'auto' | 'min2'
16
+
17
+ /** `Intl.NumberFormatOptions`, less `localeMatcher` (the lookup matcher is always used). */
18
+ export interface NumberFormatOptions {
19
+ numberingSystem?: string
20
+ style?: NumberFormatStyle
21
+ currency?: string
22
+ currencyDisplay?: NumberFormatCurrencyDisplay
23
+ currencySign?: NumberFormatCurrencySign
24
+ unit?: string
25
+ unitDisplay?: NumberFormatUnitDisplay
26
+ minimumIntegerDigits?: number
27
+ minimumFractionDigits?: number
28
+ maximumFractionDigits?: number
29
+ minimumSignificantDigits?: number
30
+ maximumSignificantDigits?: number
31
+ roundingPriority?: NumberFormatRoundingPriority
32
+ roundingIncrement?: number
33
+ roundingMode?: NumberFormatRoundingMode
34
+ trailingZeroDisplay?: NumberFormatTrailingZeroDisplay
35
+ notation?: NumberFormatNotation
36
+ compactDisplay?: NumberFormatCompactDisplay
37
+ useGrouping?: boolean | NumberFormatGrouping
38
+ signDisplay?: NumberFormatSignDisplay
39
+ }
40
+
41
+ /** `Intl.ResolvedNumberFormatOptions`. */
42
+ export interface ResolvedNumberFormatOptions {
43
+ locale: string
44
+ numberingSystem: string
45
+ style: NumberFormatStyle
46
+ currency?: string
47
+ currencyDisplay?: NumberFormatCurrencyDisplay
48
+ currencySign?: NumberFormatCurrencySign
49
+ unit?: string
50
+ unitDisplay?: NumberFormatUnitDisplay
51
+ minimumIntegerDigits: number
52
+ minimumFractionDigits?: number
53
+ maximumFractionDigits?: number
54
+ minimumSignificantDigits?: number
55
+ maximumSignificantDigits?: number
56
+ useGrouping: boolean | NumberFormatGrouping
57
+ notation: NumberFormatNotation
58
+ compactDisplay?: NumberFormatCompactDisplay
59
+ signDisplay: NumberFormatSignDisplay
60
+ roundingIncrement: number
61
+ roundingMode: NumberFormatRoundingMode
62
+ roundingPriority: NumberFormatRoundingPriority
63
+ trailingZeroDisplay: NumberFormatTrailingZeroDisplay
64
+ }
65
+
66
+ /** One piece of a formatted number, as `Intl.NumberFormat#formatToParts` reports it. */
67
+ export interface NumberFormatPart {
68
+ type: string
69
+ value: string
70
+ }
71
+
72
+ /**
73
+ * A number formatter with the API of `Intl.NumberFormat`. It learns a
74
+ * locale's format once from the platform (Foundation on iOS, ICU on Android)
75
+ * and formats in C++ from then on, without calling into the platform per
76
+ * number. Instances are immutable and shared: the same locales and options
77
+ * return the same object.
78
+ */
79
+ export interface NitroNumberFormat extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
80
+ format(value: number | Int64 | string): string
81
+ formatToParts(value: number | Int64 | string): NumberFormatPart[]
82
+ resolvedOptions(): ResolvedNumberFormatOptions
83
+ }
84
+
85
+ export interface NitroNumberFormatFactory extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
86
+ create(locales: string[], options: NumberFormatOptions): NitroNumberFormat
87
+ supportedLocalesOf(locales: string[]): string[]
88
+ }
89
+
90
+ // ---------------------------------------------------------------------------
91
+ // The platform side, used by the C++ formatter only: builds the system's own
92
+ // formatter for a configuration, so C++ can learn the locale's format from it,
93
+ // and formats with it where C++ does not (compact and scientific notation,
94
+ // units, currency names).
95
+
96
+ export interface NumberFormatPlatformOptions {
97
+ locales: string[]
98
+ numberingSystem?: string
99
+ style: NumberFormatStyle
100
+ currency?: string
101
+ currencyDisplay: NumberFormatCurrencyDisplay
102
+ currencySign: NumberFormatCurrencySign
103
+ unit?: string
104
+ unitDisplay: NumberFormatUnitDisplay
105
+ notation: NumberFormatNotation
106
+ compactDisplay: NumberFormatCompactDisplay
107
+ useGrouping: boolean
108
+ minimumIntegerDigits: number
109
+ minimumFractionDigits: number
110
+ maximumFractionDigits: number
111
+ /** 0 when significant digits are not used. */
112
+ minimumSignificantDigits: number
113
+ maximumSignificantDigits: number
114
+ roundingMode: NumberFormatRoundingMode
115
+ signDisplay: NumberFormatSignDisplay
116
+ }
117
+
118
+ export interface NumberFormatPlatformSymbols {
119
+ /** The locale the platform resolved the request to, as a BCP 47 tag. */
120
+ locale: string
121
+ numberingSystem: string
122
+ minusSign: string
123
+ plusSign: string
124
+ percentSign: string
125
+ /** The currency as this formatter shows it (symbol, narrow symbol or code). */
126
+ currency: string
127
+ /** The locale's symbol for NaN. */
128
+ nan: string
129
+ /** The locale's symbol for infinity, without a sign. */
130
+ infinity: string
131
+ /** The "E" of scientific notation. */
132
+ exponentSeparator: string
133
+ }
134
+
135
+ export interface NitroPlatformNumberFormatter extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
136
+ readonly symbols: NumberFormatPlatformSymbols
137
+ format(value: number): string
138
+ /** A decimal string, formatted without going through a double. */
139
+ formatDecimal(value: string): string
140
+ }
141
+
142
+ export interface NitroNumberFormatPlatform extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
143
+ create(options: NumberFormatPlatformOptions): NitroPlatformNumberFormatter
144
+ supportedLocalesOf(locales: string[]): string[]
145
+ }
@@ -0,0 +1,32 @@
1
+ import { processColor, type ColorValue, type TextStyle } from 'react-native'
2
+
3
+ // Style resolution shared by `NitroNumber` and `NitroInput`.
4
+
5
+ const FONT_WEIGHTS: Record<string, number> = {
6
+ normal: 400,
7
+ regular: 400,
8
+ bold: 700,
9
+ ultralight: 100,
10
+ thin: 200,
11
+ light: 300,
12
+ medium: 500,
13
+ semibold: 600,
14
+ condensedBold: 700,
15
+ condensed: 400,
16
+ heavy: 800,
17
+ black: 900,
18
+ }
19
+
20
+ export function toNumericWeight(weight: TextStyle['fontWeight']): number | undefined {
21
+ if (weight == null) return undefined
22
+ if (typeof weight === 'number') return weight
23
+ const parsed = Number(weight)
24
+ if (!Number.isNaN(parsed)) return parsed
25
+ return FONT_WEIGHTS[weight]
26
+ }
27
+
28
+ export function toProcessedColor(color: ColorValue | undefined): number | undefined {
29
+ if (color == null) return undefined
30
+ const processed = processColor(color)
31
+ return typeof processed === 'number' ? processed : undefined
32
+ }