react-native-nitro-input 0.1.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 (187) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/LICENSE +21 -0
  3. package/NitroInput.podspec +54 -0
  4. package/README.md +524 -0
  5. package/android/CMakeLists.txt +52 -0
  6. package/android/build.gradle +158 -0
  7. package/android/fix-prefab.gradle +51 -0
  8. package/android/gradle.properties +4 -0
  9. package/android/src/main/AndroidManifest.xml +2 -0
  10. package/android/src/main/cpp/JAmountFormatter.cpp +70 -0
  11. package/android/src/main/cpp/JAmountFormatter.hpp +45 -0
  12. package/android/src/main/cpp/JMaskEngine.cpp +81 -0
  13. package/android/src/main/cpp/JMaskEngine.hpp +52 -0
  14. package/android/src/main/cpp/JMorphEngine.cpp +132 -0
  15. package/android/src/main/cpp/JMorphEngine.hpp +54 -0
  16. package/android/src/main/cpp/JNitroInputWorklets.cpp +83 -0
  17. package/android/src/main/cpp/JNitroInputWorklets.hpp +40 -0
  18. package/android/src/main/cpp/JOutlineGeometry.cpp +58 -0
  19. package/android/src/main/cpp/JOutlineGeometry.hpp +55 -0
  20. package/android/src/main/cpp/cpp-adapter.cpp +19 -0
  21. package/android/src/main/java/com/margelo/nitro/nitroinput/AmountFormatter.kt +35 -0
  22. package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroInputView.kt +730 -0
  23. package/android/src/main/java/com/margelo/nitro/nitroinput/MaskEngine.kt +50 -0
  24. package/android/src/main/java/com/margelo/nitro/nitroinput/MorphEngine.kt +47 -0
  25. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputPackage.kt +24 -0
  26. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputView.kt +2176 -0
  27. package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputWorklets.kt +34 -0
  28. package/android/src/main/java/com/margelo/nitro/nitroinput/OutlineGeometry.kt +71 -0
  29. package/cpp/AmountFormatter.cpp +346 -0
  30. package/cpp/AmountFormatter.hpp +88 -0
  31. package/cpp/MaskEngine.cpp +596 -0
  32. package/cpp/MaskEngine.hpp +136 -0
  33. package/cpp/MorphEngine.cpp +904 -0
  34. package/cpp/MorphEngine.hpp +213 -0
  35. package/cpp/OutlineGeometry.cpp +159 -0
  36. package/cpp/OutlineGeometry.hpp +107 -0
  37. package/cpp/worklets/HybridNitroInputWorklets.cpp +30 -0
  38. package/cpp/worklets/HybridNitroInputWorklets.hpp +30 -0
  39. package/cpp/worklets/NitroInputWorkletsBridge.cpp +203 -0
  40. package/cpp/worklets/NitroInputWorkletsBridge.hpp +52 -0
  41. package/cpp/worklets/NitroInputWorkletsBridgeJSI.hpp +23 -0
  42. package/ios/HybridMorphInputView.swift +710 -0
  43. package/ios/NitroInputCommands.mm +66 -0
  44. package/ios/NitroInputView.swift +2600 -0
  45. package/lib/commonjs/nitrogen/generated/shared/json/NitroInputViewConfig.json +101 -0
  46. package/lib/commonjs/src/MorphInput.js +42 -0
  47. package/lib/commonjs/src/NitroInput.js +623 -0
  48. package/lib/commonjs/src/index.js +12 -0
  49. package/lib/commonjs/src/specs/NitroInput.nitro.js +2 -0
  50. package/lib/commonjs/src/specs/NitroInputWorklets.nitro.js +2 -0
  51. package/lib/commonjs/src/useNitroInputState.js +58 -0
  52. package/lib/commonjs/src/worklets.js +226 -0
  53. package/lib/module/nitrogen/generated/shared/json/NitroInputViewConfig.json +101 -0
  54. package/lib/module/package.json +1 -0
  55. package/lib/module/src/MorphInput.js +6 -0
  56. package/lib/module/src/NitroInput.js +584 -0
  57. package/lib/module/src/index.js +4 -0
  58. package/lib/module/src/specs/NitroInput.nitro.js +1 -0
  59. package/lib/module/src/specs/NitroInputWorklets.nitro.js +1 -0
  60. package/lib/module/src/useNitroInputState.js +55 -0
  61. package/lib/module/src/worklets.js +214 -0
  62. package/lib/typescript/src/MorphInput.d.ts +18 -0
  63. package/lib/typescript/src/NitroInput.d.ts +411 -0
  64. package/lib/typescript/src/index.d.ts +6 -0
  65. package/lib/typescript/src/specs/NitroInput.nitro.d.ts +390 -0
  66. package/lib/typescript/src/specs/NitroInputWorklets.nitro.d.ts +15 -0
  67. package/lib/typescript/src/useNitroInputState.d.ts +55 -0
  68. package/lib/typescript/src/worklets.d.ts +117 -0
  69. package/nitro.json +37 -0
  70. package/nitrogen/generated/.gitattributes +1 -0
  71. package/nitrogen/generated/android/NitroInput+autolinking.cmake +84 -0
  72. package/nitrogen/generated/android/NitroInput+autolinking.gradle +27 -0
  73. package/nitrogen/generated/android/NitroInputOnLoad.cpp +78 -0
  74. package/nitrogen/generated/android/NitroInputOnLoad.hpp +34 -0
  75. package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +75 -0
  76. package/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
  77. package/nitrogen/generated/android/c++/JFunc_void_double_double.hpp +75 -0
  78. package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
  79. package/nitrogen/generated/android/c++/JFunc_void_std__string_double.hpp +76 -0
  80. package/nitrogen/generated/android/c++/JFunc_void_std__string_std__string_std__string_bool.hpp +76 -0
  81. package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.cpp +1073 -0
  82. package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.hpp +254 -0
  83. package/nitrogen/generated/android/c++/JNitroInputAffixAlign.hpp +64 -0
  84. package/nitrogen/generated/android/c++/JNitroInputAutoCapitalize.hpp +64 -0
  85. package/nitrogen/generated/android/c++/JNitroInputEasing.hpp +67 -0
  86. package/nitrogen/generated/android/c++/JNitroInputEffect.hpp +61 -0
  87. package/nitrogen/generated/android/c++/JNitroInputKeyboardAppearance.hpp +61 -0
  88. package/nitrogen/generated/android/c++/JNitroInputKeyboardType.hpp +79 -0
  89. package/nitrogen/generated/android/c++/JNitroInputLabelBehavior.hpp +58 -0
  90. package/nitrogen/generated/android/c++/JNitroInputMode.hpp +61 -0
  91. package/nitrogen/generated/android/c++/JNitroInputNotation.hpp +65 -0
  92. package/nitrogen/generated/android/c++/JNitroInputReturnKeyType.hpp +70 -0
  93. package/nitrogen/generated/android/c++/JNitroInputSignPlacement.hpp +58 -0
  94. package/nitrogen/generated/android/c++/JNitroInputSubmitBehavior.hpp +61 -0
  95. package/nitrogen/generated/android/c++/JNitroInputTextAlign.hpp +64 -0
  96. package/nitrogen/generated/android/c++/JNitroInputTextAlignVertical.hpp +64 -0
  97. package/nitrogen/generated/android/c++/JNitroInputVariant.hpp +61 -0
  98. package/nitrogen/generated/android/c++/views/JHybridNitroInputViewStateUpdater.cpp +529 -0
  99. package/nitrogen/generated/android/c++/views/JHybridNitroInputViewStateUpdater.hpp +54 -0
  100. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/Func_void_bool.kt +78 -0
  101. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/Func_void_double.kt +78 -0
  102. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/Func_void_double_double.kt +78 -0
  103. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/Func_void_std__string.kt +78 -0
  104. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/Func_void_std__string_double.kt +78 -0
  105. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/Func_void_std__string_std__string_std__string_bool.kt +78 -0
  106. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroInputViewSpec.kt +711 -0
  107. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputAffixAlign.kt +25 -0
  108. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputAutoCapitalize.kt +25 -0
  109. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputEasing.kt +26 -0
  110. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputEffect.kt +24 -0
  111. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputKeyboardAppearance.kt +24 -0
  112. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputKeyboardType.kt +30 -0
  113. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputLabelBehavior.kt +23 -0
  114. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputMode.kt +24 -0
  115. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputNotation.kt +61 -0
  116. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputOnLoad.kt +35 -0
  117. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputReturnKeyType.kt +27 -0
  118. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputSignPlacement.kt +23 -0
  119. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputSubmitBehavior.kt +24 -0
  120. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputTextAlign.kt +25 -0
  121. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputTextAlignVertical.kt +25 -0
  122. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputVariant.kt +24 -0
  123. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroInputViewManager.kt +96 -0
  124. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroInputViewStateUpdater.kt +23 -0
  125. package/nitrogen/generated/ios/NitroInput+autolinking.rb +62 -0
  126. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.cpp +81 -0
  127. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.hpp +348 -0
  128. package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Umbrella.hpp +92 -0
  129. package/nitrogen/generated/ios/NitroInputAutolinking.mm +43 -0
  130. package/nitrogen/generated/ios/NitroInputAutolinking.swift +26 -0
  131. package/nitrogen/generated/ios/c++/HybridNitroInputViewSpecSwift.cpp +11 -0
  132. package/nitrogen/generated/ios/c++/HybridNitroInputViewSpecSwift.hpp +769 -0
  133. package/nitrogen/generated/ios/c++/views/HybridNitroInputViewComponent.mm +690 -0
  134. package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
  135. package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
  136. package/nitrogen/generated/ios/swift/Func_void_double_double.swift +46 -0
  137. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
  138. package/nitrogen/generated/ios/swift/Func_void_std__string_double.swift +46 -0
  139. package/nitrogen/generated/ios/swift/Func_void_std__string_std__string_std__string_bool.swift +46 -0
  140. package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec.swift +154 -0
  141. package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec_cxx.swift +1454 -0
  142. package/nitrogen/generated/ios/swift/NitroInputAffixAlign.swift +48 -0
  143. package/nitrogen/generated/ios/swift/NitroInputAutoCapitalize.swift +48 -0
  144. package/nitrogen/generated/ios/swift/NitroInputEasing.swift +52 -0
  145. package/nitrogen/generated/ios/swift/NitroInputEffect.swift +44 -0
  146. package/nitrogen/generated/ios/swift/NitroInputKeyboardAppearance.swift +44 -0
  147. package/nitrogen/generated/ios/swift/NitroInputKeyboardType.swift +68 -0
  148. package/nitrogen/generated/ios/swift/NitroInputLabelBehavior.swift +40 -0
  149. package/nitrogen/generated/ios/swift/NitroInputMode.swift +44 -0
  150. package/nitrogen/generated/ios/swift/NitroInputNotation.swift +39 -0
  151. package/nitrogen/generated/ios/swift/NitroInputReturnKeyType.swift +56 -0
  152. package/nitrogen/generated/ios/swift/NitroInputSignPlacement.swift +40 -0
  153. package/nitrogen/generated/ios/swift/NitroInputSubmitBehavior.swift +44 -0
  154. package/nitrogen/generated/ios/swift/NitroInputTextAlign.swift +48 -0
  155. package/nitrogen/generated/ios/swift/NitroInputTextAlignVertical.swift +48 -0
  156. package/nitrogen/generated/ios/swift/NitroInputVariant.swift +44 -0
  157. package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.cpp +213 -0
  158. package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.hpp +300 -0
  159. package/nitrogen/generated/shared/c++/HybridNitroInputWorkletsSpec.cpp +21 -0
  160. package/nitrogen/generated/shared/c++/HybridNitroInputWorkletsSpec.hpp +62 -0
  161. package/nitrogen/generated/shared/c++/NitroInputAffixAlign.hpp +84 -0
  162. package/nitrogen/generated/shared/c++/NitroInputAutoCapitalize.hpp +84 -0
  163. package/nitrogen/generated/shared/c++/NitroInputEasing.hpp +88 -0
  164. package/nitrogen/generated/shared/c++/NitroInputEffect.hpp +80 -0
  165. package/nitrogen/generated/shared/c++/NitroInputKeyboardAppearance.hpp +80 -0
  166. package/nitrogen/generated/shared/c++/NitroInputKeyboardType.hpp +104 -0
  167. package/nitrogen/generated/shared/c++/NitroInputLabelBehavior.hpp +76 -0
  168. package/nitrogen/generated/shared/c++/NitroInputMode.hpp +80 -0
  169. package/nitrogen/generated/shared/c++/NitroInputNotation.hpp +91 -0
  170. package/nitrogen/generated/shared/c++/NitroInputReturnKeyType.hpp +92 -0
  171. package/nitrogen/generated/shared/c++/NitroInputSignPlacement.hpp +76 -0
  172. package/nitrogen/generated/shared/c++/NitroInputSubmitBehavior.hpp +80 -0
  173. package/nitrogen/generated/shared/c++/NitroInputTextAlign.hpp +84 -0
  174. package/nitrogen/generated/shared/c++/NitroInputTextAlignVertical.hpp +84 -0
  175. package/nitrogen/generated/shared/c++/NitroInputVariant.hpp +80 -0
  176. package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.cpp +216 -0
  177. package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.hpp +374 -0
  178. package/nitrogen/generated/shared/json/NitroInputViewConfig.json +101 -0
  179. package/package.json +141 -0
  180. package/react-native.config.js +16 -0
  181. package/src/MorphInput.tsx +30 -0
  182. package/src/NitroInput.tsx +1364 -0
  183. package/src/index.ts +55 -0
  184. package/src/specs/NitroInput.nitro.ts +436 -0
  185. package/src/specs/NitroInputWorklets.nitro.ts +13 -0
  186. package/src/useNitroInputState.ts +101 -0
  187. package/src/worklets.ts +300 -0
@@ -0,0 +1,214 @@
1
+ import { NitroModules } from 'react-native-nitro-modules';
2
+ let workletsModule;
3
+ let hybrid = null;
4
+ let installed = false;
5
+ const warned = new Set();
6
+ let nextId = 1;
7
+ function loadWorklets() {
8
+ if (workletsModule === undefined) {
9
+ try {
10
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
11
+ workletsModule = require('react-native-worklets');
12
+ }
13
+ catch {
14
+ workletsModule = null;
15
+ }
16
+ }
17
+ return workletsModule;
18
+ }
19
+ /** True for a function compiled by the worklets Babel plugin (`'worklet'` directive). */
20
+ export function isWorklet(fn) {
21
+ return typeof fn === 'function' && fn.__workletHash != null;
22
+ }
23
+ /** Whether worklets can run: react-native-worklets installed and the native side built with it. */
24
+ export function ensureWorkletsInstalled() {
25
+ if (installed)
26
+ return true;
27
+ const worklets = loadWorklets();
28
+ if (!worklets)
29
+ return warnOnce('react-native-worklets is not installed');
30
+ try {
31
+ hybrid ??= NitroModules.createHybridObject('NitroInputWorklets');
32
+ }
33
+ catch {
34
+ return warnOnce('the native module is missing (rebuild the app)');
35
+ }
36
+ if (!hybrid.isAvailable)
37
+ return warnOnce('the native code was built without react-native-worklets (reinstall pods / rebuild)');
38
+ worklets.executeOnUIRuntimeSync(() => {
39
+ 'worklet';
40
+ if (!globalThis.__nitroInputWorklets)
41
+ globalThis.__nitroInputWorklets = new Map();
42
+ })();
43
+ const install = hybrid.install;
44
+ installed = install.call(hybrid, worklets.getUIRuntimeHolder()) === true;
45
+ if (!installed)
46
+ return warnOnce('the worklets UI runtime could not be installed');
47
+ return true;
48
+ }
49
+ /** One warning per distinct reason: a later, different failure must not be swallowed. */
50
+ function warnOnce(reason) {
51
+ if (!warned.has(reason)) {
52
+ warned.add(reason);
53
+ console.warn(`[NitroInput] worklets are unavailable (${reason}); transform and worklet callbacks run nowhere.`);
54
+ }
55
+ return false;
56
+ }
57
+ /** Where the caret lands when a transform returns no selection (react-native-transformer-text-input's rule). */
58
+ function defaultSelection(oldText, newText, start, end) {
59
+ 'worklet';
60
+ const oldLength = oldText.length;
61
+ const newLength = newText.length;
62
+ const delta = newLength - oldLength;
63
+ let s;
64
+ let e;
65
+ if (start === end) {
66
+ if (end >= oldLength) {
67
+ s = newLength;
68
+ e = newLength;
69
+ }
70
+ else {
71
+ s = end + delta;
72
+ e = s;
73
+ }
74
+ }
75
+ else {
76
+ s = start + delta;
77
+ e = end + delta;
78
+ }
79
+ if (s < 0 || e < 0 || s > newLength || e > newLength || s > e) {
80
+ return { start: newLength, end: newLength };
81
+ }
82
+ return { start: s, end: e };
83
+ }
84
+ /**
85
+ * Reserves an id for a worklet that is about to be registered. Safe to call
86
+ * during render: a render React throws away only burns an integer, where an
87
+ * actual registration would leak an entry on the UI runtime.
88
+ */
89
+ export function allocateWorkletId() {
90
+ if (!ensureWorkletsInstalled())
91
+ return 0;
92
+ return nextId++;
93
+ }
94
+ /**
95
+ * Registers a `transform` worklet under `id`. Native calls the registered
96
+ * wrapper with the edited text, the previous text and both selections (code
97
+ * point offsets) and gets back the final text and selection.
98
+ *
99
+ * Registration is synchronous on purpose: `runOnUI` would land a tick later,
100
+ * and an edit in that window (an autofocused field typed into immediately)
101
+ * would find no worklet and silently skip the transform.
102
+ */
103
+ export function registerTransform(transform, id) {
104
+ if (id === 0 || !ensureWorkletsInstalled())
105
+ return;
106
+ const worklets = loadWorklets();
107
+ worklets.executeOnUIRuntimeSync(() => {
108
+ 'worklet';
109
+ const wrapper = (text, previousText, selectionStart, selectionEnd, previousSelectionStart, previousSelectionEnd) => {
110
+ const result = transform({
111
+ text,
112
+ previousText,
113
+ selection: { start: selectionStart, end: selectionEnd },
114
+ previousSelection: { start: previousSelectionStart, end: previousSelectionEnd },
115
+ });
116
+ if (result == null)
117
+ return null;
118
+ const nextText = result.text ?? text;
119
+ const selection = result.selection ?? defaultSelection(text, nextText, selectionStart, selectionEnd);
120
+ return { text: nextText, selectionStart: selection.start, selectionEnd: selection.end };
121
+ };
122
+ globalThis.__nitroInputWorklets?.set(id, wrapper);
123
+ })();
124
+ }
125
+ /** Registers a worklet callback (`onChangeText` / `onChangeValue`) under `id`. */
126
+ export function registerCallback(callback, id) {
127
+ if (id === 0 || !ensureWorkletsInstalled())
128
+ return;
129
+ const worklets = loadWorklets();
130
+ worklets.executeOnUIRuntimeSync(() => {
131
+ 'worklet';
132
+ globalThis.__nitroInputWorklets?.set(id, callback);
133
+ })();
134
+ }
135
+ /**
136
+ * Registers the pair of focus worklets under one id: native reports a single
137
+ * focus change, and the wrapper picks the handler. Built on the UI runtime -
138
+ * like `registerTransform` - so it needs no Babel pass of its own, and the
139
+ * handlers it captures must themselves be worklets.
140
+ *
141
+ * The event is the one the JS handlers get, minus `target`: a react tag is a
142
+ * JS-thread notion and there is nothing on the UI runtime to ask for it.
143
+ */
144
+ export function registerFocusChange(onFocus, onBlur, id) {
145
+ if (id === 0 || !ensureWorkletsInstalled())
146
+ return;
147
+ const worklets = loadWorklets();
148
+ worklets.executeOnUIRuntimeSync(() => {
149
+ 'worklet';
150
+ const wrapper = (focused, text) => {
151
+ const event = { text, target: 0, eventCount: 0, nativeEvent: { text, target: 0, eventCount: 0 } };
152
+ if (focused)
153
+ onFocus?.(event);
154
+ else
155
+ onBlur?.(event);
156
+ };
157
+ globalThis.__nitroInputWorklets?.set(id, wrapper);
158
+ })();
159
+ }
160
+ /** Registers an `onSelectionChange` worklet, given the two scalars native sends. */
161
+ export function registerSelectionChange(handler, id) {
162
+ if (id === 0 || !ensureWorkletsInstalled())
163
+ return;
164
+ const worklets = loadWorklets();
165
+ worklets.executeOnUIRuntimeSync(() => {
166
+ 'worklet';
167
+ const wrapper = (start, end) => {
168
+ const selection = { start, end };
169
+ handler({ selection, start, end, target: 0, nativeEvent: { selection, target: 0 } });
170
+ };
171
+ globalThis.__nitroInputWorklets?.set(id, wrapper);
172
+ })();
173
+ }
174
+ /** Registers an `onSubmitEditing` / `onEndEditing` worklet, given the text. */
175
+ export function registerTextEvent(handler, id) {
176
+ if (id === 0 || !ensureWorkletsInstalled())
177
+ return;
178
+ const worklets = loadWorklets();
179
+ worklets.executeOnUIRuntimeSync(() => {
180
+ 'worklet';
181
+ const wrapper = (text) => {
182
+ handler({ text, target: 0, nativeEvent: { text, target: 0 } });
183
+ };
184
+ globalThis.__nitroInputWorklets?.set(id, wrapper);
185
+ })();
186
+ }
187
+ /** Registers an `onKeyPress` worklet, given the key. */
188
+ export function registerKeyPress(handler, id) {
189
+ if (id === 0 || !ensureWorkletsInstalled())
190
+ return;
191
+ const worklets = loadWorklets();
192
+ worklets.executeOnUIRuntimeSync(() => {
193
+ 'worklet';
194
+ const wrapper = (key) => {
195
+ handler({ key, eventCount: 0, target: 0, nativeEvent: { key, eventCount: 0, target: 0 } });
196
+ };
197
+ globalThis.__nitroInputWorklets?.set(id, wrapper);
198
+ })();
199
+ }
200
+ /**
201
+ * Removes a worklet. Asynchronous, unlike registration: nothing is waiting on
202
+ * it, and stalling the JS thread on every unmount is the worse trade.
203
+ */
204
+ export function unregisterWorklet(id) {
205
+ if (id === 0 || !installed)
206
+ return;
207
+ const worklets = loadWorklets();
208
+ if (!worklets)
209
+ return;
210
+ worklets.runOnUI(() => {
211
+ 'worklet';
212
+ globalThis.__nitroInputWorklets?.delete(id);
213
+ })();
214
+ }
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { type NitroInputHandle, type NitroInputProps, type NitroInputRef } from './NitroInput';
3
+ /**
4
+ * A field whose text morphs as it changes: digits roll into place, grouping
5
+ * separators slide through the line box, other characters fade and scale. In
6
+ * `mode="number"` every edit is formatted natively before a frame is drawn, so
7
+ * the morph and the formatting are the same event.
8
+ *
9
+ * This is {@link NitroInput} with the glyph engine on and content sizing
10
+ * inferred, which is what an amount wants — the box grows as digits arrive.
11
+ * Reach for it where the morph is the point; for an ordinary form field use
12
+ * `NitroInput`, which does not animate its characters and takes its width from
13
+ * its parent the way a `TextInput` does.
14
+ */
15
+ export type MorphInputProps = Omit<NitroInputProps, 'morph'>;
16
+ export type MorphInputHandle = NitroInputHandle;
17
+ export type MorphInputRef = NitroInputRef;
18
+ export declare const MorphInput: React.ForwardRefExoticComponent<MorphInputProps & React.RefAttributes<NitroInputHandle>>;
@@ -0,0 +1,411 @@
1
+ import React from 'react';
2
+ import { type ColorValue, type TextStyle, type ViewProps } from 'react-native';
3
+ import { type HybridRef } from 'react-native-nitro-modules';
4
+ import type { NitroInputAffixAlign, NitroInputAutoCapitalize, NitroInputEasing, NitroInputEffect, NitroInputKeyboardAppearance, NitroInputKeyboardType, NitroInputLabelBehavior, NitroInputMethods, NitroInputMode, NitroInputProps as NativeNitroInputProps, NitroInputReturnKeyType, NitroInputSubmitBehavior, NitroInputTextAlign, NitroInputTextAlignVertical, NitroInputSignPlacement, NitroInputVariant, NitroInputNotation } from './specs/NitroInput.nitro';
5
+ import { type NitroInputSelection, type NitroInputTransform } from './worklets';
6
+ /** React Native's `inputMode`, the HTML-aligned alias for `keyboardType`. */
7
+ export type InputMode = 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
8
+ /** React Native's `enterKeyHint`, the HTML-aligned alias for `returnKeyType`. */
9
+ export type EnterKeyHint = 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
10
+ /**
11
+ * The raw Nitro host component. Prefer {@link NitroInput}, which adds the
12
+ * controlled-value handshake, auto-sizing, color/weight conversion and a
13
+ * convenient handle.
14
+ */
15
+ export declare const NativeNitroInputView: import("react-native-nitro-modules").ReactNativeView<NativeNitroInputProps, NitroInputMethods>;
16
+ /** The native Nitro `HybridObject` behind a mounted {@link NitroInput}. */
17
+ export type NitroInputRef = HybridRef<NativeNitroInputProps, NitroInputMethods>;
18
+ /**
19
+ * The events this component hands to its callbacks.
20
+ *
21
+ * Each one is a superset of what `TextInput` passes: `nativeEvent` is there
22
+ * with the same fields under the same names, so a handler written against a
23
+ * `TextInput` keeps working when the component is swapped, and the fields are
24
+ * repeated at the top level so new code can destructure them instead of
25
+ * reaching through `nativeEvent`.
26
+ */
27
+ export interface NitroInputTextEvent {
28
+ text: string;
29
+ /** The host view's react tag, as `TextInput` reports for itself. */
30
+ target: number;
31
+ nativeEvent: {
32
+ text: string;
33
+ target: number;
34
+ };
35
+ }
36
+ export interface NitroInputFocusEvent extends NitroInputTextEvent {
37
+ /** The native edit counter, as in `TextInput`. */
38
+ eventCount: number;
39
+ nativeEvent: {
40
+ text: string;
41
+ target: number;
42
+ eventCount: number;
43
+ };
44
+ }
45
+ export interface NitroInputSelectionEvent {
46
+ /** The selection, in code points. */
47
+ selection: NitroInputSelection;
48
+ /** The selection's bounds, repeated so `({ start, end }) => …` works. */
49
+ start: number;
50
+ end: number;
51
+ target: number;
52
+ nativeEvent: {
53
+ selection: NitroInputSelection;
54
+ target: number;
55
+ };
56
+ }
57
+ export interface NitroInputKeyPressEvent {
58
+ /** The character, `'Backspace'` or `'Enter'`. */
59
+ key: string;
60
+ eventCount: number;
61
+ target: number;
62
+ nativeEvent: {
63
+ key: string;
64
+ eventCount: number;
65
+ target: number;
66
+ };
67
+ }
68
+ export interface NitroInputProps extends Omit<ViewProps, 'children' | 'onFocus' | 'onBlur'> {
69
+ /**
70
+ * The text to show (controlled). The native side formats and shows what the
71
+ * user types on its own; this prop is applied when it changes to something
72
+ * other than what the field already shows, so echoing `onChangeText` back
73
+ * into state never fights the user or shows an unformatted frame.
74
+ */
75
+ value?: string;
76
+ /** The initial text (uncontrolled). */
77
+ defaultValue?: string;
78
+ /**
79
+ * The field's frame. `'outlined'` strokes a rounded rectangle notched around
80
+ * the floating label - the notch is a real hole in the path, so whatever is
81
+ * behind the field shows through. `'filled'` tints the box instead.
82
+ * Default: `'none'`, leaving the border to `style` as before.
83
+ */
84
+ variant?: NitroInputVariant;
85
+ /** Floating label text. Requires a `variant` other than `'none'`. */
86
+ label?: string;
87
+ /** Whether the label floats on focus/content or stays floated. Default: `'float'`. */
88
+ labelBehavior?: NitroInputLabelBehavior;
89
+ /** Label colour at rest; defaults to `placeholderTextColor`. */
90
+ labelColor?: ColorValue;
91
+ /** Label colour while focused; defaults to `focusedStrokeColor`. */
92
+ labelFocusedColor?: ColorValue;
93
+ /** Label size when floated, in points; omit to derive it from `fontSize`. */
94
+ labelFontSize?: number;
95
+ /** Outline colour; defaults to a platform hairline grey. */
96
+ strokeColor?: ColorValue;
97
+ /** Outline colour while focused; defaults to `strokeColor`. */
98
+ focusedStrokeColor?: ColorValue;
99
+ /** Outline stroke width in points, doubled while focused. Default: `1`. */
100
+ strokeWidth?: number;
101
+ /** Corner radius of the frame. Default: `8`. */
102
+ cornerRadius?: number;
103
+ /** `'filled'`: the box tint. */
104
+ fillColor?: ColorValue;
105
+ /**
106
+ * What the field holds. `'number'` formats natively as you type: grouping
107
+ * separators, one decimal separator, up to `fractionDigits` decimals, a
108
+ * currency `prefix` / `suffix`. `'mask'` applies a fixed pattern (`mask`).
109
+ * `'text'` is a plain field. Default: `'text'`.
110
+ */
111
+ mode?: NitroInputMode;
112
+ /**
113
+ * React Native's alias for `keyboardType`, following the HTML attribute.
114
+ * Ignored when `keyboardType` is given. `'none'` also suppresses the soft
115
+ * keyboard, as it does in `TextInput`.
116
+ */
117
+ inputMode?: InputMode;
118
+ /** React Native's alias for `returnKeyType`, following the HTML attribute. Ignored when `returnKeyType` is given. */
119
+ enterKeyHint?: EnterKeyHint;
120
+ /**
121
+ * `'mask'`: the pattern, e.g. `'+1 ([000]) [000]-[0000]'`.
122
+ *
123
+ * `[0]` mandatory digit, `[9]` optional digit, `[A]` mandatory letter,
124
+ * `[a]` optional letter, `[_]` mandatory alphanumeric, `[-]` optional
125
+ * alphanumeric, `[…]` an unbounded run of the preceding type. `{…}` is a
126
+ * fixed block whose characters count towards the extracted value; a literal
127
+ * outside brackets is shown but not extracted. `\\` escapes.
128
+ *
129
+ * An invalid pattern leaves the field unmasked rather than breaking it.
130
+ */
131
+ mask?: string;
132
+ /** `'mask'`: extra slot characters beyond the built-in ones. */
133
+ maskNotations?: NitroInputNotation[];
134
+ /** `'mask'`: fill in constants as the caret reaches them. Default: `true`. */
135
+ maskAutocomplete?: boolean;
136
+ /** `'mask'`: backspace walks back over autocompleted constants. Default: `false`. */
137
+ maskAutoSkip?: boolean;
138
+ /**
139
+ * `'mask'` mode: called whenever the text changes, from a keystroke,
140
+ * `setText` / `clear` or the `value` prop alike, with the masked text, the
141
+ * characters the user contributed, what is still missing, and whether every
142
+ * mandatory slot is filled. A mount with an unchanged text does not report.
143
+ */
144
+ onChangeMask?: (formatted: string, extracted: string, tailPlaceholder: string, complete: boolean) => void;
145
+ /** `'number'`: most digits allowed after the decimal separator; `0` disables the decimal. Default: `2`. */
146
+ fractionDigits?: number;
147
+ /** `'number'`: most integer digits accepted. Default: `15`. */
148
+ maxIntegerDigits?: number;
149
+ /** `'number'`: inserted between every three integer digits; `''` disables grouping. Default: `','`. */
150
+ groupingSeparator?: string;
151
+ /** `'number'`: placed between integer and fraction digits. Default: `'.'`. */
152
+ decimalSeparator?: string;
153
+ /** Static text drawn before the field's text, e.g. `'$'`. */
154
+ prefix?: string;
155
+ /** Static text drawn after the field's text, e.g. `' USD'`. */
156
+ suffix?: string;
157
+ /** Font size of `prefix`, e.g. a smaller currency symbol. Defaults to `fontSize`. */
158
+ prefixFontSize?: number;
159
+ /** Font size of `suffix`. Defaults to `fontSize`. */
160
+ suffixFontSize?: number;
161
+ /**
162
+ * How prefix and suffix line up with the text: `'top'` pins glyph tops,
163
+ * `'bottom'` the bottom of the ink, `'baseline'` shares the baseline,
164
+ * `'center'` centres. Default: `'baseline'`.
165
+ */
166
+ affixAlign?: NitroInputAffixAlign;
167
+ /**
168
+ * Where a negative amount's sign sits relative to `prefix`. `'beforeAffix'`
169
+ * (the default) reads `-$1,234.56`; `'afterAffix'` reads `$-1,234.56`, which
170
+ * suits a symbol styled as an ornament rather than read as part of the
171
+ * number. Only the morph honours it - a plain field's affixes are accessory
172
+ * views outside the text, so it is always `'afterAffix'`.
173
+ */
174
+ signPlacement?: NitroInputSignPlacement;
175
+ /** Alignment of `prefix` only. Defaults to `affixAlign`. */
176
+ prefixAlign?: NitroInputAffixAlign;
177
+ /** Alignment of `suffix` only. Defaults to `affixAlign`. */
178
+ suffixAlign?: NitroInputAffixAlign;
179
+ /** Shown while the field is empty and morphed away by the first character. In `'number'` mode `'0'` reads well. */
180
+ placeholder?: string;
181
+ /** Color of the placeholder. Defaults to the platform placeholder color. */
182
+ placeholderTextColor?: ColorValue;
183
+ /** Duration in ms of the morph played on every change. `0` snaps. Default: `400`. */
184
+ duration?: number;
185
+ /** Timing curve of the morph. Default: `'expo'` (Torph's `cubic-bezier(0.19, 1, 0.22, 1)`). */
186
+ easing?: NitroInputEasing;
187
+ /** Overshoot of the `'spring'` easing, `0`–`1`. Default: `0.15`. */
188
+ bounce?: number;
189
+ /**
190
+ * How characters enter and leave. `'auto'`: digits and separators slide
191
+ * through the line box (digits from above, separators from below), other
192
+ * characters fade and scale. Default: `'auto'`.
193
+ */
194
+ effect?: NitroInputEffect;
195
+ /** Font size in points. Default: `32`. */
196
+ fontSize?: number;
197
+ /**
198
+ * Height of the line box in points — the CSS meaning, the total height a
199
+ * line occupies rather than extra leading. Omit to use the font's own.
200
+ *
201
+ * Unlike `TextInput`, a line height *tighter* than the font is centred
202
+ * correctly too, and it applies to single-line and morphing fields, not only
203
+ * wrapped ones.
204
+ */
205
+ lineHeight?: number;
206
+ /** Font weight, like `Text`'s `fontWeight`. Default: `'normal'`. */
207
+ fontWeight?: TextStyle['fontWeight'];
208
+ /** Font family name, like `Text`'s `fontFamily`. Defaults to the system font. */
209
+ fontFamily?: string;
210
+ /** Text color. Defaults to the platform's primary label color. */
211
+ color?: ColorValue;
212
+ /**
213
+ * Where the text sits when the view is wider than it. Default: `'auto'`: the
214
+ * start edge of the layout direction, as `TextInput`. `'left'` and `'right'`
215
+ * are absolute.
216
+ */
217
+ textAlign?: NitroInputTextAlign;
218
+ /** Caret color. Defaults to the platform tint. */
219
+ cursorColor?: ColorValue;
220
+ /** Selection highlight color. Defaults to the platform tint. */
221
+ selectionColor?: ColorValue;
222
+ /** Hides the caret. Default: `false`. */
223
+ caretHidden?: boolean;
224
+ /**
225
+ * Scale the text down when it is wider than the view (give the view a fixed
226
+ * `width` in `style`), and back up when it fits again. Default: `false`.
227
+ */
228
+ adjustsFontSizeToFit?: boolean;
229
+ /** Smallest scale `adjustsFontSizeToFit` may apply, `0`–`1`. Default: `0.5`. */
230
+ minimumFontScale?: number;
231
+ /** Scale the fonts with the system text size, like `Text`. Default: `false`. */
232
+ allowFontScaling?: boolean;
233
+ /** Upper bound for `allowFontScaling`, e.g. `1.3`. `0` = no cap. Default: `0`. */
234
+ maxFontSizeMultiplier?: number;
235
+ /** Keyboard to show. Defaults to `'decimal-pad'` / `'number-pad'` in `'number'` mode, `'default'` otherwise. */
236
+ keyboardType?: NitroInputKeyboardType;
237
+ /** Label of the return key. Default: `'default'`. */
238
+ returnKeyType?: NitroInputReturnKeyType;
239
+ /** Auto-capitalisation in `'text'` mode. Default: `'sentences'`. */
240
+ autoCapitalize?: NitroInputAutoCapitalize;
241
+ /** Auto-correction in `'text'` mode. Default: `true`. */
242
+ autoCorrect?: boolean;
243
+ /** Whether the user can edit the field. Default: `true`. */
244
+ editable?: boolean;
245
+ /**
246
+ * Let the text wrap onto more than one line.
247
+ *
248
+ * A multiline field is always drawn by the system view and is always
249
+ * `'text'` mode: the glyph engine lays one run out on one baseline, so it
250
+ * cannot morph wrapped text, and an amount or a mask is a single-line idea.
251
+ * `morph`, `mode="number"`, `mode="mask"` and the `prefix` / `suffix`
252
+ * affixes are ignored alongside it, with one warning each in development.
253
+ * The return key inserts a line break unless `submitBehavior` says otherwise.
254
+ */
255
+ multiline?: boolean;
256
+ /** `multiline`: lines tall before it scrolls. Omit to grow with the content. */
257
+ numberOfLines?: number;
258
+ /** Alias for {@link numberOfLines}, matching `TextInput`. */
259
+ rows?: number;
260
+ /** `multiline`: where the text sits in the box. Default: `'auto'` (top). */
261
+ textAlignVertical?: NitroInputTextAlignVertical;
262
+ /** `multiline`: whether it scrolls once the text outgrows it. Default: `true`. */
263
+ scrollEnabled?: boolean;
264
+ /** Focus the field when it mounts. Default: `false`. */
265
+ autoFocus?: boolean;
266
+ /**
267
+ * What the return key does. `'blurAndSubmit'` fires `onSubmitEditing` and
268
+ * dismisses the keyboard; `'submit'` fires it and keeps focus, so a form can
269
+ * move to the next field itself; `'newline'` inserts a line break instead
270
+ * (`multiline` only). Defaults as `TextInput`'s: `'blurAndSubmit'` for a
271
+ * single-line field, `'newline'` for a multiline one.
272
+ */
273
+ submitBehavior?: NitroInputSubmitBehavior;
274
+ /**
275
+ * Deprecated alias of `submitBehavior`, resolved the way `TextInput` resolves
276
+ * it: `false` means `'submit'` on a single-line field, and `true` means
277
+ * `'blurAndSubmit'` on a multiline one (whose return key otherwise inserts a
278
+ * line break). Ignored when `submitBehavior` is given.
279
+ */
280
+ blurOnSubmit?: boolean;
281
+ /** Masks the drawn glyphs with bullets and turns off autocorrect. Default: `false`. */
282
+ secureTextEntry?: boolean;
283
+ /** Light or dark keyboard (iOS). Default: `'default'`. */
284
+ keyboardAppearance?: NitroInputKeyboardAppearance;
285
+ /** iOS `textContentType` — the autofill kind (`'username'`, `'password'`, `'oneTimeCode'`, …). */
286
+ textContentType?: string;
287
+ /** Cross-platform autofill hint; used as `textContentType` when that is not set. */
288
+ autoComplete?: string;
289
+ /** Disables the return key until the field has text. Default: `false`. */
290
+ enablesReturnKeyAutomatically?: boolean;
291
+ /** Show the soft keyboard on focus. `false` keeps focus and caret without it. Default: `true`. */
292
+ showSoftInputOnFocus?: boolean;
293
+ /** Select all the text when the field gains focus. Default: `false`. */
294
+ selectTextOnFocus?: boolean;
295
+ /** Empty the field when it gains focus. Default: `false`. */
296
+ clearTextOnFocus?: boolean;
297
+ /** Hides the Cut/Copy/Paste menu. Default: `false`. */
298
+ contextMenuHidden?: boolean;
299
+ /** Spell checking in `'text'` mode. Defaults to `autoCorrect`. */
300
+ spellCheck?: boolean;
301
+ /** Read-only alias of `editable={false}`, like React Native's. */
302
+ readOnly?: boolean;
303
+ /** The caret/selection to apply, in code points. */
304
+ selection?: {
305
+ start: number;
306
+ end?: number;
307
+ };
308
+ /**
309
+ * Run the glyph engine, so text morphs as it changes rather than simply
310
+ * appearing. Off by default: this is a text field first, and a `TextInput`
311
+ * does not animate its characters. {@link MorphInput} is this component with
312
+ * it on, which is what an amount field wants.
313
+ */
314
+ morph?: boolean;
315
+ /**
316
+ * Whether the field sizes itself to its content.
317
+ *
318
+ * `false` (the default) takes no width of its own, so flexbox stretches it to
319
+ * its parent the way a `TextInput` is stretched — that is what makes this a
320
+ * drop-in. `true` always sizes to content. `'auto'` infers it: on unless
321
+ * `style` gives a `width` or `flex`, which is what lets an amount grow as
322
+ * digits arrive, and is what {@link MorphInput} uses.
323
+ */
324
+ autoWidth?: boolean | 'auto';
325
+ /** `'text'` mode: most characters accepted. Default: unlimited. */
326
+ maxLength?: number;
327
+ /**
328
+ * A worklet that rewrites the text after every edit, synchronously on the UI
329
+ * thread before a frame is drawn (needs `react-native-worklets`): masks,
330
+ * custom formats, anything JS can express. It receives the edited text, the
331
+ * previous text and both selections (code point offsets) and returns the
332
+ * new text and optionally where the caret should go; `null` keeps the edit.
333
+ * In `'number'` mode it runs after the native formatter. Create it once
334
+ * (module scope or `useCallback`): a new function re-registers the worklet.
335
+ */
336
+ transform?: NitroInputTransform;
337
+ /**
338
+ * Called after every edit with the field's (formatted) text. Mark it with
339
+ * `'worklet'` (with `react-native-worklets` installed) and it runs
340
+ * synchronously on the UI thread instead, where it can write shared values
341
+ * before the next frame.
342
+ */
343
+ onChangeText?: (text: string) => void;
344
+ /**
345
+ * React Native's other change callback, fired alongside `onChangeText` with
346
+ * the same text. `nativeEvent.eventCount` is the native edit counter, as in
347
+ * `TextInput`.
348
+ */
349
+ onChange?: (event: {
350
+ nativeEvent: {
351
+ text: string;
352
+ eventCount: number;
353
+ target: number;
354
+ };
355
+ }) => void;
356
+ /** `'number'` mode: called after every edit with the numeric value, `NaN` when empty. A `'worklet'` runs on the UI thread. */
357
+ onChangeValue?: (value: number) => void;
358
+ /**
359
+ * Focused. The event is `TextInput`'s, so a handler written for one works
360
+ * here unchanged - and the same fields are repeated at the top level, so
361
+ * `({ text }) => …` reads better than `(e) => e.nativeEvent.text`.
362
+ */
363
+ onFocus?: (event: NitroInputFocusEvent) => void;
364
+ /** Blurred. Same event as {@link NitroInputProps.onFocus}. */
365
+ onBlur?: (event: NitroInputFocusEvent) => void;
366
+ /** The return key was pressed. */
367
+ onSubmitEditing?: (event: NitroInputTextEvent) => void;
368
+ /** Editing finished (focus lost or keyboard dismissed), like `TextInput`'s `onEndEditing`. */
369
+ onEndEditing?: (event: NitroInputTextEvent) => void;
370
+ /** The caret or selection moved, in code points. */
371
+ onSelectionChange?: (event: NitroInputSelectionEvent) => void;
372
+ /** A key was pressed, before the text changes: the character, `'Backspace'` or `'Enter'`. */
373
+ onKeyPress?: (event: NitroInputKeyPressEvent) => void;
374
+ /** Receives the native Nitro object once the view is mounted. */
375
+ onNativeRef?: (ref: NitroInputRef) => void;
376
+ }
377
+ /** Imperative handle exposed through `ref`. Methods are no-ops before mount. */
378
+ export interface NitroInputHandle {
379
+ focus(): void;
380
+ blur(): void;
381
+ /** Empties the field, morphing the characters away. */
382
+ clear(): void;
383
+ /** Replaces the text (formatted in `'number'` mode), caret at the end. */
384
+ setText(text: string): void;
385
+ /** `'number'` mode: shows `value` formatted; `NaN` empties the field. */
386
+ setValue(value: number): void;
387
+ /** The field's current (formatted) text. */
388
+ getText(): string;
389
+ /** `'number'` mode: the numeric value, `NaN` when empty. */
390
+ getValue(): number;
391
+ isFocused(): boolean;
392
+ /** Moves the caret / selection; code points into the (formatted) text. */
393
+ setSelection(start: number, end?: number): void;
394
+ /** The native Nitro object, or `null` before mount. */
395
+ readonly native: NitroInputRef | null;
396
+ }
397
+ /**
398
+ * A native text input: a system field (`UITextField` / `EditText`) that owns
399
+ * the keyboard, editing, selection, paste and accessibility, with native
400
+ * formatting (`mode="number"`), native masking (`mode="mask"`), an outlined
401
+ * or filled frame with a floating label, and optionally the glyph engine
402
+ * (`morph`), under which characters that stay glide to their new place, new
403
+ * ones slide or fade in and removed ones leave alongside their neighbours.
404
+ * In `'number'` mode every edit is formatted on the native side before a
405
+ * frame is drawn, with the caret kept in place, so there is never an
406
+ * unformatted frame and never a round trip through JS.
407
+ *
408
+ * Like a `TextInput`, it takes its width from its parent; `autoWidth`
409
+ * (`'auto'` in {@link MorphInput}) sizes it to its content instead.
410
+ */
411
+ export declare const NitroInput: React.ForwardRefExoticComponent<NitroInputProps & React.RefAttributes<NitroInputHandle>>;
@@ -0,0 +1,6 @@
1
+ export { NitroInput, NativeNitroInputView, type NitroInputProps, type NitroInputHandle, type NitroInputRef, type NitroInputTextEvent, type NitroInputFocusEvent, type NitroInputSelectionEvent, type NitroInputKeyPressEvent, type InputMode, type EnterKeyHint, } from './NitroInput';
2
+ export { MorphInput, type MorphInputProps, type MorphInputHandle, type MorphInputRef, } from './MorphInput';
3
+ export { isWorklet, type NitroInputSelection, type NitroInputTransform, type WorkletTextEvent, type WorkletFocusEvent, type WorkletSelectionEvent, type WorkletKeyPressEvent, } from './worklets';
4
+ export { useNitroInputState, type NitroInputState, type SharedValueLike, } from './useNitroInputState';
5
+ export type { NitroInputLabelBehavior, NitroInputMode, NitroInputNotation, NitroInputVariant, NitroInputEasing, NitroInputEffect, NitroInputTextAlign, NitroInputTextAlignVertical, NitroInputAffixAlign, NitroInputSignPlacement, NitroInputKeyboardType, NitroInputReturnKeyType, NitroInputAutoCapitalize, NitroInputSubmitBehavior, NitroInputKeyboardAppearance, NitroInputMethods, NitroInputProps as NativeNitroInputProps, NitroInputView, } from './specs/NitroInput.nitro';
6
+ export type { NitroInputWorklets } from './specs/NitroInputWorklets.nitro';