react-native-nitro-input 0.4.0 → 0.4.3
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.
- package/CHANGELOG.md +44 -0
- package/README.md +2 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/DigitSlots.kt +143 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroInputView.kt +6 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberView.kt +24 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/InputFonts.kt +50 -5
- package/android/src/main/java/com/margelo/nitro/nitroinput/InputSizing.kt +7 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputView.kt +117 -6
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroNumberView.kt +290 -137
- package/ios/HybridNitroInputView.swift +4 -0
- package/ios/InputSizing.swift +98 -4
- package/ios/NitroInputView.swift +79 -12
- package/lib/commonjs/nitrogen/generated/shared/json/NitroInputViewConfig.json +2 -0
- package/lib/commonjs/src/NitroInput.js +3 -1
- package/lib/commonjs/src/NitroNumber.js +94 -29
- package/lib/module/nitrogen/generated/shared/json/NitroInputViewConfig.json +2 -0
- package/lib/module/src/NitroInput.js +3 -1
- package/lib/module/src/NitroNumber.js +94 -29
- package/lib/typescript/src/NitroInput.d.ts +11 -0
- package/lib/typescript/src/specs/NitroInput.nitro.d.ts +4 -0
- package/lib/typescript/src/specs/NitroInputMeasure.nitro.d.ts +2 -0
- package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.cpp +18 -0
- package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.hpp +4 -0
- package/nitrogen/generated/android/c++/JNitroInputSizing.hpp +9 -1
- package/nitrogen/generated/android/c++/views/JHybridNitroInputViewStateUpdater.cpp +10 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroInputViewSpec.kt +12 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputSizing.kt +12 -2
- package/nitrogen/generated/ios/c++/HybridNitroInputViewSpecSwift.hpp +12 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroInputViewComponent.mm +12 -0
- package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec_cxx.swift +22 -0
- package/nitrogen/generated/ios/swift/NitroInputSizing.swift +12 -2
- package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.hpp +4 -0
- package/nitrogen/generated/shared/c++/NitroInputSizing.hpp +9 -1
- package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.cpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.hpp +6 -0
- package/nitrogen/generated/shared/json/NitroInputViewConfig.json +2 -0
- package/package.json +1 -1
- package/src/NitroInput.tsx +14 -0
- package/src/NitroNumber.tsx +121 -54
- package/src/specs/NitroInput.nitro.ts +4 -0
- package/src/specs/NitroInputMeasure.nitro.ts +2 -0
|
@@ -11,6 +11,73 @@ import { figureOf, formatProps, toNumber, withMinorDigits } from './formatProps'
|
|
|
11
11
|
export const NativeNitroNumberView = getHostComponent('NitroNumberView', () => NitroNumberViewConfig);
|
|
12
12
|
const EMPTY = [];
|
|
13
13
|
const EMPTY_STRINGS = [];
|
|
14
|
+
/**
|
|
15
|
+
* A weak reference where the engine has them (Hermes, JSC, V8), else a strong
|
|
16
|
+
* one. Two functions on purpose: an engine keeps one scope per function for
|
|
17
|
+
* everything its closures capture, so a `() => target` fallback written beside
|
|
18
|
+
* the weak closure would put `target` in the weak closure's scope too.
|
|
19
|
+
*/
|
|
20
|
+
function weakly(target) {
|
|
21
|
+
return typeof WeakRef === 'function' ? weakDeref(new WeakRef(target)) : strongDeref(target);
|
|
22
|
+
}
|
|
23
|
+
function weakDeref(ref) {
|
|
24
|
+
return () => ref.deref();
|
|
25
|
+
}
|
|
26
|
+
function strongDeref(target) {
|
|
27
|
+
return () => target;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A Nitro callback that calls `handler(self, ...args)` for as long as the
|
|
31
|
+
* component behind `self` is alive, holding `self` only weakly.
|
|
32
|
+
*
|
|
33
|
+
* Why. Nitro keeps every callback prop of a view as a JS function held from
|
|
34
|
+
* C++ (in the Fabric props of its shadow node), which Hermes treats as a GC
|
|
35
|
+
* root. A closure written inside the component shares the render's scope,
|
|
36
|
+
* so it reaches the fiber (through `setSize`) and the hybrid view's handle
|
|
37
|
+
* (through `nativeRef`), and the fiber holds the shadow node that holds the
|
|
38
|
+
* props that hold the closure: a loop through native code that Hermes can
|
|
39
|
+
* never collect. Every unmounted NitroNumber stayed, its fiber subtree, its
|
|
40
|
+
* hybrid view and Nitro's C++ part included: over 4,000 after a minute of
|
|
41
|
+
* a scrolling list, and the app's memory climbed with them. Built here, in
|
|
42
|
+
* module scope, the closure holds only the weak reference and `handler`
|
|
43
|
+
* (itself module-level); the fiber is what keeps `self` alive.
|
|
44
|
+
*/
|
|
45
|
+
function relay(self, handler) {
|
|
46
|
+
return relayTo(weakly(self), handler);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The closure itself, made where `self` is not in scope at all: Hermes (in
|
|
50
|
+
* debuggable builds, at least) keeps every variable of a function that makes
|
|
51
|
+
* a closure in that closure's scope, used or not, and a `self` there would
|
|
52
|
+
* hold the component strongly again.
|
|
53
|
+
*/
|
|
54
|
+
function relayTo(live, handler) {
|
|
55
|
+
return callback((...args) => {
|
|
56
|
+
const target = live();
|
|
57
|
+
if (target !== undefined)
|
|
58
|
+
handler(target, ...args);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function attachNative(self, instance) {
|
|
62
|
+
self.nativeRef.current = instance;
|
|
63
|
+
self.latestOnNativeRef.current?.(instance);
|
|
64
|
+
}
|
|
65
|
+
function applySize(self, width, height) {
|
|
66
|
+
self.setSize((previous) => previous !== null && previous.width === width && previous.height === height ? previous : { width, height });
|
|
67
|
+
}
|
|
68
|
+
function fireRevealEnd(self) {
|
|
69
|
+
self.latestOnRevealEnd.current?.();
|
|
70
|
+
}
|
|
71
|
+
function fireRevealMilestone(self, index, milestone) {
|
|
72
|
+
self.latestOnRevealMilestone.current?.(index, milestone);
|
|
73
|
+
}
|
|
74
|
+
function fireAnimationStart(self) {
|
|
75
|
+
self.latestOnAnimationStart.current?.();
|
|
76
|
+
}
|
|
77
|
+
/** The figure a compact format rolls is not the value (1.2 for 1,234): report the value. */
|
|
78
|
+
function fireAnimationEnd(self, shown) {
|
|
79
|
+
self.latestOnAnimationEnd.current?.(self.compactRef.current ? toNumber(self.latestValue.current) : shown);
|
|
80
|
+
}
|
|
14
81
|
/** Each transition's own timing, used when the props leave it unsaid. */
|
|
15
82
|
const TRANSITION_DEFAULTS = {
|
|
16
83
|
roll: { duration: 500, easing: 'easeInOut', stagger: 0 },
|
|
@@ -29,6 +96,8 @@ const TRANSITION_DEFAULTS = {
|
|
|
29
96
|
*/
|
|
30
97
|
export const NitroNumber = forwardRef(function NitroNumber({ value, minorDigits, fractionDigits, minimumIntegerDigits, groupingSeparator, decimalSeparator, prefix, suffix, transition, flashUpColor, flashDownColor, flashDuration, popOnChange, duration, easing, bounce, stagger, direction, reveal, revealStyle, revealDuration, revealBounce, revealGrow, revealStagger, revealMilestones, revealMilestoneHold, onRevealEnd, onRevealMilestone, loading, shimmerColor, shimmerDuration, shimmerAngle, shimmerWidth, shimmerBaseColor, shimmerDirection, shimmerDelay, fontSize, prefixFontSize, suffixFontSize, affixAlign, prefixAlign, suffixAlign, letterSpacing, prefixSpacing, suffixSpacing, prefixOffset, suffixOffset, tabularNums, format, adjustsFontSizeToFit, minimumFontScale, allowFontScaling, maxFontSizeMultiplier, fontWeight, fontFamily, color, textAlign, signDisplay, plusSign, minusSign, prefixColor, suffixColor, fractionColor, fractionFontSize, fractionAlign, digitGlyphs, groupingSizes, digits, continuous, animated, respectReduceMotion, onAnimationStart, onAnimationEnd, onNativeRef, style, ...viewProps }, ref) {
|
|
31
98
|
const nativeRef = useRef(null);
|
|
99
|
+
// Whether a compact format is rolling (its figure is not the value); set below.
|
|
100
|
+
const compactRef = useRef(false);
|
|
32
101
|
const latestOnNativeRef = useRef(onNativeRef);
|
|
33
102
|
latestOnNativeRef.current = onNativeRef;
|
|
34
103
|
const latestOnRevealEnd = useRef(onRevealEnd);
|
|
@@ -44,34 +113,31 @@ export const NitroNumber = forwardRef(function NitroNumber({ value, minorDigits,
|
|
|
44
113
|
const latestOnAnimationEnd = useRef(onAnimationEnd);
|
|
45
114
|
latestOnAnimationEnd.current = onAnimationEnd;
|
|
46
115
|
const [size, setSize] = useState(null);
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const onAnimationEndCallback = useMemo(() => callback((shown) => {
|
|
73
|
-
latestOnAnimationEnd.current?.(compactRef.current ? toNumber(latestValue.current) : shown);
|
|
74
|
-
}), []);
|
|
116
|
+
// The native callbacks: wrapped with `callback()` and referentially stable
|
|
117
|
+
// (a new wrapper re-sets the prop every render), and built in module scope
|
|
118
|
+
// around a weak reference to this component's state (see `relay`).
|
|
119
|
+
const self = useMemo(() => ({
|
|
120
|
+
nativeRef,
|
|
121
|
+
latestOnNativeRef,
|
|
122
|
+
setSize,
|
|
123
|
+
latestOnRevealEnd,
|
|
124
|
+
latestOnRevealMilestone,
|
|
125
|
+
latestOnAnimationStart,
|
|
126
|
+
latestOnAnimationEnd,
|
|
127
|
+
compactRef,
|
|
128
|
+
latestValue,
|
|
129
|
+
}),
|
|
130
|
+
// Every member is a ref or a state setter, stable for the component's life.
|
|
131
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
132
|
+
[]);
|
|
133
|
+
const hybridRef = useMemo(() => relay(self, attachNative), [self]);
|
|
134
|
+
const onSizeChange = useMemo(() => relay(self, applySize), [self]);
|
|
135
|
+
// The latest handlers are read through refs, so a caller passing an inline
|
|
136
|
+
// arrow doesn't re-set the native prop each render.
|
|
137
|
+
const onRevealEndCallback = useMemo(() => relay(self, fireRevealEnd), [self]);
|
|
138
|
+
const onRevealMilestoneCallback = useMemo(() => relay(self, fireRevealMilestone), [self]);
|
|
139
|
+
const onAnimationStartCallback = useMemo(() => relay(self, fireAnimationStart), [self]);
|
|
140
|
+
const onAnimationEndCallback = useMemo(() => relay(self, fireAnimationEnd), [self]);
|
|
75
141
|
// A new array literal each render must not re-set the native prop. Always an
|
|
76
142
|
// array (empty = no tiers): removing the prop would reach native as `null`,
|
|
77
143
|
// which Nitro's array parser rejects ("Value is null, expected an Object").
|
|
@@ -111,7 +177,6 @@ export const NitroNumber = forwardRef(function NitroNumber({ value, minorDigits,
|
|
|
111
177
|
// rolls the figure 1.2.
|
|
112
178
|
const figure = useMemo(() => (format ? figureOf(format, input) : undefined), [format, input]);
|
|
113
179
|
const compact = derived?.compact ? figure : undefined;
|
|
114
|
-
const compactRef = useRef(false);
|
|
115
180
|
compactRef.current = compact !== undefined;
|
|
116
181
|
// Which way the value moved, for a compact figure that fell while the value grew (999 → 1K).
|
|
117
182
|
const numericValue = toNumber(input);
|
|
@@ -229,6 +229,17 @@ export interface NitroInputProps extends Omit<ViewProps, 'children' | 'onFocus'
|
|
|
229
229
|
* Default: `0`.
|
|
230
230
|
*/
|
|
231
231
|
letterSpacing?: number;
|
|
232
|
+
/**
|
|
233
|
+
* Unset (the default): the font's tabular figures, where it has them (the
|
|
234
|
+
* system fonts do), at no cost. `true`: every digit as wide as the widest
|
|
235
|
+
* even in a font without them (Open Runde), laid out that wide and centred,
|
|
236
|
+
* so typing over a `keepPlaceholder` mask never moves what is still to come
|
|
237
|
+
* and an amount keeps its width as its digits change; that layout costs a
|
|
238
|
+
* little on each change. `false`: the font's proportional figures. A
|
|
239
|
+
* style's `fontVariant: ['proportional-nums']` is `false` too, as on a
|
|
240
|
+
* `TextInput`; the prop wins.
|
|
241
|
+
*/
|
|
242
|
+
tabularNums?: boolean;
|
|
232
243
|
/** Points between the prefix and the text, in place of the letter spacing there. Defaults to the letter spacing. */
|
|
233
244
|
prefixSpacing?: number;
|
|
234
245
|
/** Points between the text and the suffix, in place of the letter spacing there. Defaults to the letter spacing. */
|
|
@@ -221,6 +221,10 @@ export interface NitroInputProps extends HybridViewProps {
|
|
|
221
221
|
suffixAlign: NitroInputAffixAlign;
|
|
222
222
|
/** Points added after every glyph, like `Text`'s `letterSpacing`; an affix gets it in proportion to its size. */
|
|
223
223
|
textLetterSpacing: number;
|
|
224
|
+
/** The font's tabular figures (`tnum`) rather than its proportional ones. */
|
|
225
|
+
tabularNums: boolean;
|
|
226
|
+
/** Every digit laid out as wide as the widest, centred: tabular figures for a font without them. */
|
|
227
|
+
slotDigits: boolean;
|
|
224
228
|
/** Points between the prefix and the text, in place of the letter spacing there. Not finite: the letter spacing. */
|
|
225
229
|
prefixSpacing: number;
|
|
226
230
|
/** Points between the text and the suffix, in place of the letter spacing there. Not finite: the letter spacing. */
|
|
@@ -509,6 +509,24 @@ namespace margelo::nitro::nitroinput {
|
|
|
509
509
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(double /* textLetterSpacing */)>("setTextLetterSpacing");
|
|
510
510
|
method(_javaPart, textLetterSpacing);
|
|
511
511
|
}
|
|
512
|
+
bool JHybridNitroInputViewSpec::getTabularNums() {
|
|
513
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("getTabularNums");
|
|
514
|
+
auto __result = method(_javaPart);
|
|
515
|
+
return static_cast<bool>(__result);
|
|
516
|
+
}
|
|
517
|
+
void JHybridNitroInputViewSpec::setTabularNums(bool tabularNums) {
|
|
518
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jboolean /* tabularNums */)>("setTabularNums");
|
|
519
|
+
method(_javaPart, tabularNums);
|
|
520
|
+
}
|
|
521
|
+
bool JHybridNitroInputViewSpec::getSlotDigits() {
|
|
522
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("getSlotDigits");
|
|
523
|
+
auto __result = method(_javaPart);
|
|
524
|
+
return static_cast<bool>(__result);
|
|
525
|
+
}
|
|
526
|
+
void JHybridNitroInputViewSpec::setSlotDigits(bool slotDigits) {
|
|
527
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jboolean /* slotDigits */)>("setSlotDigits");
|
|
528
|
+
method(_javaPart, slotDigits);
|
|
529
|
+
}
|
|
512
530
|
double JHybridNitroInputViewSpec::getPrefixSpacing() {
|
|
513
531
|
static const auto method = _javaPart->javaClassStatic()->getMethod<double()>("getPrefixSpacing");
|
|
514
532
|
auto __result = method(_javaPart);
|
|
@@ -124,6 +124,10 @@ namespace margelo::nitro::nitroinput {
|
|
|
124
124
|
void setSuffixAlign(NitroInputAffixAlign suffixAlign) override;
|
|
125
125
|
double getTextLetterSpacing() override;
|
|
126
126
|
void setTextLetterSpacing(double textLetterSpacing) override;
|
|
127
|
+
bool getTabularNums() override;
|
|
128
|
+
void setTabularNums(bool tabularNums) override;
|
|
129
|
+
bool getSlotDigits() override;
|
|
130
|
+
void setSlotDigits(bool slotDigits) override;
|
|
127
131
|
double getPrefixSpacing() override;
|
|
128
132
|
void setPrefixSpacing(double prefixSpacing) override;
|
|
129
133
|
double getSuffixSpacing() override;
|
|
@@ -110,6 +110,10 @@ namespace margelo::nitro::nitroinput {
|
|
|
110
110
|
jni::local_ref<jni::JString> textFamily = this->getFieldValue(fieldTextFamily);
|
|
111
111
|
static const auto fieldTextLetterSpacing = clazz->getField<double>("textLetterSpacing");
|
|
112
112
|
double textLetterSpacing = this->getFieldValue(fieldTextLetterSpacing);
|
|
113
|
+
static const auto fieldTabularNums = clazz->getField<jboolean>("tabularNums");
|
|
114
|
+
jboolean tabularNums = this->getFieldValue(fieldTabularNums);
|
|
115
|
+
static const auto fieldSlotDigits = clazz->getField<jboolean>("slotDigits");
|
|
116
|
+
jboolean slotDigits = this->getFieldValue(fieldSlotDigits);
|
|
113
117
|
static const auto fieldPrefixSpacing = clazz->getField<double>("prefixSpacing");
|
|
114
118
|
double prefixSpacing = this->getFieldValue(fieldPrefixSpacing);
|
|
115
119
|
static const auto fieldSuffixSpacing = clazz->getField<double>("suffixSpacing");
|
|
@@ -187,6 +191,8 @@ namespace margelo::nitro::nitroinput {
|
|
|
187
191
|
textWeight,
|
|
188
192
|
textFamily->toStdString(),
|
|
189
193
|
textLetterSpacing,
|
|
194
|
+
static_cast<bool>(tabularNums),
|
|
195
|
+
static_cast<bool>(slotDigits),
|
|
190
196
|
prefixSpacing,
|
|
191
197
|
suffixSpacing,
|
|
192
198
|
static_cast<bool>(allowFontScaling),
|
|
@@ -205,7 +211,7 @@ namespace margelo::nitro::nitroinput {
|
|
|
205
211
|
*/
|
|
206
212
|
[[maybe_unused]]
|
|
207
213
|
static jni::local_ref<JNitroInputSizing::javaobject> fromCpp(const NitroInputSizing& value) {
|
|
208
|
-
using JSignature = JNitroInputSizing(jni::alias_ref<jni::JString>, jni::alias_ref<JNitroInputMode>, jboolean, jboolean, jboolean, double, double, double, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<JNitroInputSignPlacement>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JArrayClass<JNitroInputNotation>>, jboolean, jboolean, jni::alias_ref<jni::JArrayClass<jni::JString>>, jni::alias_ref<JNitroInputMaskAffinity>, jni::alias_ref<JNitroInputTextCase>, jni::alias_ref<jni::JArrayClass<JNitroInputCharacterMapping>>, jni::alias_ref<jni::JString>, jboolean, double, double, double, double, double, jni::alias_ref<jni::JString>, double, double, double, jboolean, double, jni::alias_ref<JNitroInputVariant>, jni::alias_ref<jni::JString>, jni::alias_ref<JNitroInputLabelBehavior>, double, double);
|
|
214
|
+
using JSignature = JNitroInputSizing(jni::alias_ref<jni::JString>, jni::alias_ref<JNitroInputMode>, jboolean, jboolean, jboolean, double, double, double, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<JNitroInputSignPlacement>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JArrayClass<JNitroInputNotation>>, jboolean, jboolean, jni::alias_ref<jni::JArrayClass<jni::JString>>, jni::alias_ref<JNitroInputMaskAffinity>, jni::alias_ref<JNitroInputTextCase>, jni::alias_ref<jni::JArrayClass<JNitroInputCharacterMapping>>, jni::alias_ref<jni::JString>, jboolean, double, double, double, double, double, jni::alias_ref<jni::JString>, double, jboolean, jboolean, double, double, jboolean, double, jni::alias_ref<JNitroInputVariant>, jni::alias_ref<jni::JString>, jni::alias_ref<JNitroInputLabelBehavior>, double, double);
|
|
209
215
|
static const auto clazz = javaClassStatic();
|
|
210
216
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
211
217
|
return create(
|
|
@@ -268,6 +274,8 @@ namespace margelo::nitro::nitroinput {
|
|
|
268
274
|
value.textWeight,
|
|
269
275
|
jni::make_jstring(value.textFamily),
|
|
270
276
|
value.textLetterSpacing,
|
|
277
|
+
value.tabularNums,
|
|
278
|
+
value.slotDigits,
|
|
271
279
|
value.prefixSpacing,
|
|
272
280
|
value.suffixSpacing,
|
|
273
281
|
value.allowFontScaling,
|
|
@@ -238,6 +238,16 @@ void JHybridNitroInputViewStateUpdater::updateViewProps(jni::alias_ref<jni::JCla
|
|
|
238
238
|
: !newProps->textLetterSpacing.hasSameValue(oldProps->textLetterSpacing)) {
|
|
239
239
|
hybridView->setTextLetterSpacing(newProps->textLetterSpacing.get());
|
|
240
240
|
}
|
|
241
|
+
if (oldProps == nullptr
|
|
242
|
+
? newProps->tabularNums.isProvided()
|
|
243
|
+
: !newProps->tabularNums.hasSameValue(oldProps->tabularNums)) {
|
|
244
|
+
hybridView->setTabularNums(newProps->tabularNums.get());
|
|
245
|
+
}
|
|
246
|
+
if (oldProps == nullptr
|
|
247
|
+
? newProps->slotDigits.isProvided()
|
|
248
|
+
: !newProps->slotDigits.hasSameValue(oldProps->slotDigits)) {
|
|
249
|
+
hybridView->setSlotDigits(newProps->slotDigits.get());
|
|
250
|
+
}
|
|
241
251
|
if (oldProps == nullptr
|
|
242
252
|
? newProps->prefixSpacing.isProvided()
|
|
243
253
|
: !newProps->prefixSpacing.hasSameValue(oldProps->prefixSpacing)) {
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroInputViewSpec.kt
CHANGED
|
@@ -249,6 +249,18 @@ abstract class HybridNitroInputViewSpec: HybridView() {
|
|
|
249
249
|
@set:Keep
|
|
250
250
|
abstract var textLetterSpacing: Double
|
|
251
251
|
|
|
252
|
+
@get:DoNotStrip
|
|
253
|
+
@get:Keep
|
|
254
|
+
@set:DoNotStrip
|
|
255
|
+
@set:Keep
|
|
256
|
+
abstract var tabularNums: Boolean
|
|
257
|
+
|
|
258
|
+
@get:DoNotStrip
|
|
259
|
+
@get:Keep
|
|
260
|
+
@set:DoNotStrip
|
|
261
|
+
@set:Keep
|
|
262
|
+
abstract var slotDigits: Boolean
|
|
263
|
+
|
|
252
264
|
@get:DoNotStrip
|
|
253
265
|
@get:Keep
|
|
254
266
|
@set:DoNotStrip
|
|
@@ -113,6 +113,12 @@ data class NitroInputSizing(
|
|
|
113
113
|
val textLetterSpacing: Double,
|
|
114
114
|
@DoNotStrip
|
|
115
115
|
@Keep
|
|
116
|
+
val tabularNums: Boolean,
|
|
117
|
+
@DoNotStrip
|
|
118
|
+
@Keep
|
|
119
|
+
val slotDigits: Boolean,
|
|
120
|
+
@DoNotStrip
|
|
121
|
+
@Keep
|
|
116
122
|
val prefixSpacing: Double,
|
|
117
123
|
@DoNotStrip
|
|
118
124
|
@Keep
|
|
@@ -175,6 +181,8 @@ data class NitroInputSizing(
|
|
|
175
181
|
&& Objects.deepEquals(this.textWeight, other.textWeight)
|
|
176
182
|
&& Objects.deepEquals(this.textFamily, other.textFamily)
|
|
177
183
|
&& Objects.deepEquals(this.textLetterSpacing, other.textLetterSpacing)
|
|
184
|
+
&& Objects.deepEquals(this.tabularNums, other.tabularNums)
|
|
185
|
+
&& Objects.deepEquals(this.slotDigits, other.slotDigits)
|
|
178
186
|
&& Objects.deepEquals(this.prefixSpacing, other.prefixSpacing)
|
|
179
187
|
&& Objects.deepEquals(this.suffixSpacing, other.suffixSpacing)
|
|
180
188
|
&& Objects.deepEquals(this.allowFontScaling, other.allowFontScaling)
|
|
@@ -219,6 +227,8 @@ data class NitroInputSizing(
|
|
|
219
227
|
textWeight,
|
|
220
228
|
textFamily,
|
|
221
229
|
textLetterSpacing,
|
|
230
|
+
tabularNums,
|
|
231
|
+
slotDigits,
|
|
222
232
|
prefixSpacing,
|
|
223
233
|
suffixSpacing,
|
|
224
234
|
allowFontScaling,
|
|
@@ -239,8 +249,8 @@ data class NitroInputSizing(
|
|
|
239
249
|
@Keep
|
|
240
250
|
@Suppress("unused")
|
|
241
251
|
@JvmStatic
|
|
242
|
-
private fun fromCpp(text: String, mode: NitroInputMode, plain: Boolean, multiline: Boolean, secureTextEntry: Boolean, maxLength: Double, fractionDigits: Double, maxIntegerDigits: Double, groupingSeparator: String, decimalSeparator: String, prefix: String, suffix: String, signPlacement: NitroInputSignPlacement, placeholder: String, mask: String, maskNotations: Array<NitroInputNotation>, maskAutocomplete: Boolean, maskAutoSkip: Boolean, maskAffinityFormats: Array<String>, maskAffinityStrategy: NitroInputMaskAffinity, maskTextCase: NitroInputTextCase, maskCharacterMap: Array<NitroInputCharacterMapping>, maskSlotPlaceholder: String, keepPlaceholder: Boolean, textSize: Double, textLineHeight: Double, prefixFontSize: Double, suffixFontSize: Double, textWeight: Double, textFamily: String, textLetterSpacing: Double, prefixSpacing: Double, suffixSpacing: Double, allowFontScaling: Boolean, maxFontSizeMultiplier: Double, variant: NitroInputVariant, label: String, labelBehavior: NitroInputLabelBehavior, labelFontSize: Double, cornerRadius: Double): NitroInputSizing {
|
|
243
|
-
return NitroInputSizing(text, mode, plain, multiline, secureTextEntry, maxLength, fractionDigits, maxIntegerDigits, groupingSeparator, decimalSeparator, prefix, suffix, signPlacement, placeholder, mask, maskNotations, maskAutocomplete, maskAutoSkip, maskAffinityFormats, maskAffinityStrategy, maskTextCase, maskCharacterMap, maskSlotPlaceholder, keepPlaceholder, textSize, textLineHeight, prefixFontSize, suffixFontSize, textWeight, textFamily, textLetterSpacing, prefixSpacing, suffixSpacing, allowFontScaling, maxFontSizeMultiplier, variant, label, labelBehavior, labelFontSize, cornerRadius)
|
|
252
|
+
private fun fromCpp(text: String, mode: NitroInputMode, plain: Boolean, multiline: Boolean, secureTextEntry: Boolean, maxLength: Double, fractionDigits: Double, maxIntegerDigits: Double, groupingSeparator: String, decimalSeparator: String, prefix: String, suffix: String, signPlacement: NitroInputSignPlacement, placeholder: String, mask: String, maskNotations: Array<NitroInputNotation>, maskAutocomplete: Boolean, maskAutoSkip: Boolean, maskAffinityFormats: Array<String>, maskAffinityStrategy: NitroInputMaskAffinity, maskTextCase: NitroInputTextCase, maskCharacterMap: Array<NitroInputCharacterMapping>, maskSlotPlaceholder: String, keepPlaceholder: Boolean, textSize: Double, textLineHeight: Double, prefixFontSize: Double, suffixFontSize: Double, textWeight: Double, textFamily: String, textLetterSpacing: Double, tabularNums: Boolean, slotDigits: Boolean, prefixSpacing: Double, suffixSpacing: Double, allowFontScaling: Boolean, maxFontSizeMultiplier: Double, variant: NitroInputVariant, label: String, labelBehavior: NitroInputLabelBehavior, labelFontSize: Double, cornerRadius: Double): NitroInputSizing {
|
|
253
|
+
return NitroInputSizing(text, mode, plain, multiline, secureTextEntry, maxLength, fractionDigits, maxIntegerDigits, groupingSeparator, decimalSeparator, prefix, suffix, signPlacement, placeholder, mask, maskNotations, maskAutocomplete, maskAutoSkip, maskAffinityFormats, maskAffinityStrategy, maskTextCase, maskCharacterMap, maskSlotPlaceholder, keepPlaceholder, textSize, textLineHeight, prefixFontSize, suffixFontSize, textWeight, textFamily, textLetterSpacing, tabularNums, slotDigits, prefixSpacing, suffixSpacing, allowFontScaling, maxFontSizeMultiplier, variant, label, labelBehavior, labelFontSize, cornerRadius)
|
|
244
254
|
}
|
|
245
255
|
}
|
|
246
256
|
}
|
|
@@ -359,6 +359,18 @@ namespace margelo::nitro::nitroinput {
|
|
|
359
359
|
inline void setTextLetterSpacing(double textLetterSpacing) noexcept override {
|
|
360
360
|
_swiftPart.setTextLetterSpacing(std::forward<decltype(textLetterSpacing)>(textLetterSpacing));
|
|
361
361
|
}
|
|
362
|
+
inline bool getTabularNums() noexcept override {
|
|
363
|
+
return _swiftPart.getTabularNums();
|
|
364
|
+
}
|
|
365
|
+
inline void setTabularNums(bool tabularNums) noexcept override {
|
|
366
|
+
_swiftPart.setTabularNums(std::forward<decltype(tabularNums)>(tabularNums));
|
|
367
|
+
}
|
|
368
|
+
inline bool getSlotDigits() noexcept override {
|
|
369
|
+
return _swiftPart.getSlotDigits();
|
|
370
|
+
}
|
|
371
|
+
inline void setSlotDigits(bool slotDigits) noexcept override {
|
|
372
|
+
_swiftPart.setSlotDigits(std::forward<decltype(slotDigits)>(slotDigits));
|
|
373
|
+
}
|
|
362
374
|
inline double getPrefixSpacing() noexcept override {
|
|
363
375
|
return _swiftPart.getPrefixSpacing();
|
|
364
376
|
}
|
|
@@ -320,6 +320,18 @@ using namespace margelo::nitro::nitroinput::views;
|
|
|
320
320
|
: !newViewProps.textLetterSpacing.hasSameValue(oldViewProps->textLetterSpacing)) {
|
|
321
321
|
swiftPart.setTextLetterSpacing(newViewProps.textLetterSpacing.get());
|
|
322
322
|
}
|
|
323
|
+
// tabularNums: boolean
|
|
324
|
+
if (oldViewProps == nullptr
|
|
325
|
+
? newViewProps.tabularNums.isProvided()
|
|
326
|
+
: !newViewProps.tabularNums.hasSameValue(oldViewProps->tabularNums)) {
|
|
327
|
+
swiftPart.setTabularNums(newViewProps.tabularNums.get());
|
|
328
|
+
}
|
|
329
|
+
// slotDigits: boolean
|
|
330
|
+
if (oldViewProps == nullptr
|
|
331
|
+
? newViewProps.slotDigits.isProvided()
|
|
332
|
+
: !newViewProps.slotDigits.hasSameValue(oldViewProps->slotDigits)) {
|
|
333
|
+
swiftPart.setSlotDigits(newViewProps.slotDigits.get());
|
|
334
|
+
}
|
|
323
335
|
// prefixSpacing: number
|
|
324
336
|
if (oldViewProps == nullptr
|
|
325
337
|
? newViewProps.prefixSpacing.isProvided()
|
|
@@ -47,6 +47,8 @@ public protocol HybridNitroInputViewSpec_protocol: HybridObject, HybridView {
|
|
|
47
47
|
var prefixAlign: NitroInputAffixAlign { get set }
|
|
48
48
|
var suffixAlign: NitroInputAffixAlign { get set }
|
|
49
49
|
var textLetterSpacing: Double { get set }
|
|
50
|
+
var tabularNums: Bool { get set }
|
|
51
|
+
var slotDigits: Bool { get set }
|
|
50
52
|
var prefixSpacing: Double { get set }
|
|
51
53
|
var suffixSpacing: Double { get set }
|
|
52
54
|
var prefixOffset: Double { get set }
|
|
@@ -546,6 +546,28 @@ open class HybridNitroInputViewSpec_cxx {
|
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
|
|
549
|
+
public final var tabularNums: Bool {
|
|
550
|
+
@inline(__always)
|
|
551
|
+
get {
|
|
552
|
+
return self.__implementation.tabularNums
|
|
553
|
+
}
|
|
554
|
+
@inline(__always)
|
|
555
|
+
set {
|
|
556
|
+
self.__implementation.tabularNums = newValue
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
public final var slotDigits: Bool {
|
|
561
|
+
@inline(__always)
|
|
562
|
+
get {
|
|
563
|
+
return self.__implementation.slotDigits
|
|
564
|
+
}
|
|
565
|
+
@inline(__always)
|
|
566
|
+
set {
|
|
567
|
+
self.__implementation.slotDigits = newValue
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
549
571
|
public final var prefixSpacing: Double {
|
|
550
572
|
@inline(__always)
|
|
551
573
|
get {
|
|
@@ -18,7 +18,7 @@ public extension NitroInputSizing {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `NitroInputSizing`.
|
|
20
20
|
*/
|
|
21
|
-
init(text: String, mode: NitroInputMode, plain: Bool, multiline: Bool, secureTextEntry: Bool, maxLength: Double, fractionDigits: Double, maxIntegerDigits: Double, groupingSeparator: String, decimalSeparator: String, prefix: String, suffix: String, signPlacement: NitroInputSignPlacement, placeholder: String, mask: String, maskNotations: [NitroInputNotation], maskAutocomplete: Bool, maskAutoSkip: Bool, maskAffinityFormats: [String], maskAffinityStrategy: NitroInputMaskAffinity, maskTextCase: NitroInputTextCase, maskCharacterMap: [NitroInputCharacterMapping], maskSlotPlaceholder: String, keepPlaceholder: Bool, textSize: Double, textLineHeight: Double, prefixFontSize: Double, suffixFontSize: Double, textWeight: Double, textFamily: String, textLetterSpacing: Double, prefixSpacing: Double, suffixSpacing: Double, allowFontScaling: Bool, maxFontSizeMultiplier: Double, variant: NitroInputVariant, label: String, labelBehavior: NitroInputLabelBehavior, labelFontSize: Double, cornerRadius: Double) {
|
|
21
|
+
init(text: String, mode: NitroInputMode, plain: Bool, multiline: Bool, secureTextEntry: Bool, maxLength: Double, fractionDigits: Double, maxIntegerDigits: Double, groupingSeparator: String, decimalSeparator: String, prefix: String, suffix: String, signPlacement: NitroInputSignPlacement, placeholder: String, mask: String, maskNotations: [NitroInputNotation], maskAutocomplete: Bool, maskAutoSkip: Bool, maskAffinityFormats: [String], maskAffinityStrategy: NitroInputMaskAffinity, maskTextCase: NitroInputTextCase, maskCharacterMap: [NitroInputCharacterMapping], maskSlotPlaceholder: String, keepPlaceholder: Bool, textSize: Double, textLineHeight: Double, prefixFontSize: Double, suffixFontSize: Double, textWeight: Double, textFamily: String, textLetterSpacing: Double, tabularNums: Bool, slotDigits: Bool, prefixSpacing: Double, suffixSpacing: Double, allowFontScaling: Bool, maxFontSizeMultiplier: Double, variant: NitroInputVariant, label: String, labelBehavior: NitroInputLabelBehavior, labelFontSize: Double, cornerRadius: Double) {
|
|
22
22
|
self.init(std.string(text), mode, plain, multiline, secureTextEntry, maxLength, fractionDigits, maxIntegerDigits, std.string(groupingSeparator), std.string(decimalSeparator), std.string(prefix), std.string(suffix), signPlacement, std.string(placeholder), std.string(mask), { () -> bridge.std__vector_NitroInputNotation_ in
|
|
23
23
|
var __vector = bridge.create_std__vector_NitroInputNotation_(maskNotations.count)
|
|
24
24
|
for __item in maskNotations {
|
|
@@ -37,7 +37,7 @@ public extension NitroInputSizing {
|
|
|
37
37
|
__vector.push_back(__item)
|
|
38
38
|
}
|
|
39
39
|
return __vector
|
|
40
|
-
}(), std.string(maskSlotPlaceholder), keepPlaceholder, textSize, textLineHeight, prefixFontSize, suffixFontSize, textWeight, std.string(textFamily), textLetterSpacing, prefixSpacing, suffixSpacing, allowFontScaling, maxFontSizeMultiplier, variant, std.string(label), labelBehavior, labelFontSize, cornerRadius)
|
|
40
|
+
}(), std.string(maskSlotPlaceholder), keepPlaceholder, textSize, textLineHeight, prefixFontSize, suffixFontSize, textWeight, std.string(textFamily), textLetterSpacing, tabularNums, slotDigits, prefixSpacing, suffixSpacing, allowFontScaling, maxFontSizeMultiplier, variant, std.string(label), labelBehavior, labelFontSize, cornerRadius)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
@inline(__always)
|
|
@@ -195,6 +195,16 @@ public extension NitroInputSizing {
|
|
|
195
195
|
return self.__textLetterSpacing
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
@inline(__always)
|
|
199
|
+
var tabularNums: Bool {
|
|
200
|
+
return self.__tabularNums
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@inline(__always)
|
|
204
|
+
var slotDigits: Bool {
|
|
205
|
+
return self.__slotDigits
|
|
206
|
+
}
|
|
207
|
+
|
|
198
208
|
@inline(__always)
|
|
199
209
|
var prefixSpacing: Double {
|
|
200
210
|
return self.__prefixSpacing
|
|
@@ -88,6 +88,10 @@ namespace margelo::nitro::nitroinput {
|
|
|
88
88
|
prototype.registerHybridSetter("suffixAlign", &HybridNitroInputViewSpec::setSuffixAlign);
|
|
89
89
|
prototype.registerHybridGetter("textLetterSpacing", &HybridNitroInputViewSpec::getTextLetterSpacing);
|
|
90
90
|
prototype.registerHybridSetter("textLetterSpacing", &HybridNitroInputViewSpec::setTextLetterSpacing);
|
|
91
|
+
prototype.registerHybridGetter("tabularNums", &HybridNitroInputViewSpec::getTabularNums);
|
|
92
|
+
prototype.registerHybridSetter("tabularNums", &HybridNitroInputViewSpec::setTabularNums);
|
|
93
|
+
prototype.registerHybridGetter("slotDigits", &HybridNitroInputViewSpec::getSlotDigits);
|
|
94
|
+
prototype.registerHybridSetter("slotDigits", &HybridNitroInputViewSpec::setSlotDigits);
|
|
91
95
|
prototype.registerHybridGetter("prefixSpacing", &HybridNitroInputViewSpec::getPrefixSpacing);
|
|
92
96
|
prototype.registerHybridSetter("prefixSpacing", &HybridNitroInputViewSpec::setPrefixSpacing);
|
|
93
97
|
prototype.registerHybridGetter("suffixSpacing", &HybridNitroInputViewSpec::getSuffixSpacing);
|
|
@@ -174,6 +174,10 @@ namespace margelo::nitro::nitroinput {
|
|
|
174
174
|
virtual void setSuffixAlign(NitroInputAffixAlign suffixAlign) = 0;
|
|
175
175
|
virtual double getTextLetterSpacing() = 0;
|
|
176
176
|
virtual void setTextLetterSpacing(double textLetterSpacing) = 0;
|
|
177
|
+
virtual bool getTabularNums() = 0;
|
|
178
|
+
virtual void setTabularNums(bool tabularNums) = 0;
|
|
179
|
+
virtual bool getSlotDigits() = 0;
|
|
180
|
+
virtual void setSlotDigits(bool slotDigits) = 0;
|
|
177
181
|
virtual double getPrefixSpacing() = 0;
|
|
178
182
|
virtual void setPrefixSpacing(double prefixSpacing) = 0;
|
|
179
183
|
virtual double getSuffixSpacing() = 0;
|
|
@@ -94,6 +94,8 @@ namespace margelo::nitro::nitroinput {
|
|
|
94
94
|
double textWeight SWIFT_PRIVATE;
|
|
95
95
|
std::string textFamily SWIFT_PRIVATE;
|
|
96
96
|
double textLetterSpacing SWIFT_PRIVATE;
|
|
97
|
+
bool tabularNums SWIFT_PRIVATE;
|
|
98
|
+
bool slotDigits SWIFT_PRIVATE;
|
|
97
99
|
double prefixSpacing SWIFT_PRIVATE;
|
|
98
100
|
double suffixSpacing SWIFT_PRIVATE;
|
|
99
101
|
bool allowFontScaling SWIFT_PRIVATE;
|
|
@@ -106,7 +108,7 @@ namespace margelo::nitro::nitroinput {
|
|
|
106
108
|
|
|
107
109
|
public:
|
|
108
110
|
NitroInputSizing() = default;
|
|
109
|
-
explicit NitroInputSizing(std::string text, NitroInputMode mode, bool plain, bool multiline, bool secureTextEntry, double maxLength, double fractionDigits, double maxIntegerDigits, std::string groupingSeparator, std::string decimalSeparator, std::string prefix, std::string suffix, NitroInputSignPlacement signPlacement, std::string placeholder, std::string mask, std::vector<NitroInputNotation> maskNotations, bool maskAutocomplete, bool maskAutoSkip, std::vector<std::string> maskAffinityFormats, NitroInputMaskAffinity maskAffinityStrategy, NitroInputTextCase maskTextCase, std::vector<NitroInputCharacterMapping> maskCharacterMap, std::string maskSlotPlaceholder, bool keepPlaceholder, double textSize, double textLineHeight, double prefixFontSize, double suffixFontSize, double textWeight, std::string textFamily, double textLetterSpacing, double prefixSpacing, double suffixSpacing, bool allowFontScaling, double maxFontSizeMultiplier, NitroInputVariant variant, std::string label, NitroInputLabelBehavior labelBehavior, double labelFontSize, double cornerRadius): text(text), mode(mode), plain(plain), multiline(multiline), secureTextEntry(secureTextEntry), maxLength(maxLength), fractionDigits(fractionDigits), maxIntegerDigits(maxIntegerDigits), groupingSeparator(groupingSeparator), decimalSeparator(decimalSeparator), prefix(prefix), suffix(suffix), signPlacement(signPlacement), placeholder(placeholder), mask(mask), maskNotations(maskNotations), maskAutocomplete(maskAutocomplete), maskAutoSkip(maskAutoSkip), maskAffinityFormats(maskAffinityFormats), maskAffinityStrategy(maskAffinityStrategy), maskTextCase(maskTextCase), maskCharacterMap(maskCharacterMap), maskSlotPlaceholder(maskSlotPlaceholder), keepPlaceholder(keepPlaceholder), textSize(textSize), textLineHeight(textLineHeight), prefixFontSize(prefixFontSize), suffixFontSize(suffixFontSize), textWeight(textWeight), textFamily(textFamily), textLetterSpacing(textLetterSpacing), prefixSpacing(prefixSpacing), suffixSpacing(suffixSpacing), allowFontScaling(allowFontScaling), maxFontSizeMultiplier(maxFontSizeMultiplier), variant(variant), label(label), labelBehavior(labelBehavior), labelFontSize(labelFontSize), cornerRadius(cornerRadius) {}
|
|
111
|
+
explicit NitroInputSizing(std::string text, NitroInputMode mode, bool plain, bool multiline, bool secureTextEntry, double maxLength, double fractionDigits, double maxIntegerDigits, std::string groupingSeparator, std::string decimalSeparator, std::string prefix, std::string suffix, NitroInputSignPlacement signPlacement, std::string placeholder, std::string mask, std::vector<NitroInputNotation> maskNotations, bool maskAutocomplete, bool maskAutoSkip, std::vector<std::string> maskAffinityFormats, NitroInputMaskAffinity maskAffinityStrategy, NitroInputTextCase maskTextCase, std::vector<NitroInputCharacterMapping> maskCharacterMap, std::string maskSlotPlaceholder, bool keepPlaceholder, double textSize, double textLineHeight, double prefixFontSize, double suffixFontSize, double textWeight, std::string textFamily, double textLetterSpacing, bool tabularNums, bool slotDigits, double prefixSpacing, double suffixSpacing, bool allowFontScaling, double maxFontSizeMultiplier, NitroInputVariant variant, std::string label, NitroInputLabelBehavior labelBehavior, double labelFontSize, double cornerRadius): text(text), mode(mode), plain(plain), multiline(multiline), secureTextEntry(secureTextEntry), maxLength(maxLength), fractionDigits(fractionDigits), maxIntegerDigits(maxIntegerDigits), groupingSeparator(groupingSeparator), decimalSeparator(decimalSeparator), prefix(prefix), suffix(suffix), signPlacement(signPlacement), placeholder(placeholder), mask(mask), maskNotations(maskNotations), maskAutocomplete(maskAutocomplete), maskAutoSkip(maskAutoSkip), maskAffinityFormats(maskAffinityFormats), maskAffinityStrategy(maskAffinityStrategy), maskTextCase(maskTextCase), maskCharacterMap(maskCharacterMap), maskSlotPlaceholder(maskSlotPlaceholder), keepPlaceholder(keepPlaceholder), textSize(textSize), textLineHeight(textLineHeight), prefixFontSize(prefixFontSize), suffixFontSize(suffixFontSize), textWeight(textWeight), textFamily(textFamily), textLetterSpacing(textLetterSpacing), tabularNums(tabularNums), slotDigits(slotDigits), prefixSpacing(prefixSpacing), suffixSpacing(suffixSpacing), allowFontScaling(allowFontScaling), maxFontSizeMultiplier(maxFontSizeMultiplier), variant(variant), label(label), labelBehavior(labelBehavior), labelFontSize(labelFontSize), cornerRadius(cornerRadius) {}
|
|
110
112
|
|
|
111
113
|
public:
|
|
112
114
|
friend bool operator==(const NitroInputSizing& lhs, const NitroInputSizing& rhs) = default;
|
|
@@ -153,6 +155,8 @@ namespace margelo::nitro {
|
|
|
153
155
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "textWeight"))),
|
|
154
156
|
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "textFamily"))),
|
|
155
157
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "textLetterSpacing"))),
|
|
158
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tabularNums"))),
|
|
159
|
+
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "slotDigits"))),
|
|
156
160
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prefixSpacing"))),
|
|
157
161
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "suffixSpacing"))),
|
|
158
162
|
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "allowFontScaling"))),
|
|
@@ -197,6 +201,8 @@ namespace margelo::nitro {
|
|
|
197
201
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "textWeight"), JSIConverter<double>::toJSI(runtime, arg.textWeight));
|
|
198
202
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "textFamily"), JSIConverter<std::string>::toJSI(runtime, arg.textFamily));
|
|
199
203
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "textLetterSpacing"), JSIConverter<double>::toJSI(runtime, arg.textLetterSpacing));
|
|
204
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "tabularNums"), JSIConverter<bool>::toJSI(runtime, arg.tabularNums));
|
|
205
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "slotDigits"), JSIConverter<bool>::toJSI(runtime, arg.slotDigits));
|
|
200
206
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "prefixSpacing"), JSIConverter<double>::toJSI(runtime, arg.prefixSpacing));
|
|
201
207
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "suffixSpacing"), JSIConverter<double>::toJSI(runtime, arg.suffixSpacing));
|
|
202
208
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "allowFontScaling"), JSIConverter<bool>::toJSI(runtime, arg.allowFontScaling));
|
|
@@ -247,6 +253,8 @@ namespace margelo::nitro {
|
|
|
247
253
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "textWeight")))) return false;
|
|
248
254
|
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "textFamily")))) return false;
|
|
249
255
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "textLetterSpacing")))) return false;
|
|
256
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "tabularNums")))) return false;
|
|
257
|
+
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "slotDigits")))) return false;
|
|
250
258
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "prefixSpacing")))) return false;
|
|
251
259
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "suffixSpacing")))) return false;
|
|
252
260
|
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "allowFontScaling")))) return false;
|
|
@@ -57,6 +57,8 @@ namespace margelo::nitro::nitroinput::views {
|
|
|
57
57
|
prefixAlign(nitro::ReactProp<NitroInputAffixAlign>::fromRawValue("NitroInputView", "prefixAlign", rawProps, sourceProps.prefixAlign)),
|
|
58
58
|
suffixAlign(nitro::ReactProp<NitroInputAffixAlign>::fromRawValue("NitroInputView", "suffixAlign", rawProps, sourceProps.suffixAlign)),
|
|
59
59
|
textLetterSpacing(nitro::ReactProp<double>::fromRawValue("NitroInputView", "textLetterSpacing", rawProps, sourceProps.textLetterSpacing)),
|
|
60
|
+
tabularNums(nitro::ReactProp<bool>::fromRawValue("NitroInputView", "tabularNums", rawProps, sourceProps.tabularNums)),
|
|
61
|
+
slotDigits(nitro::ReactProp<bool>::fromRawValue("NitroInputView", "slotDigits", rawProps, sourceProps.slotDigits)),
|
|
60
62
|
prefixSpacing(nitro::ReactProp<double>::fromRawValue("NitroInputView", "prefixSpacing", rawProps, sourceProps.prefixSpacing)),
|
|
61
63
|
suffixSpacing(nitro::ReactProp<double>::fromRawValue("NitroInputView", "suffixSpacing", rawProps, sourceProps.suffixSpacing)),
|
|
62
64
|
prefixOffset(nitro::ReactProp<double>::fromRawValue("NitroInputView", "prefixOffset", rawProps, sourceProps.prefixOffset)),
|
|
@@ -170,6 +172,8 @@ namespace margelo::nitro::nitroinput::views {
|
|
|
170
172
|
case hashString("prefixAlign"): return true;
|
|
171
173
|
case hashString("suffixAlign"): return true;
|
|
172
174
|
case hashString("textLetterSpacing"): return true;
|
|
175
|
+
case hashString("tabularNums"): return true;
|
|
176
|
+
case hashString("slotDigits"): return true;
|
|
173
177
|
case hashString("prefixSpacing"): return true;
|
|
174
178
|
case hashString("suffixSpacing"): return true;
|
|
175
179
|
case hashString("prefixOffset"): return true;
|
|
@@ -99,6 +99,8 @@ namespace margelo::nitro::nitroinput::views {
|
|
|
99
99
|
nitro::ReactProp<NitroInputAffixAlign> prefixAlign;
|
|
100
100
|
nitro::ReactProp<NitroInputAffixAlign> suffixAlign;
|
|
101
101
|
nitro::ReactProp<double> textLetterSpacing;
|
|
102
|
+
nitro::ReactProp<bool> tabularNums;
|
|
103
|
+
nitro::ReactProp<bool> slotDigits;
|
|
102
104
|
nitro::ReactProp<double> prefixSpacing;
|
|
103
105
|
nitro::ReactProp<double> suffixSpacing;
|
|
104
106
|
nitro::ReactProp<double> prefixOffset;
|
|
@@ -212,6 +214,8 @@ namespace margelo::nitro::nitroinput::views {
|
|
|
212
214
|
prefixAlign.hasSameValue(other.prefixAlign) &&
|
|
213
215
|
suffixAlign.hasSameValue(other.suffixAlign) &&
|
|
214
216
|
textLetterSpacing.hasSameValue(other.textLetterSpacing) &&
|
|
217
|
+
tabularNums.hasSameValue(other.tabularNums) &&
|
|
218
|
+
slotDigits.hasSameValue(other.slotDigits) &&
|
|
215
219
|
prefixSpacing.hasSameValue(other.prefixSpacing) &&
|
|
216
220
|
suffixSpacing.hasSameValue(other.suffixSpacing) &&
|
|
217
221
|
prefixOffset.hasSameValue(other.prefixOffset) &&
|
|
@@ -326,6 +330,8 @@ namespace margelo::nitro::nitroinput::views {
|
|
|
326
330
|
prefixAlign.isProvided() ||
|
|
327
331
|
suffixAlign.isProvided() ||
|
|
328
332
|
textLetterSpacing.isProvided() ||
|
|
333
|
+
tabularNums.isProvided() ||
|
|
334
|
+
slotDigits.isProvided() ||
|
|
329
335
|
prefixSpacing.isProvided() ||
|
|
330
336
|
suffixSpacing.isProvided() ||
|
|
331
337
|
prefixOffset.isProvided() ||
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nitro-input",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
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",
|