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
@@ -24,7 +24,9 @@
24
24
  #include "NitroNumberDirection.hpp"
25
25
  #include "NitroNumberRevealStyle.hpp"
26
26
  #include <vector>
27
+ #include "NitroNumberShimmerDirection.hpp"
27
28
  #include "NitroNumberAffixAlign.hpp"
29
+ #include "NitroNumberSignDisplay.hpp"
28
30
  #include "NitroNumberTextAlign.hpp"
29
31
  #include <functional>
30
32
  #include <memory>
@@ -78,6 +80,11 @@ namespace margelo::nitro::nitroinput::views {
78
80
  nitro::ReactProp<std::optional<bool>> loading;
79
81
  nitro::ReactProp<std::optional<double>> shimmerColor;
80
82
  nitro::ReactProp<std::optional<double>> shimmerDuration;
83
+ nitro::ReactProp<std::optional<double>> shimmerAngle;
84
+ nitro::ReactProp<std::optional<double>> shimmerWidth;
85
+ nitro::ReactProp<std::optional<double>> shimmerBaseColor;
86
+ nitro::ReactProp<std::optional<NitroNumberShimmerDirection>> shimmerDirection;
87
+ nitro::ReactProp<std::optional<double>> shimmerDelay;
81
88
  nitro::ReactProp<std::optional<double>> fontSize;
82
89
  nitro::ReactProp<std::optional<double>> prefixFontSize;
83
90
  nitro::ReactProp<std::optional<double>> suffixFontSize;
@@ -90,6 +97,19 @@ namespace margelo::nitro::nitroinput::views {
90
97
  nitro::ReactProp<std::optional<double>> prefixOffset;
91
98
  nitro::ReactProp<std::optional<double>> suffixOffset;
92
99
  nitro::ReactProp<std::optional<bool>> tabularNums;
100
+ nitro::ReactProp<std::optional<NitroNumberSignDisplay>> signDisplay;
101
+ nitro::ReactProp<std::optional<std::string>> plusSign;
102
+ nitro::ReactProp<std::optional<std::string>> minusSign;
103
+ nitro::ReactProp<std::optional<std::vector<std::string>>> digitGlyphs;
104
+ nitro::ReactProp<std::optional<std::vector<double>>> groupingSizes;
105
+ nitro::ReactProp<std::optional<std::vector<double>>> digitMax;
106
+ nitro::ReactProp<std::optional<bool>> continuous;
107
+ nitro::ReactProp<std::optional<double>> prefixColor;
108
+ nitro::ReactProp<std::optional<double>> suffixColor;
109
+ nitro::ReactProp<std::optional<double>> fractionColor;
110
+ nitro::ReactProp<std::optional<double>> fractionFontSize;
111
+ nitro::ReactProp<std::optional<NitroNumberAffixAlign>> fractionAlign;
112
+ nitro::ReactProp<std::optional<bool>> respectReduceMotion;
93
113
  nitro::ReactProp<std::optional<bool>> adjustsFontSizeToFit;
94
114
  nitro::ReactProp<std::optional<double>> minimumFontScale;
95
115
  nitro::ReactProp<std::optional<bool>> allowFontScaling;
@@ -102,6 +122,8 @@ namespace margelo::nitro::nitroinput::views {
102
122
  nitro::ReactProp<std::optional<std::function<void(double /* width */, double /* height */)>>> onSizeChange;
103
123
  nitro::ReactProp<std::optional<std::function<void()>>> onRevealEnd;
104
124
  nitro::ReactProp<std::optional<std::function<void(double /* index */, double /* value */)>>> onRevealMilestone;
125
+ nitro::ReactProp<std::optional<std::function<void()>>> onAnimationStart;
126
+ nitro::ReactProp<std::optional<std::function<void(double /* value */)>>> onAnimationEnd;
105
127
  nitro::ReactProp<std::optional<std::function<void(const std::shared_ptr<HybridNitroNumberViewSpec>& /* ref */)>>> hybridRef;
106
128
 
107
129
  [[nodiscard]]
@@ -134,6 +156,11 @@ namespace margelo::nitro::nitroinput::views {
134
156
  loading.hasSameValue(other.loading) &&
135
157
  shimmerColor.hasSameValue(other.shimmerColor) &&
136
158
  shimmerDuration.hasSameValue(other.shimmerDuration) &&
159
+ shimmerAngle.hasSameValue(other.shimmerAngle) &&
160
+ shimmerWidth.hasSameValue(other.shimmerWidth) &&
161
+ shimmerBaseColor.hasSameValue(other.shimmerBaseColor) &&
162
+ shimmerDirection.hasSameValue(other.shimmerDirection) &&
163
+ shimmerDelay.hasSameValue(other.shimmerDelay) &&
137
164
  fontSize.hasSameValue(other.fontSize) &&
138
165
  prefixFontSize.hasSameValue(other.prefixFontSize) &&
139
166
  suffixFontSize.hasSameValue(other.suffixFontSize) &&
@@ -146,6 +173,19 @@ namespace margelo::nitro::nitroinput::views {
146
173
  prefixOffset.hasSameValue(other.prefixOffset) &&
147
174
  suffixOffset.hasSameValue(other.suffixOffset) &&
148
175
  tabularNums.hasSameValue(other.tabularNums) &&
176
+ signDisplay.hasSameValue(other.signDisplay) &&
177
+ plusSign.hasSameValue(other.plusSign) &&
178
+ minusSign.hasSameValue(other.minusSign) &&
179
+ digitGlyphs.hasSameValue(other.digitGlyphs) &&
180
+ groupingSizes.hasSameValue(other.groupingSizes) &&
181
+ digitMax.hasSameValue(other.digitMax) &&
182
+ continuous.hasSameValue(other.continuous) &&
183
+ prefixColor.hasSameValue(other.prefixColor) &&
184
+ suffixColor.hasSameValue(other.suffixColor) &&
185
+ fractionColor.hasSameValue(other.fractionColor) &&
186
+ fractionFontSize.hasSameValue(other.fractionFontSize) &&
187
+ fractionAlign.hasSameValue(other.fractionAlign) &&
188
+ respectReduceMotion.hasSameValue(other.respectReduceMotion) &&
149
189
  adjustsFontSizeToFit.hasSameValue(other.adjustsFontSizeToFit) &&
150
190
  minimumFontScale.hasSameValue(other.minimumFontScale) &&
151
191
  allowFontScaling.hasSameValue(other.allowFontScaling) &&
@@ -158,6 +198,8 @@ namespace margelo::nitro::nitroinput::views {
158
198
  onSizeChange.hasSameValue(other.onSizeChange) &&
159
199
  onRevealEnd.hasSameValue(other.onRevealEnd) &&
160
200
  onRevealMilestone.hasSameValue(other.onRevealMilestone) &&
201
+ onAnimationStart.hasSameValue(other.onAnimationStart) &&
202
+ onAnimationEnd.hasSameValue(other.onAnimationEnd) &&
161
203
  hybridRef.hasSameValue(other.hybridRef);
162
204
  }
163
205
 
@@ -191,6 +233,11 @@ namespace margelo::nitro::nitroinput::views {
191
233
  loading.isProvided() ||
192
234
  shimmerColor.isProvided() ||
193
235
  shimmerDuration.isProvided() ||
236
+ shimmerAngle.isProvided() ||
237
+ shimmerWidth.isProvided() ||
238
+ shimmerBaseColor.isProvided() ||
239
+ shimmerDirection.isProvided() ||
240
+ shimmerDelay.isProvided() ||
194
241
  fontSize.isProvided() ||
195
242
  prefixFontSize.isProvided() ||
196
243
  suffixFontSize.isProvided() ||
@@ -203,6 +250,19 @@ namespace margelo::nitro::nitroinput::views {
203
250
  prefixOffset.isProvided() ||
204
251
  suffixOffset.isProvided() ||
205
252
  tabularNums.isProvided() ||
253
+ signDisplay.isProvided() ||
254
+ plusSign.isProvided() ||
255
+ minusSign.isProvided() ||
256
+ digitGlyphs.isProvided() ||
257
+ groupingSizes.isProvided() ||
258
+ digitMax.isProvided() ||
259
+ continuous.isProvided() ||
260
+ prefixColor.isProvided() ||
261
+ suffixColor.isProvided() ||
262
+ fractionColor.isProvided() ||
263
+ fractionFontSize.isProvided() ||
264
+ fractionAlign.isProvided() ||
265
+ respectReduceMotion.isProvided() ||
206
266
  adjustsFontSizeToFit.isProvided() ||
207
267
  minimumFontScale.isProvided() ||
208
268
  allowFontScaling.isProvided() ||
@@ -215,6 +275,8 @@ namespace margelo::nitro::nitroinput::views {
215
275
  onSizeChange.isProvided() ||
216
276
  onRevealEnd.isProvided() ||
217
277
  onRevealMilestone.isProvided() ||
278
+ onAnimationStart.isProvided() ||
279
+ onAnimationEnd.isProvided() ||
218
280
  hybridRef.isProvided();
219
281
  }
220
282
 
@@ -0,0 +1,74 @@
1
+ ///
2
+ /// HybridNitroTextViewComponent.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "HybridNitroTextViewComponent.hpp"
9
+
10
+ #include <NitroModules/NitroHash.hpp>
11
+ #include <NitroModules/ReactProp.hpp>
12
+
13
+ namespace margelo::nitro::nitroinput::views {
14
+
15
+ using namespace facebook;
16
+
17
+ extern const char HybridNitroTextViewComponentName[] = "NitroTextView";
18
+
19
+ HybridNitroTextViewProps::HybridNitroTextViewProps(const react::PropsParserContext& context,
20
+ const HybridNitroTextViewProps& sourceProps,
21
+ const react::RawProps& rawProps):
22
+ react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
23
+ text(nitro::ReactProp<std::string>::fromRawValue("NitroTextView", "text", rawProps, sourceProps.text)),
24
+ fontSize(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroTextView", "fontSize", rawProps, sourceProps.fontSize)),
25
+ fontWeight(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroTextView", "fontWeight", rawProps, sourceProps.fontWeight)),
26
+ fontFamily(nitro::ReactProp<std::optional<std::string>>::fromRawValue("NitroTextView", "fontFamily", rawProps, sourceProps.fontFamily)),
27
+ color(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroTextView", "color", rawProps, sourceProps.color)),
28
+ letterSpacing(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroTextView", "letterSpacing", rawProps, sourceProps.letterSpacing)),
29
+ textAlign(nitro::ReactProp<std::optional<NitroNumberTextAlign>>::fromRawValue("NitroTextView", "textAlign", rawProps, sourceProps.textAlign)),
30
+ rightToLeft(nitro::ReactProp<std::optional<bool>>::fromRawValue("NitroTextView", "rightToLeft", rawProps, sourceProps.rightToLeft)),
31
+ duration(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroTextView", "duration", rawProps, sourceProps.duration)),
32
+ easing(nitro::ReactProp<std::optional<NitroInputEasing>>::fromRawValue("NitroTextView", "easing", rawProps, sourceProps.easing)),
33
+ bounce(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroTextView", "bounce", rawProps, sourceProps.bounce)),
34
+ effect(nitro::ReactProp<std::optional<NitroInputEffect>>::fromRawValue("NitroTextView", "effect", rawProps, sourceProps.effect)),
35
+ respectReduceMotion(nitro::ReactProp<std::optional<bool>>::fromRawValue("NitroTextView", "respectReduceMotion", rawProps, sourceProps.respectReduceMotion)),
36
+ loading(nitro::ReactProp<std::optional<bool>>::fromRawValue("NitroTextView", "loading", rawProps, sourceProps.loading)),
37
+ shimmerColor(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroTextView", "shimmerColor", rawProps, sourceProps.shimmerColor)),
38
+ shimmerDuration(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroTextView", "shimmerDuration", rawProps, sourceProps.shimmerDuration)),
39
+ shimmerAngle(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroTextView", "shimmerAngle", rawProps, sourceProps.shimmerAngle)),
40
+ shimmerWidth(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroTextView", "shimmerWidth", rawProps, sourceProps.shimmerWidth)),
41
+ shimmerBaseColor(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroTextView", "shimmerBaseColor", rawProps, sourceProps.shimmerBaseColor)),
42
+ shimmerDirection(nitro::ReactProp<std::optional<NitroNumberShimmerDirection>>::fromRawValue("NitroTextView", "shimmerDirection", rawProps, sourceProps.shimmerDirection)),
43
+ shimmerDelay(nitro::ReactProp<std::optional<double>>::fromRawValue("NitroTextView", "shimmerDelay", rawProps, sourceProps.shimmerDelay)),
44
+ hybridRef(nitro::ReactProp<std::optional<std::function<void(const std::shared_ptr<HybridNitroTextViewSpec>& /* ref */)>>>::fromRawValue("NitroTextView", "hybridRef", rawProps, sourceProps.hybridRef)) { }
45
+
46
+ bool HybridNitroTextViewProps::filterObjectKeys(const std::string& propName) {
47
+ switch (hashString(propName)) {
48
+ case hashString("text"): return true;
49
+ case hashString("fontSize"): return true;
50
+ case hashString("fontWeight"): return true;
51
+ case hashString("fontFamily"): return true;
52
+ case hashString("color"): return true;
53
+ case hashString("letterSpacing"): return true;
54
+ case hashString("textAlign"): return true;
55
+ case hashString("rightToLeft"): return true;
56
+ case hashString("duration"): return true;
57
+ case hashString("easing"): return true;
58
+ case hashString("bounce"): return true;
59
+ case hashString("effect"): return true;
60
+ case hashString("respectReduceMotion"): return true;
61
+ case hashString("loading"): return true;
62
+ case hashString("shimmerColor"): return true;
63
+ case hashString("shimmerDuration"): return true;
64
+ case hashString("shimmerAngle"): return true;
65
+ case hashString("shimmerWidth"): return true;
66
+ case hashString("shimmerBaseColor"): return true;
67
+ case hashString("shimmerDirection"): return true;
68
+ case hashString("shimmerDelay"): return true;
69
+ case hashString("hybridRef"): return true;
70
+ default: return false;
71
+ }
72
+ }
73
+
74
+ } // namespace margelo::nitro::nitroinput::views
@@ -0,0 +1,149 @@
1
+ ///
2
+ /// HybridNitroTextViewComponent.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <NitroModules/ReactProp.hpp>
11
+ #include <NitroModules/ViewComponentDescriptor.hpp>
12
+ #include <NitroModules/ViewPropsHolderState.hpp>
13
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
14
+ #include <react/renderer/components/view/ViewProps.h>
15
+ #include <react/renderer/core/PropsParserContext.h>
16
+ #include <react/renderer/core/RawProps.h>
17
+
18
+ #include <string>
19
+
20
+ #include <string>
21
+ #include <optional>
22
+ #include "NitroNumberTextAlign.hpp"
23
+ #include "NitroInputEasing.hpp"
24
+ #include "NitroInputEffect.hpp"
25
+ #include "NitroNumberShimmerDirection.hpp"
26
+ #include <memory>
27
+ #include "HybridNitroTextViewSpec.hpp"
28
+ #include <functional>
29
+
30
+ namespace margelo::nitro::nitroinput::views {
31
+
32
+ using namespace facebook;
33
+
34
+ /**
35
+ * The name of the actual native View.
36
+ */
37
+ extern const char HybridNitroTextViewComponentName[];
38
+
39
+ /**
40
+ * Props for the "NitroTextView" View.
41
+ */
42
+ class HybridNitroTextViewProps final: public react::ViewProps {
43
+ public:
44
+ HybridNitroTextViewProps() = default;
45
+ HybridNitroTextViewProps(const react::PropsParserContext& context,
46
+ const HybridNitroTextViewProps& sourceProps,
47
+ const react::RawProps& rawProps);
48
+
49
+ public:
50
+ nitro::ReactProp<std::string> text;
51
+ nitro::ReactProp<std::optional<double>> fontSize;
52
+ nitro::ReactProp<std::optional<double>> fontWeight;
53
+ nitro::ReactProp<std::optional<std::string>> fontFamily;
54
+ nitro::ReactProp<std::optional<double>> color;
55
+ nitro::ReactProp<std::optional<double>> letterSpacing;
56
+ nitro::ReactProp<std::optional<NitroNumberTextAlign>> textAlign;
57
+ nitro::ReactProp<std::optional<bool>> rightToLeft;
58
+ nitro::ReactProp<std::optional<double>> duration;
59
+ nitro::ReactProp<std::optional<NitroInputEasing>> easing;
60
+ nitro::ReactProp<std::optional<double>> bounce;
61
+ nitro::ReactProp<std::optional<NitroInputEffect>> effect;
62
+ nitro::ReactProp<std::optional<bool>> respectReduceMotion;
63
+ nitro::ReactProp<std::optional<bool>> loading;
64
+ nitro::ReactProp<std::optional<double>> shimmerColor;
65
+ nitro::ReactProp<std::optional<double>> shimmerDuration;
66
+ nitro::ReactProp<std::optional<double>> shimmerAngle;
67
+ nitro::ReactProp<std::optional<double>> shimmerWidth;
68
+ nitro::ReactProp<std::optional<double>> shimmerBaseColor;
69
+ nitro::ReactProp<std::optional<NitroNumberShimmerDirection>> shimmerDirection;
70
+ nitro::ReactProp<std::optional<double>> shimmerDelay;
71
+ nitro::ReactProp<std::optional<std::function<void(const std::shared_ptr<HybridNitroTextViewSpec>& /* ref */)>>> hybridRef;
72
+
73
+ [[nodiscard]]
74
+ bool hasSameProps(const HybridNitroTextViewProps& other) const noexcept {
75
+ return text.hasSameValue(other.text) &&
76
+ fontSize.hasSameValue(other.fontSize) &&
77
+ fontWeight.hasSameValue(other.fontWeight) &&
78
+ fontFamily.hasSameValue(other.fontFamily) &&
79
+ color.hasSameValue(other.color) &&
80
+ letterSpacing.hasSameValue(other.letterSpacing) &&
81
+ textAlign.hasSameValue(other.textAlign) &&
82
+ rightToLeft.hasSameValue(other.rightToLeft) &&
83
+ duration.hasSameValue(other.duration) &&
84
+ easing.hasSameValue(other.easing) &&
85
+ bounce.hasSameValue(other.bounce) &&
86
+ effect.hasSameValue(other.effect) &&
87
+ respectReduceMotion.hasSameValue(other.respectReduceMotion) &&
88
+ loading.hasSameValue(other.loading) &&
89
+ shimmerColor.hasSameValue(other.shimmerColor) &&
90
+ shimmerDuration.hasSameValue(other.shimmerDuration) &&
91
+ shimmerAngle.hasSameValue(other.shimmerAngle) &&
92
+ shimmerWidth.hasSameValue(other.shimmerWidth) &&
93
+ shimmerBaseColor.hasSameValue(other.shimmerBaseColor) &&
94
+ shimmerDirection.hasSameValue(other.shimmerDirection) &&
95
+ shimmerDelay.hasSameValue(other.shimmerDelay) &&
96
+ hybridRef.hasSameValue(other.hybridRef);
97
+ }
98
+
99
+ [[nodiscard]]
100
+ bool hasAnyProvidedProps() const noexcept {
101
+ return text.isProvided() ||
102
+ fontSize.isProvided() ||
103
+ fontWeight.isProvided() ||
104
+ fontFamily.isProvided() ||
105
+ color.isProvided() ||
106
+ letterSpacing.isProvided() ||
107
+ textAlign.isProvided() ||
108
+ rightToLeft.isProvided() ||
109
+ duration.isProvided() ||
110
+ easing.isProvided() ||
111
+ bounce.isProvided() ||
112
+ effect.isProvided() ||
113
+ respectReduceMotion.isProvided() ||
114
+ loading.isProvided() ||
115
+ shimmerColor.isProvided() ||
116
+ shimmerDuration.isProvided() ||
117
+ shimmerAngle.isProvided() ||
118
+ shimmerWidth.isProvided() ||
119
+ shimmerBaseColor.isProvided() ||
120
+ shimmerDirection.isProvided() ||
121
+ shimmerDelay.isProvided() ||
122
+ hybridRef.isProvided();
123
+ }
124
+
125
+ private:
126
+ static bool filterObjectKeys(const std::string& propName);
127
+ };
128
+
129
+ /**
130
+ * State for the "NitroTextView" View.
131
+ */
132
+ using HybridNitroTextViewState = nitro::ViewPropsHolderState<HybridNitroTextViewProps>;
133
+
134
+ /**
135
+ * The Shadow Node for the "NitroTextView" View.
136
+ */
137
+ using HybridNitroTextViewShadowNode = react::ConcreteViewShadowNode<HybridNitroTextViewComponentName /* "HybridNitroTextView" */,
138
+ HybridNitroTextViewProps /* custom props */,
139
+ react::ViewEventEmitter /* default */,
140
+ HybridNitroTextViewState /* custom state */>;
141
+
142
+ /**
143
+ * The Component Descriptor for the "NitroTextView" View.
144
+ */
145
+ using HybridNitroTextViewComponentDescriptor = nitro::ViewComponentDescriptor<HybridNitroTextViewShadowNode>;
146
+
147
+ /* The actual view for "NitroTextView" needs to be implemented in platform-specific code. */
148
+
149
+ } // namespace margelo::nitro::nitroinput::views
@@ -14,6 +14,12 @@
14
14
  "maskNotations": true,
15
15
  "maskAutocomplete": true,
16
16
  "maskAutoSkip": true,
17
+ "maskAffinityFormats": true,
18
+ "maskAffinityStrategy": true,
19
+ "maskTextCase": true,
20
+ "maskCharacterMap": true,
21
+ "maskSlotPlaceholder": true,
22
+ "keepPlaceholder": true,
17
23
  "groupingSeparator": true,
18
24
  "decimalSeparator": true,
19
25
  "variant": true,
@@ -32,6 +32,11 @@
32
32
  "loading": true,
33
33
  "shimmerColor": true,
34
34
  "shimmerDuration": true,
35
+ "shimmerAngle": true,
36
+ "shimmerWidth": true,
37
+ "shimmerBaseColor": true,
38
+ "shimmerDirection": true,
39
+ "shimmerDelay": true,
35
40
  "fontSize": true,
36
41
  "prefixFontSize": true,
37
42
  "suffixFontSize": true,
@@ -44,6 +49,19 @@
44
49
  "prefixOffset": true,
45
50
  "suffixOffset": true,
46
51
  "tabularNums": true,
52
+ "signDisplay": true,
53
+ "plusSign": true,
54
+ "minusSign": true,
55
+ "digitGlyphs": true,
56
+ "groupingSizes": true,
57
+ "digitMax": true,
58
+ "continuous": true,
59
+ "prefixColor": true,
60
+ "suffixColor": true,
61
+ "fractionColor": true,
62
+ "fractionFontSize": true,
63
+ "fractionAlign": true,
64
+ "respectReduceMotion": true,
47
65
  "adjustsFontSizeToFit": true,
48
66
  "minimumFontScale": true,
49
67
  "allowFontScaling": true,
@@ -56,6 +74,8 @@
56
74
  "onSizeChange": true,
57
75
  "onRevealEnd": true,
58
76
  "onRevealMilestone": true,
77
+ "onAnimationStart": true,
78
+ "onAnimationEnd": true,
59
79
  "hybridRef": true
60
80
  }
61
81
  }
@@ -0,0 +1,30 @@
1
+ {
2
+ "uiViewClassName": "NitroTextView",
3
+ "supportsRawText": false,
4
+ "bubblingEventTypes": {},
5
+ "directEventTypes": {},
6
+ "validAttributes": {
7
+ "text": true,
8
+ "fontSize": true,
9
+ "fontWeight": true,
10
+ "fontFamily": true,
11
+ "color": true,
12
+ "letterSpacing": true,
13
+ "textAlign": true,
14
+ "rightToLeft": true,
15
+ "duration": true,
16
+ "easing": true,
17
+ "bounce": true,
18
+ "effect": true,
19
+ "respectReduceMotion": true,
20
+ "loading": true,
21
+ "shimmerColor": true,
22
+ "shimmerDuration": true,
23
+ "shimmerAngle": true,
24
+ "shimmerWidth": true,
25
+ "shimmerBaseColor": true,
26
+ "shimmerDirection": true,
27
+ "shimmerDelay": true,
28
+ "hybridRef": true
29
+ }
30
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nitro-input",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Native text for React Native, built with Nitro: a text and amount input with native formatting, masks and a Torph-style reflow, and an animated number (odometer, SwiftUI-style numeric text, ticker) whose digits roll or swap natively, with currency layouts and animated currency switches, shrink-to-fit, a loading shimmer and a jackpot reveal.",
5
5
  "main": "lib/commonjs/src/index.js",
6
6
  "module": "lib/module/src/index.js",
@@ -39,7 +39,7 @@
39
39
  "specs": "nitrogen --logLevel=\"debug\"",
40
40
  "prepack": "bun run build",
41
41
  "test": "jest",
42
- "test:cpp": "mkdir -p .cache && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/ReflowEngine.cpp cpp/AmountFormatter.cpp cpp/__tests__/ReflowEngineTest.cpp -o .cache/reflow-engine-test && .cache/reflow-engine-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/AmountFormatter.cpp cpp/__tests__/AmountFormatterTest.cpp -o .cache/amount-formatter-test && .cache/amount-formatter-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/AmountFormatter.cpp cpp/MaskEngine.cpp cpp/__tests__/MaskEngineTest.cpp -o .cache/mask-engine-test && .cache/mask-engine-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/OutlineGeometry.cpp cpp/__tests__/OutlineGeometryTest.cpp -o .cache/outline-geometry-test && .cache/outline-geometry-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/RollingEngine.cpp cpp/__tests__/RollingEngineTest.cpp -o .cache/rolling-engine-test && .cache/rolling-engine-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/numberformat/NumberFormatCore.cpp cpp/__tests__/NumberFormatCoreTest.cpp -o .cache/number-format-core-test && .cache/number-format-core-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/numberformat/NumberFormatCore.cpp cpp/numberformat/NumberFormatProbe.cpp cpp/__tests__/NumberFormatProbeTest.cpp -o .cache/number-format-probe-test && .cache/number-format-probe-test",
42
+ "test:cpp": "mkdir -p .cache && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/ReflowEngine.cpp cpp/AmountFormatter.cpp cpp/__tests__/ReflowEngineTest.cpp -o .cache/reflow-engine-test && .cache/reflow-engine-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/AmountFormatter.cpp cpp/__tests__/AmountFormatterTest.cpp -o .cache/amount-formatter-test && .cache/amount-formatter-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/AmountFormatter.cpp cpp/MaskEngine.cpp cpp/__tests__/MaskEngineTest.cpp -o .cache/mask-engine-test && .cache/mask-engine-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/AmountFormatter.cpp cpp/MaskEngine.cpp cpp/__tests__/MaskEngineCorpusTest.cpp -o .cache/mask-engine-corpus-test && .cache/mask-engine-corpus-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/OutlineGeometry.cpp cpp/__tests__/OutlineGeometryTest.cpp -o .cache/outline-geometry-test && .cache/outline-geometry-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/RollingEngine.cpp cpp/__tests__/RollingEngineTest.cpp -o .cache/rolling-engine-test && .cache/rolling-engine-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/numberformat/NumberFormatCore.cpp cpp/__tests__/NumberFormatCoreTest.cpp -o .cache/number-format-core-test && .cache/number-format-core-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/numberformat/NumberFormatCore.cpp cpp/numberformat/NumberFormatProbe.cpp cpp/__tests__/NumberFormatProbeTest.cpp -o .cache/number-format-probe-test && .cache/number-format-probe-test",
43
43
  "test:cpp:sanitize": "mkdir -p .cache && clang++ -std=c++20 -O1 -g -fsanitize=address,undefined -fno-omit-frame-pointer -Icpp cpp/RollingEngine.cpp cpp/__tests__/RollingEngineTest.cpp -o .cache/rolling-engine-sanitize && .cache/rolling-engine-sanitize",
44
44
  "release": "release-it"
45
45
  },
@@ -37,6 +37,9 @@ import type {
37
37
  NitroInputSignPlacement,
38
38
  NitroInputVariant,
39
39
  NitroInputNotation,
40
+ NitroInputMaskAffinity,
41
+ NitroInputTextCase,
42
+ NitroInputCharacterMapping,
40
43
  } from './specs/NitroInput.nitro'
41
44
  import {
42
45
  allocateWorkletId,
@@ -152,6 +155,8 @@ function reactTagOf(host: unknown): number {
152
155
  }
153
156
 
154
157
  const EMPTY_NOTATIONS: NitroInputNotation[] = []
158
+ const EMPTY_STRINGS: string[] = []
159
+ const EMPTY_MAPPINGS: NitroInputCharacterMapping[] = []
155
160
 
156
161
  /** Mounted fields, by the host instance React Native's registry stores. */
157
162
  const mountedFields = new WeakMap<object, { focus(): void; blur(): void }>()
@@ -318,6 +323,44 @@ export interface NitroInputProps extends Omit<ViewProps, 'children' | 'onFocus'
318
323
  maskAutocomplete?: boolean
319
324
  /** `'mask'`: backspace walks back over autocompleted constants. Default: `false`. */
320
325
  maskAutoSkip?: boolean
326
+ /**
327
+ * `'mask'`: more patterns the text may take, e.g. a 4-6-5 Amex card beside
328
+ * a 4-4-4-4 `mask`: `['{34}[00] [000000] [00000]', '{37}[00] [000000] [00000]']`.
329
+ * Every edit is masked with each and the best, by `maskAffinityStrategy`, is
330
+ * kept; `mask` wins ties.
331
+ */
332
+ maskAffinityFormats?: string[]
333
+ /**
334
+ * `'mask'`: how the best of `maskAffinityFormats` is chosen. `'wholeString'`
335
+ * the format that accepts the most characters and inserts the fewest,
336
+ * `'prefix'` the one whose output starts most like what was typed,
337
+ * `'capacity'` / `'extractedValueCapacity'` the fullest format that still
338
+ * holds all of the text / all of its value characters. Default: `'wholeString'`.
339
+ */
340
+ maskAffinityStrategy?: NitroInputMaskAffinity
341
+ /** `'mask'`: uppercases or lowercases letters as they are typed or pasted. Default: `'none'`. */
342
+ maskTextCase?: NitroInputTextCase
343
+ /**
344
+ * `'mask'`: characters replaced before masking, one character each:
345
+ * `{ 'С': 'C' }` turns a Cyrillic look-alike into a Latin letter,
346
+ * `{ ',': '.' }` lets a comma through to a dot-decimal mask. An empty
347
+ * replacement drops the character.
348
+ */
349
+ maskCharacterMap?: Record<string, string>
350
+ /**
351
+ * `'mask'`: the character each empty slot shows in the kept placeholder and
352
+ * in `onChangeMask`'s tail. Default: `'_'` with `keepPlaceholder`, otherwise
353
+ * the slot's own notation character.
354
+ */
355
+ maskSlotPlaceholder?: string
356
+ /**
357
+ * `'mask'`: keeps the rest of the placeholder visible after what has been
358
+ * typed: with `placeholder="1234 5678 9012"`, typing "12345" shows
359
+ * "1234 5" and then "678 9012" greyed. Without a `placeholder` the mask
360
+ * itself is shown, its empty slots as `maskSlotPlaceholder`:
361
+ * `+1 (212) ___-____`. Default: `false`.
362
+ */
363
+ keepPlaceholder?: boolean
321
364
  /**
322
365
  * `'mask'` mode: called whenever the text changes, from a keystroke,
323
366
  * `setText` / `clear` or the `value` prop alike, with the masked text, the
@@ -698,6 +741,12 @@ export const NitroInput = forwardRef<NitroInputHandle, NitroInputProps>(
698
741
  maskNotations,
699
742
  maskAutocomplete,
700
743
  maskAutoSkip,
744
+ maskAffinityFormats,
745
+ maskAffinityStrategy,
746
+ maskTextCase,
747
+ maskCharacterMap,
748
+ maskSlotPlaceholder,
749
+ keepPlaceholder,
701
750
  returnKeyType,
702
751
  autoCapitalize,
703
752
  autoCorrect,
@@ -1122,6 +1171,24 @@ export const NitroInput = forwardRef<NitroInputHandle, NitroInputProps>(
1122
1171
  // eslint-disable-next-line react-hooks/exhaustive-deps
1123
1172
  [notationsKey]
1124
1173
  )
1174
+ // The same for the affinity formats and the character map.
1175
+ const affinityKey =
1176
+ maskAffinityFormats != null && maskAffinityFormats.length > 0 ? JSON.stringify(maskAffinityFormats) : ''
1177
+ const stableAffinityFormats = useMemo(
1178
+ () => (affinityKey !== '' && maskAffinityFormats ? [...maskAffinityFormats] : EMPTY_STRINGS),
1179
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1180
+ [affinityKey]
1181
+ )
1182
+ const characterMapKey =
1183
+ maskCharacterMap != null && Object.keys(maskCharacterMap).length > 0 ? JSON.stringify(maskCharacterMap) : ''
1184
+ const stableCharacterMap = useMemo<NitroInputCharacterMapping[]>(
1185
+ () =>
1186
+ characterMapKey !== '' && maskCharacterMap
1187
+ ? Object.entries(maskCharacterMap).map(([from, to]) => ({ from, to }))
1188
+ : EMPTY_MAPPINGS,
1189
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1190
+ [characterMapKey]
1191
+ )
1125
1192
  const resolvedFractionDigits = fractionDigits ?? derived?.fractionDigits ?? 2
1126
1193
  const resolvedKeyboardType =
1127
1194
  keyboardType ??
@@ -1275,6 +1342,12 @@ export const NitroInput = forwardRef<NitroInputHandle, NitroInputProps>(
1275
1342
  maskNotations={stableNotations}
1276
1343
  maskAutocomplete={maskAutocomplete ?? true}
1277
1344
  maskAutoSkip={maskAutoSkip ?? false}
1345
+ maskAffinityFormats={stableAffinityFormats}
1346
+ maskAffinityStrategy={maskAffinityStrategy ?? 'wholeString'}
1347
+ maskTextCase={maskTextCase ?? 'none'}
1348
+ maskCharacterMap={stableCharacterMap}
1349
+ maskSlotPlaceholder={maskSlotPlaceholder ?? (keepPlaceholder ? '_' : '')}
1350
+ keepPlaceholder={keepPlaceholder ?? false}
1278
1351
  onChangeMask={onChangeMaskCallback}
1279
1352
  keyboardType={resolvedKeyboardType}
1280
1353
  returnKeyType={resolvedReturnKeyType}