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.
- package/CHANGELOG.md +80 -0
- package/README.md +120 -5
- package/android/src/main/cpp/JMaskEngine.cpp +45 -0
- package/android/src/main/cpp/JMaskEngine.hpp +9 -0
- package/android/src/main/cpp/JReflowEngine.cpp +32 -0
- package/android/src/main/cpp/JReflowEngine.hpp +13 -0
- package/android/src/main/cpp/JRollingEngine.cpp +42 -2
- package/android/src/main/cpp/JRollingEngine.hpp +9 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroInputView.kt +24 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatform.kt +76 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberView.kt +88 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroTextMeasure.kt +25 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroTextView.kt +140 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/MaskEngine.kt +16 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputPackage.kt +2 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputView.kt +96 -6
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroNumberView.kt +388 -136
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroTextView.kt +868 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/ReflowEngine.kt +21 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/RollingEngine.kt +13 -2
- package/cpp/MaskEngine.cpp +294 -33
- package/cpp/MaskEngine.hpp +68 -0
- package/cpp/RollingEngine.cpp +92 -8
- package/cpp/RollingEngine.hpp +36 -2
- package/ios/HybridNitroInputView.swift +18 -0
- package/ios/HybridNitroNumberFormatPlatform.swift +87 -9
- package/ios/HybridNitroNumberView.swift +82 -1
- package/ios/HybridNitroTextView.swift +134 -0
- package/ios/NitroInputView.swift +125 -7
- package/ios/NitroNumberView.swift +368 -135
- package/ios/NitroTextView.swift +583 -0
- package/lib/commonjs/nitrogen/generated/shared/json/NitroInputViewConfig.json +6 -0
- package/lib/commonjs/nitrogen/generated/shared/json/NitroNumberViewConfig.json +20 -0
- package/lib/commonjs/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
- package/lib/commonjs/src/NitroInput.js +15 -2
- package/lib/commonjs/src/NitroNumber.js +52 -3
- package/lib/commonjs/src/NitroText.js +138 -0
- package/lib/commonjs/src/NitroTime.js +65 -0
- package/lib/commonjs/src/formatProps.js +76 -16
- package/lib/commonjs/src/index.js +6 -1
- package/lib/commonjs/src/specs/NitroText.nitro.js +2 -0
- package/lib/module/nitrogen/generated/shared/json/NitroInputViewConfig.json +6 -0
- package/lib/module/nitrogen/generated/shared/json/NitroNumberViewConfig.json +20 -0
- package/lib/module/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
- package/lib/module/src/NitroInput.js +15 -2
- package/lib/module/src/NitroNumber.js +53 -4
- package/lib/module/src/NitroText.js +98 -0
- package/lib/module/src/NitroTime.js +29 -0
- package/lib/module/src/formatProps.js +76 -17
- package/lib/module/src/index.js +2 -0
- package/lib/module/src/specs/NitroText.nitro.js +1 -0
- package/lib/typescript/src/NitroInput.d.ts +39 -1
- package/lib/typescript/src/NitroNumber.d.ts +79 -1
- package/lib/typescript/src/NitroText.d.ts +67 -0
- package/lib/typescript/src/NitroTime.d.ts +19 -0
- package/lib/typescript/src/formatProps.d.ts +30 -4
- package/lib/typescript/src/index.d.ts +5 -2
- package/lib/typescript/src/specs/NitroInput.nitro.d.ts +43 -0
- package/lib/typescript/src/specs/NitroNumber.nitro.d.ts +67 -0
- package/lib/typescript/src/specs/NitroText.nitro.d.ts +60 -0
- package/nitro.json +20 -0
- package/nitrogen/generated/android/NitroInput+autolinking.cmake +6 -0
- package/nitrogen/generated/android/NitroInputOnLoad.cpp +34 -0
- package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.cpp +102 -0
- package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.hpp +12 -0
- package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.cpp +243 -0
- package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.hpp +40 -0
- package/nitrogen/generated/android/c++/JHybridNitroTextMeasureSpec.cpp +58 -0
- package/nitrogen/generated/android/c++/JHybridNitroTextMeasureSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JHybridNitroTextViewSpec.cpp +253 -0
- package/nitrogen/generated/android/c++/JHybridNitroTextViewSpec.hpp +104 -0
- package/nitrogen/generated/android/c++/JNitroInputCharacterMapping.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroInputMaskAffinity.hpp +64 -0
- package/nitrogen/generated/android/c++/JNitroInputTextCase.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroNumberShimmerDirection.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroNumberSignDisplay.hpp +67 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroInputViewStateUpdater.cpp +30 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.cpp +100 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroTextViewStateUpdater.cpp +174 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroTextViewStateUpdater.hpp +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroInputViewSpec.kt +36 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberViewSpec.kt +136 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroTextMeasureSpec.kt +60 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroTextViewSpec.kt +179 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputCharacterMapping.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputMaskAffinity.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroInputTextCase.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberShimmerDirection.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberSignDisplay.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroTextViewManager.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroTextViewStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.cpp +34 -0
- package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.hpp +146 -11
- package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Umbrella.hpp +25 -0
- package/nitrogen/generated/ios/NitroInputAutolinking.mm +16 -0
- package/nitrogen/generated/ios/NitroInputAutolinking.swift +24 -0
- package/nitrogen/generated/ios/c++/HybridNitroInputViewSpecSwift.hpp +50 -0
- package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.hpp +146 -0
- package/nitrogen/generated/ios/c++/HybridNitroTextMeasureSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroTextMeasureSpecSwift.hpp +90 -0
- package/nitrogen/generated/ios/c++/HybridNitroTextViewSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroTextViewSpecSwift.hpp +233 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroInputViewComponent.mm +36 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroNumberViewComponent.mm +120 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroTextViewComponent.mm +264 -0
- package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec.swift +6 -0
- package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec_cxx.swift +78 -0
- package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec.swift +20 -0
- package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec_cxx.swift +493 -0
- package/nitrogen/generated/ios/swift/HybridNitroTextMeasureSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridNitroTextMeasureSpec_cxx.swift +150 -0
- package/nitrogen/generated/ios/swift/HybridNitroTextViewSpec.swift +75 -0
- package/nitrogen/generated/ios/swift/HybridNitroTextViewSpec_cxx.swift +608 -0
- package/nitrogen/generated/ios/swift/NitroInputCharacterMapping.swift +34 -0
- package/nitrogen/generated/ios/swift/NitroInputMaskAffinity.swift +48 -0
- package/nitrogen/generated/ios/swift/NitroInputTextCase.swift +44 -0
- package/nitrogen/generated/ios/swift/NitroNumberShimmerDirection.swift +44 -0
- package/nitrogen/generated/ios/swift/NitroNumberSignDisplay.swift +52 -0
- package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.cpp +12 -0
- package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.hpp +21 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.cpp +40 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.hpp +46 -0
- package/nitrogen/generated/shared/c++/HybridNitroTextMeasureSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridNitroTextMeasureSpec.hpp +63 -0
- package/nitrogen/generated/shared/c++/HybridNitroTextViewSpec.cpp +62 -0
- package/nitrogen/generated/shared/c++/HybridNitroTextViewSpec.hpp +115 -0
- package/nitrogen/generated/shared/c++/NitroInputCharacterMapping.hpp +87 -0
- package/nitrogen/generated/shared/c++/NitroInputMaskAffinity.hpp +84 -0
- package/nitrogen/generated/shared/c++/NitroInputTextCase.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroNumberShimmerDirection.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroNumberSignDisplay.hpp +88 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.cpp +12 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.hpp +21 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.cpp +40 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.hpp +62 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroTextViewComponent.cpp +74 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroTextViewComponent.hpp +149 -0
- package/nitrogen/generated/shared/json/NitroInputViewConfig.json +6 -0
- package/nitrogen/generated/shared/json/NitroNumberViewConfig.json +20 -0
- package/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
- package/package.json +2 -2
- package/src/NitroInput.tsx +73 -0
- package/src/NitroNumber.tsx +183 -9
- package/src/NitroText.tsx +166 -0
- package/src/NitroTime.tsx +68 -0
- package/src/formatProps.ts +108 -18
- package/src/index.ts +8 -0
- package/src/specs/NitroInput.nitro.ts +46 -0
- package/src/specs/NitroNumber.nitro.ts +69 -0
- package/src/specs/NitroText.nitro.ts +65 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ColorValue, type TextStyle, type ViewProps } from 'react-native';
|
|
3
|
+
import type { NitroTextMethods, NitroTextProps as NativeNitroTextProps } from './specs/NitroText.nitro';
|
|
4
|
+
import type { NitroInputEasing, NitroInputEffect } from './specs/NitroInput.nitro';
|
|
5
|
+
import type { NitroNumberShimmerDirection, NitroNumberTextAlign } from './specs/NitroNumber.nitro';
|
|
6
|
+
/** The raw Nitro host component behind {@link NitroText}. */
|
|
7
|
+
export declare const NativeNitroTextView: import("react-native-nitro-modules").ReactNativeView<NativeNitroTextProps, NitroTextMethods>;
|
|
8
|
+
/** What a {@link NitroText} takes: the text, its typography, the morph's timing and the loading shimmer. */
|
|
9
|
+
export interface NitroTextProps extends Omit<ViewProps, 'children'> {
|
|
10
|
+
/** The text: a string or a number. A change morphs to it. */
|
|
11
|
+
children: string | number;
|
|
12
|
+
/** Default: `17`. */
|
|
13
|
+
fontSize?: number;
|
|
14
|
+
/** Like `Text`'s. Default: `'normal'`. */
|
|
15
|
+
fontWeight?: TextStyle['fontWeight'];
|
|
16
|
+
/** Defaults to the system font. */
|
|
17
|
+
fontFamily?: string;
|
|
18
|
+
/** Defaults to the platform's label colour. */
|
|
19
|
+
color?: ColorValue;
|
|
20
|
+
/** Points after every character. Default: `0`. */
|
|
21
|
+
letterSpacing?: number;
|
|
22
|
+
/** Where the line sits in a wider view. Default: `'auto'`, the start edge. */
|
|
23
|
+
textAlign?: NitroNumberTextAlign;
|
|
24
|
+
/** Scale with the system text size, like `Text`. Default: `false`. */
|
|
25
|
+
allowFontScaling?: boolean;
|
|
26
|
+
/** Cap for `allowFontScaling`; `0` is none. Default: `0`. */
|
|
27
|
+
maxFontSizeMultiplier?: number;
|
|
28
|
+
/** Of a morph, in ms; `0` switches at once. Default: `400`. */
|
|
29
|
+
duration?: number;
|
|
30
|
+
/** Default: `'expo'`. */
|
|
31
|
+
easing?: NitroInputEasing;
|
|
32
|
+
/** Overshoot of the `'spring'` easing. Default: `0.15`. */
|
|
33
|
+
bounce?: number;
|
|
34
|
+
/** How characters enter and leave: `'auto'` slides digits and fades letters. Default: `'auto'`. */
|
|
35
|
+
effect?: NitroInputEffect;
|
|
36
|
+
/** Snap instead of morphing while Reduce Motion is on. Default: `true`. */
|
|
37
|
+
respectReduceMotion?: boolean;
|
|
38
|
+
/** A loading glint through the text, as `NitroNumber`'s `loading`. Default: `false`. */
|
|
39
|
+
loading?: boolean;
|
|
40
|
+
shimmerColor?: ColorValue;
|
|
41
|
+
/** ms per sweep. Default: `950`. */
|
|
42
|
+
shimmerDuration?: number;
|
|
43
|
+
/** Degrees; 0 upright. Default: `31`. */
|
|
44
|
+
shimmerAngle?: number;
|
|
45
|
+
/** A fraction of the text's width. Default: `1`. */
|
|
46
|
+
shimmerWidth?: number;
|
|
47
|
+
/** The glyphs' colour outside the band: a skeleton. Default: `color`. */
|
|
48
|
+
shimmerBaseColor?: ColorValue;
|
|
49
|
+
/** Default: `'auto'`, the layout direction. */
|
|
50
|
+
shimmerDirection?: NitroNumberShimmerDirection;
|
|
51
|
+
/** ms of pause after each sweep. Default: `0`. */
|
|
52
|
+
shimmerDelay?: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A single line of text that morphs to the next, natively, as Torph does on
|
|
56
|
+
* the web: the characters the two share glide to their new places, digits
|
|
57
|
+
* matched by place ("$1,204" → "$1,318" rolls the hundreds and tens), and the
|
|
58
|
+
* rest fade out and in ("Sign in" → "Signing in…"). At rest it is one line
|
|
59
|
+
* drawn in one pass, like a label: no text field, no layer per character.
|
|
60
|
+
* It sizes itself to its text in the render that mounts it (a native
|
|
61
|
+
* measurement, synchronously); a `width` in `style` overrides it.
|
|
62
|
+
*
|
|
63
|
+
* Only the props that were set go to the native view, as
|
|
64
|
+
* react-native-plain-text does: every prop that crosses is converted and
|
|
65
|
+
* stored per view in the commit, and the native side holds the defaults.
|
|
66
|
+
*/
|
|
67
|
+
export declare function NitroText({ children, fontSize, fontWeight, fontFamily, color, letterSpacing, textAlign, allowFontScaling, maxFontSizeMultiplier, duration, easing, bounce, effect, respectReduceMotion, loading, shimmerColor, shimmerDuration, shimmerAngle, shimmerWidth, shimmerBaseColor, shimmerDirection, shimmerDelay, style, ...viewProps }: NitroTextProps): React.JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type NitroNumberHandle, type NitroNumberProps } from './NitroNumber';
|
|
3
|
+
/** How a {@link NitroTime} lays the time out. */
|
|
4
|
+
export type NitroTimeFormat = 'm:ss' | 'mm:ss' | 'h:mm:ss' | 'hh:mm:ss';
|
|
5
|
+
export interface NitroTimeProps extends Omit<NitroNumberProps, 'value' | 'digits' | 'groupingSizes' | 'groupingSeparator' | 'minimumIntegerDigits' | 'fractionDigits' | 'decimalSeparator' | 'format'> {
|
|
6
|
+
/** The time in whole seconds (a timer's elapsed time, a countdown's remaining one). Negatives show as 0. */
|
|
7
|
+
seconds: number;
|
|
8
|
+
/** Default: `'m:ss'`. Without hours the minutes run past 59 (125:00). */
|
|
9
|
+
timeFormat?: NitroTimeFormat;
|
|
10
|
+
/** Between the fields. Default: `':'`. */
|
|
11
|
+
separator?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A clock, a timer or a countdown: `NitroNumber` with the time as its figure
|
|
15
|
+
* (12:34:56 is 123456), grouped in pairs, and the tens of seconds and minutes
|
|
16
|
+
* wrapping after 5, so 0:59 → 1:00 turns them one step, as a clock's wheels
|
|
17
|
+
* do, instead of rolling back through 4, 3, 2, 1.
|
|
18
|
+
*/
|
|
19
|
+
export declare const NitroTime: React.ForwardRefExoticComponent<NitroTimeProps & React.RefAttributes<NitroNumberHandle>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NumberFormat } from './NumberFormat';
|
|
2
2
|
/** What `NitroNumber` and `NitroInput` take from a `NumberFormat` through their `format` prop. */
|
|
3
3
|
export interface FormatProps {
|
|
4
4
|
prefix: string;
|
|
@@ -10,12 +10,38 @@ export interface FormatProps {
|
|
|
10
10
|
minimumIntegerDigits: number;
|
|
11
11
|
/** Whether a negative amount's sign comes before the prefix ("-$5") or after it ("$-5"). */
|
|
12
12
|
signPlacement: 'beforeAffix' | 'afterAffix';
|
|
13
|
+
/** Which values carry a sign, as the format's `signDisplay`. */
|
|
14
|
+
signDisplay: 'auto' | 'always' | 'exceptZero' | 'negative' | 'never';
|
|
15
|
+
/** The minus sign the locale writes ("-", or "−" in Swedish and Finnish). */
|
|
16
|
+
minusSign: string;
|
|
17
|
+
/** The plus sign the locale writes. */
|
|
18
|
+
plusSign: string;
|
|
19
|
+
/** The glyphs for 0…9 in the format's numbering system; empty for Latin digits. */
|
|
20
|
+
digitGlyphs: string[];
|
|
21
|
+
/** The first digit group and every later one, from the decimal point ([3, 2]: 12,34,567). */
|
|
22
|
+
groupingSizes: number[];
|
|
23
|
+
/** Compact notation: the prefix, suffix and digits follow the value (`compactParts`). */
|
|
24
|
+
compact: boolean;
|
|
13
25
|
}
|
|
14
26
|
/**
|
|
15
27
|
* The prefix, suffix, separators and digit counts of `format`, read off its
|
|
16
28
|
* parts once and cached per formatter. The components keep their own model
|
|
17
|
-
* (a sign, a prefix, digits
|
|
18
|
-
*
|
|
19
|
-
*
|
|
29
|
+
* (a sign, a prefix, digits in groups, a suffix), so a format outside it
|
|
30
|
+
* (accounting parentheses, a unit between the digits) is followed as far as
|
|
31
|
+
* that model goes.
|
|
20
32
|
*/
|
|
21
33
|
export declare function formatProps(format: NumberFormat): FormatProps;
|
|
34
|
+
/** What a compact format shows for one value: the figure to roll and the text around it. */
|
|
35
|
+
export interface CompactParts {
|
|
36
|
+
/** The figure as the digits show it: 1.2 for "1.2K". */
|
|
37
|
+
value: number;
|
|
38
|
+
fractionDigits: number;
|
|
39
|
+
prefix: string;
|
|
40
|
+
suffix: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Compact notation's parts for `value`: "1.2K" is the figure 1.2 with the
|
|
44
|
+
* suffix "K", so the digits roll and the suffix swaps as the value crosses
|
|
45
|
+
* a thousand, a million…
|
|
46
|
+
*/
|
|
47
|
+
export declare function compactParts(format: NumberFormat, value: number): CompactParts;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export { NitroInput, NativeNitroInputView, type NitroInputProps, type NitroInputHandle, type NitroInputRef, type NitroInputTextEvent, type NitroInputFocusEvent, type NitroInputSelectionEvent, type NitroInputKeyPressEvent, type NitroInputTransition, type InputMode, type EnterKeyHint, } from './NitroInput';
|
|
2
2
|
export { isWorklet, type NitroInputSelection, type NitroInputTransform, type WorkletTextEvent, type WorkletFocusEvent, type WorkletSelectionEvent, type WorkletKeyPressEvent, } from './worklets';
|
|
3
3
|
export { useNitroInputState, type NitroInputState, type SharedValueLike, } from './useNitroInputState';
|
|
4
|
-
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';
|
|
4
|
+
export type { NitroInputLabelBehavior, NitroInputMode, NitroInputNotation, NitroInputMaskAffinity, NitroInputTextCase, NitroInputCharacterMapping, NitroInputVariant, NitroInputEasing, NitroInputEffect, NitroInputTextAlign, NitroInputTextAlignVertical, NitroInputAffixAlign, NitroInputSignPlacement, NitroInputKeyboardType, NitroInputReturnKeyType, NitroInputAutoCapitalize, NitroInputSubmitBehavior, NitroInputKeyboardAppearance, NitroInputMethods, NitroInputProps as NativeNitroInputProps, NitroInputView, } from './specs/NitroInput.nitro';
|
|
5
5
|
export type { NitroInputWorklets } from './specs/NitroInputWorklets.nitro';
|
|
6
6
|
export { NitroNumber, NativeNitroNumberView, type NitroNumberProps, type NitroNumberHandle, type NitroNumberRef, } from './NitroNumber';
|
|
7
|
-
export
|
|
7
|
+
export { NitroTime, type NitroTimeProps, type NitroTimeFormat } from './NitroTime';
|
|
8
|
+
export { NitroText, NativeNitroTextView, type NitroTextProps } from './NitroText';
|
|
9
|
+
export type { NitroTextMeasure, NitroTextView } from './specs/NitroText.nitro';
|
|
10
|
+
export type { NitroNumberAffixAlign, NitroNumberDirection, NitroNumberTransition, NitroNumberEasing, NitroNumberRevealStyle, NitroNumberShimmerDirection, NitroNumberSignDisplay, NitroNumberTextAlign, NitroNumberMethods, NitroNumberProps as NativeNitroNumberProps, NitroNumberView, } from './specs/NitroNumber.nitro';
|
|
8
11
|
export { NumberFormat, type NumberFormatConstructor, type NumberFormatRangePart } from './NumberFormat';
|
|
9
12
|
export type { NumberFormatOptions, NumberFormatPart, ResolvedNumberFormatOptions, NumberFormatStyle, NumberFormatCurrencyDisplay, NumberFormatCurrencySign, NumberFormatUnitDisplay, NumberFormatNotation, NumberFormatCompactDisplay, NumberFormatSignDisplay, NumberFormatRoundingMode, NumberFormatRoundingPriority, NumberFormatTrailingZeroDisplay, NumberFormatGrouping, } from './specs/NumberFormat.nitro';
|
|
@@ -5,6 +5,21 @@ import type { HybridView, HybridViewMethods, HybridViewProps } from 'react-nativ
|
|
|
5
5
|
* `'text'` is a plain single-line field.
|
|
6
6
|
*/
|
|
7
7
|
export type NitroInputMode = 'text' | 'number' | 'mask';
|
|
8
|
+
/**
|
|
9
|
+
* How the best of `maskAffinityFormats` is chosen for the text in the field:
|
|
10
|
+
* `'wholeString'` the format that accepts the most characters and inserts the
|
|
11
|
+
* fewest, `'prefix'` the one whose output starts most like what was typed,
|
|
12
|
+
* `'capacity'` / `'extractedValueCapacity'` the fullest format that still
|
|
13
|
+
* holds all of the text / all of its value characters.
|
|
14
|
+
*/
|
|
15
|
+
export type NitroInputMaskAffinity = 'wholeString' | 'prefix' | 'capacity' | 'extractedValueCapacity';
|
|
16
|
+
/** How letters are cased as they are typed into a mask. */
|
|
17
|
+
export type NitroInputTextCase = 'none' | 'upper' | 'lower';
|
|
18
|
+
/** One character replaced by another before masking; an empty `to` drops it. */
|
|
19
|
+
export interface NitroInputCharacterMapping {
|
|
20
|
+
from: string;
|
|
21
|
+
to: string;
|
|
22
|
+
}
|
|
8
23
|
/**
|
|
9
24
|
* A caller-defined slot character for `mask`, beyond the built-in
|
|
10
25
|
* `0 9 A a _ - …`. `characterSet` lists every character the slot accepts.
|
|
@@ -131,6 +146,34 @@ export interface NitroInputProps extends HybridViewProps {
|
|
|
131
146
|
* Default: `false`.
|
|
132
147
|
*/
|
|
133
148
|
maskAutoSkip: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* `'mask'`: more patterns the text may take, e.g. a 4-6-5 Amex card beside
|
|
151
|
+
* a 4-4-4-4 `mask`. Every edit is masked with each and the best, by
|
|
152
|
+
* `maskAffinityStrategy`, is kept; `mask` wins ties. Default: none.
|
|
153
|
+
*/
|
|
154
|
+
maskAffinityFormats: string[];
|
|
155
|
+
/** `'mask'`: how the best of `maskAffinityFormats` is chosen. Default: `'wholeString'`. */
|
|
156
|
+
maskAffinityStrategy: NitroInputMaskAffinity;
|
|
157
|
+
/** `'mask'`: uppercases or lowercases letters as they are typed or pasted. Default: `'none'`. */
|
|
158
|
+
maskTextCase: NitroInputTextCase;
|
|
159
|
+
/**
|
|
160
|
+
* `'mask'`: characters replaced before masking, e.g. a Cyrillic "С" with a
|
|
161
|
+
* Latin "C", or "," with "." for a decimal mask. Default: none.
|
|
162
|
+
*/
|
|
163
|
+
maskCharacterMap: NitroInputCharacterMapping[];
|
|
164
|
+
/**
|
|
165
|
+
* `'mask'`: the character each empty slot shows in the kept placeholder and
|
|
166
|
+
* in `onChangeMask`'s tail, e.g. `'_'`. Empty: the slot's own notation
|
|
167
|
+
* character. Default: `''`.
|
|
168
|
+
*/
|
|
169
|
+
maskSlotPlaceholder: string;
|
|
170
|
+
/**
|
|
171
|
+
* `'mask'`: keeps the rest of the placeholder visible after what has been
|
|
172
|
+
* typed, so "1234 5" shows "678 9012" greyed after it. Without a
|
|
173
|
+
* `placeholder`, the mask itself is shown, empty slots as
|
|
174
|
+
* `maskSlotPlaceholder`: `+1 (212) ___-____`. Default: `false`.
|
|
175
|
+
*/
|
|
176
|
+
keepPlaceholder: boolean;
|
|
134
177
|
/** `'number'`: inserted between every three integer digits; empty disables grouping. Default: `','`. */
|
|
135
178
|
groupingSeparator: string;
|
|
136
179
|
/** `'number'`: between the integer and fraction digits. Default: `'.'`. */
|
|
@@ -36,6 +36,16 @@ export type NitroNumberRevealStyle = 'count' | 'spin';
|
|
|
36
36
|
* boxes, `baseline` shares the digits' baseline, `center` centres the boxes.
|
|
37
37
|
*/
|
|
38
38
|
export type NitroNumberAffixAlign = 'baseline' | 'center' | 'top' | 'bottom';
|
|
39
|
+
/**
|
|
40
|
+
* Which values carry a sign, as `Intl.NumberFormat`'s `signDisplay`:
|
|
41
|
+
* `'auto'` negatives, `'always'` a plus on positives and zero too,
|
|
42
|
+
* `'exceptZero'` a plus or minus on everything but zero, `'negative'`
|
|
43
|
+
* negatives, `'never'` none. A value that rounds to zero at the shown
|
|
44
|
+
* fraction digits counts as zero, so `-0.001` shows no minus.
|
|
45
|
+
*/
|
|
46
|
+
export type NitroNumberSignDisplay = 'auto' | 'always' | 'never' | 'exceptZero' | 'negative';
|
|
47
|
+
/** Which way the loading shimmer sweeps: `'auto'` follows the layout direction. */
|
|
48
|
+
export type NitroNumberShimmerDirection = 'auto' | 'ltr' | 'rtl';
|
|
39
49
|
export interface NitroNumberProps extends HybridViewProps {
|
|
40
50
|
/**
|
|
41
51
|
* The number to display.
|
|
@@ -157,6 +167,16 @@ export interface NitroNumberProps extends HybridViewProps {
|
|
|
157
167
|
shimmerColor?: number;
|
|
158
168
|
/** Duration of one sweep in ms (linear, repeating). Default: `950`. */
|
|
159
169
|
shimmerDuration?: number;
|
|
170
|
+
/** The band's slant in degrees: 0 upright, positive leans it like "/". Default: `31`. */
|
|
171
|
+
shimmerAngle?: number;
|
|
172
|
+
/** The band's width as a fraction of the number's. Default: `1`. */
|
|
173
|
+
shimmerWidth?: number;
|
|
174
|
+
/** The glyphs' colour while loading, outside the band (processed). Not finite: `color`. */
|
|
175
|
+
shimmerBaseColor?: number;
|
|
176
|
+
/** Which way the band sweeps. Default: `'auto'`, the layout direction. */
|
|
177
|
+
shimmerDirection?: NitroNumberShimmerDirection;
|
|
178
|
+
/** A pause after each sweep, in ms. Default: `0`. */
|
|
179
|
+
shimmerDelay?: number;
|
|
160
180
|
/** Font size of the digits in points. Default: `32`. */
|
|
161
181
|
fontSize?: number;
|
|
162
182
|
/** Font size of `prefix` in points. Defaults to `fontSize`. */
|
|
@@ -181,6 +201,46 @@ export interface NitroNumberProps extends HybridViewProps {
|
|
|
181
201
|
suffixOffset?: number;
|
|
182
202
|
/** Every digit as wide as the widest (`true`, the default), or each digit at its own width. */
|
|
183
203
|
tabularNums?: boolean;
|
|
204
|
+
/** Which values carry a sign. Default: `'auto'`. */
|
|
205
|
+
signDisplay?: NitroNumberSignDisplay;
|
|
206
|
+
/** The glyph drawn for a plus sign. Default: `'+'`. */
|
|
207
|
+
plusSign?: string;
|
|
208
|
+
/** The glyph drawn for a minus sign. Default: `'-'`. */
|
|
209
|
+
minusSign?: string;
|
|
210
|
+
/**
|
|
211
|
+
* The ten glyphs drawn for 0 to 9: native digits (Arabic-Indic, Devanagari…).
|
|
212
|
+
* Empty: `'0'`…`'9'`.
|
|
213
|
+
*/
|
|
214
|
+
digitGlyphs?: string[];
|
|
215
|
+
/**
|
|
216
|
+
* Digit group sizes counted from the decimal point: the first group, then
|
|
217
|
+
* every one after it. Empty: `[3]`. `[3, 2]` is Indian grouping
|
|
218
|
+
* (12,34,567), `[2]` a clock's (12:34:56 with `groupingSeparator=":"`).
|
|
219
|
+
*/
|
|
220
|
+
groupingSizes?: number[];
|
|
221
|
+
/**
|
|
222
|
+
* Per integer position (0 the ones, 1 the tens…), the highest digit its
|
|
223
|
+
* wheel shows before it wraps to 0; missing or not 0–8 means 9. `[9, 5]`
|
|
224
|
+
* makes the tens wrap after 5, as on a clock: 59 → 00 turns them one step.
|
|
225
|
+
*/
|
|
226
|
+
digitMax?: number[];
|
|
227
|
+
/**
|
|
228
|
+
* Rolls turn the wheels below the highest one that changes a full turn
|
|
229
|
+
* too, so the figure seems to pass through every value between. Default: `false`.
|
|
230
|
+
*/
|
|
231
|
+
continuous?: boolean;
|
|
232
|
+
/** The prefix's color (processed). Not finite: `color`. */
|
|
233
|
+
prefixColor?: number;
|
|
234
|
+
/** The suffix's color (processed). Not finite: `color`. */
|
|
235
|
+
suffixColor?: number;
|
|
236
|
+
/** The fraction digits' and decimal separator's color (processed). Not finite: `color`. */
|
|
237
|
+
fractionColor?: number;
|
|
238
|
+
/** The fraction digits' and decimal separator's size. Not finite: `fontSize`. */
|
|
239
|
+
fractionFontSize?: number;
|
|
240
|
+
/** How smaller fraction digits line up with the integer ones. Default: `'baseline'`. */
|
|
241
|
+
fractionAlign?: NitroNumberAffixAlign;
|
|
242
|
+
/** Snap instead of animating while the system's Reduce Motion is on. Default: `true`. */
|
|
243
|
+
respectReduceMotion?: boolean;
|
|
184
244
|
/**
|
|
185
245
|
* When the view is narrower than the number (e.g. it has a fixed `width` or
|
|
186
246
|
* `maxWidth`), scale the whole number down so it fits. Default: `false`.
|
|
@@ -230,6 +290,13 @@ export interface NitroNumberProps extends HybridViewProps {
|
|
|
230
290
|
* banner, fire the confetti and play the sting.
|
|
231
291
|
*/
|
|
232
292
|
onRevealMilestone?: (index: number, value: number) => void;
|
|
293
|
+
/** Called when the figure starts moving from rest (a change, or a reveal). */
|
|
294
|
+
onAnimationStart?: () => void;
|
|
295
|
+
/**
|
|
296
|
+
* Called when the figure comes to rest again, with the value it shows:
|
|
297
|
+
* once, however many changes arrived while it was moving.
|
|
298
|
+
*/
|
|
299
|
+
onAnimationEnd?: (value: number) => void;
|
|
233
300
|
}
|
|
234
301
|
export interface NitroNumberMethods extends HybridViewMethods {
|
|
235
302
|
/**
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { HybridObject, HybridView, HybridViewMethods, HybridViewProps } from 'react-native-nitro-modules';
|
|
2
|
+
import type { NitroNumberShimmerDirection, NitroNumberTextAlign } from './NitroNumber.nitro';
|
|
3
|
+
import type { NitroInputEasing, NitroInputEffect } from './NitroInput.nitro';
|
|
4
|
+
/**
|
|
5
|
+
* A single line of text that morphs to the next: the reflow engine's
|
|
6
|
+
* characters drawn in one pass, no text field. `NitroText` measures it (see
|
|
7
|
+
* `NitroTextMeasure`) and gives it its size, so a label lays out in the same
|
|
8
|
+
* commit that mounts it.
|
|
9
|
+
*
|
|
10
|
+
* Everything but the text is optional and the wrapper sends only what was
|
|
11
|
+
* set: each prop that crosses costs a conversion and an allocation per view
|
|
12
|
+
* in the commit, and a label usually sets two or three. The native side holds
|
|
13
|
+
* the defaults, and forgets what the last element set when it is recycled.
|
|
14
|
+
*/
|
|
15
|
+
export interface NitroTextProps extends HybridViewProps {
|
|
16
|
+
text: string;
|
|
17
|
+
/** In points, already scaled for the system text size when the wrapper was asked to. Default 17. */
|
|
18
|
+
fontSize?: number;
|
|
19
|
+
/** Numeric weight, 100–900. Default 400. */
|
|
20
|
+
fontWeight?: number;
|
|
21
|
+
/** Default: the system font. */
|
|
22
|
+
fontFamily?: string;
|
|
23
|
+
/** Processed ARGB. Default: the platform label colour. */
|
|
24
|
+
color?: number;
|
|
25
|
+
/** Points after every character. */
|
|
26
|
+
letterSpacing?: number;
|
|
27
|
+
textAlign?: NitroNumberTextAlign;
|
|
28
|
+
rightToLeft?: boolean;
|
|
29
|
+
/** Of a morph, in ms. Default 400. */
|
|
30
|
+
duration?: number;
|
|
31
|
+
easing?: NitroInputEasing;
|
|
32
|
+
bounce?: number;
|
|
33
|
+
effect?: NitroInputEffect;
|
|
34
|
+
respectReduceMotion?: boolean;
|
|
35
|
+
loading?: boolean;
|
|
36
|
+
shimmerColor?: number;
|
|
37
|
+
shimmerDuration?: number;
|
|
38
|
+
shimmerAngle?: number;
|
|
39
|
+
shimmerWidth?: number;
|
|
40
|
+
shimmerBaseColor?: number;
|
|
41
|
+
shimmerDirection?: NitroNumberShimmerDirection;
|
|
42
|
+
shimmerDelay?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface NitroTextMethods extends HybridViewMethods {
|
|
45
|
+
}
|
|
46
|
+
export type NitroTextView = HybridView<NitroTextProps, NitroTextMethods>;
|
|
47
|
+
/**
|
|
48
|
+
* Measures a line the way `NitroTextView` lays it out (the sum of each
|
|
49
|
+
* character's advance plus the letter spacing), synchronously, so the
|
|
50
|
+
* component knows its size while it renders.
|
|
51
|
+
*/
|
|
52
|
+
export interface NitroTextMeasure extends HybridObject<{
|
|
53
|
+
ios: 'swift';
|
|
54
|
+
android: 'kotlin';
|
|
55
|
+
}> {
|
|
56
|
+
/** The line's width in points. */
|
|
57
|
+
measure(text: string, fontSize: number, fontWeight: number, fontFamily: string, letterSpacing: number): number;
|
|
58
|
+
/** The line box's height in points. */
|
|
59
|
+
lineHeight(fontSize: number, fontWeight: number, fontFamily: string): number;
|
|
60
|
+
}
|
package/nitro.json
CHANGED
|
@@ -54,6 +54,26 @@
|
|
|
54
54
|
"language": "kotlin",
|
|
55
55
|
"implementationClassName": "HybridNitroNumberFormatPlatform"
|
|
56
56
|
}
|
|
57
|
+
},
|
|
58
|
+
"NitroTextView": {
|
|
59
|
+
"ios": {
|
|
60
|
+
"language": "swift",
|
|
61
|
+
"implementationClassName": "HybridNitroTextView"
|
|
62
|
+
},
|
|
63
|
+
"android": {
|
|
64
|
+
"language": "kotlin",
|
|
65
|
+
"implementationClassName": "HybridNitroTextView"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"NitroTextMeasure": {
|
|
69
|
+
"ios": {
|
|
70
|
+
"language": "swift",
|
|
71
|
+
"implementationClassName": "HybridNitroTextMeasure"
|
|
72
|
+
},
|
|
73
|
+
"android": {
|
|
74
|
+
"language": "kotlin",
|
|
75
|
+
"implementationClassName": "HybridNitroTextMeasure"
|
|
76
|
+
}
|
|
57
77
|
}
|
|
58
78
|
},
|
|
59
79
|
"ignorePaths": [
|
|
@@ -38,6 +38,9 @@ target_sources(
|
|
|
38
38
|
../nitrogen/generated/shared/c++/HybridNitroInputWorkletsSpec.cpp
|
|
39
39
|
../nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.cpp
|
|
40
40
|
../nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.cpp
|
|
41
|
+
../nitrogen/generated/shared/c++/HybridNitroTextMeasureSpec.cpp
|
|
42
|
+
../nitrogen/generated/shared/c++/HybridNitroTextViewSpec.cpp
|
|
43
|
+
../nitrogen/generated/shared/c++/views/HybridNitroTextViewComponent.cpp
|
|
41
44
|
../nitrogen/generated/shared/c++/HybridNitroNumberFormatSpec.cpp
|
|
42
45
|
../nitrogen/generated/shared/c++/HybridNitroNumberFormatFactorySpec.cpp
|
|
43
46
|
../nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.cpp
|
|
@@ -47,6 +50,9 @@ target_sources(
|
|
|
47
50
|
../nitrogen/generated/android/c++/views/JHybridNitroInputViewStateUpdater.cpp
|
|
48
51
|
../nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.cpp
|
|
49
52
|
../nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.cpp
|
|
53
|
+
../nitrogen/generated/android/c++/JHybridNitroTextMeasureSpec.cpp
|
|
54
|
+
../nitrogen/generated/android/c++/JHybridNitroTextViewSpec.cpp
|
|
55
|
+
../nitrogen/generated/android/c++/views/JHybridNitroTextViewStateUpdater.cpp
|
|
50
56
|
../nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.cpp
|
|
51
57
|
../nitrogen/generated/android/c++/JHybridNitroNumberFormatPlatformSpec.cpp
|
|
52
58
|
)
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
#include "JHybridNitroNumberViewSpec.hpp"
|
|
27
27
|
#include "JFunc_void.hpp"
|
|
28
28
|
#include "views/JHybridNitroNumberViewStateUpdater.hpp"
|
|
29
|
+
#include "JHybridNitroTextMeasureSpec.hpp"
|
|
30
|
+
#include "JHybridNitroTextViewSpec.hpp"
|
|
31
|
+
#include "views/JHybridNitroTextViewStateUpdater.hpp"
|
|
29
32
|
#include "JHybridNitroPlatformNumberFormatterSpec.hpp"
|
|
30
33
|
#include "JHybridNitroNumberFormatPlatformSpec.hpp"
|
|
31
34
|
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
@@ -64,6 +67,22 @@ struct JHybridNitroNumberFormatPlatformSpecImpl: public jni::JavaClass<JHybridNi
|
|
|
64
67
|
return javaPart->getJHybridNitroNumberFormatPlatformSpec();
|
|
65
68
|
}
|
|
66
69
|
};
|
|
70
|
+
struct JHybridNitroTextViewSpecImpl: public jni::JavaClass<JHybridNitroTextViewSpecImpl, JHybridNitroTextViewSpec::JavaPart> {
|
|
71
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroinput/HybridNitroTextView;";
|
|
72
|
+
static std::shared_ptr<JHybridNitroTextViewSpec> create() {
|
|
73
|
+
static const auto constructorFn = javaClassStatic()->getConstructor<JHybridNitroTextViewSpecImpl::javaobject()>();
|
|
74
|
+
jni::local_ref<JHybridNitroTextViewSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
75
|
+
return javaPart->getJHybridNitroTextViewSpec();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
struct JHybridNitroTextMeasureSpecImpl: public jni::JavaClass<JHybridNitroTextMeasureSpecImpl, JHybridNitroTextMeasureSpec::JavaPart> {
|
|
79
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroinput/HybridNitroTextMeasure;";
|
|
80
|
+
static std::shared_ptr<JHybridNitroTextMeasureSpec> create() {
|
|
81
|
+
static const auto constructorFn = javaClassStatic()->getConstructor<JHybridNitroTextMeasureSpecImpl::javaobject()>();
|
|
82
|
+
jni::local_ref<JHybridNitroTextMeasureSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
83
|
+
return javaPart->getJHybridNitroTextMeasureSpec();
|
|
84
|
+
}
|
|
85
|
+
};
|
|
67
86
|
|
|
68
87
|
void registerAllNatives() {
|
|
69
88
|
using namespace margelo::nitro;
|
|
@@ -81,6 +100,9 @@ void registerAllNatives() {
|
|
|
81
100
|
margelo::nitro::nitroinput::JHybridNitroNumberViewSpec::CxxPart::registerNatives();
|
|
82
101
|
margelo::nitro::nitroinput::JFunc_void_cxx::registerNatives();
|
|
83
102
|
margelo::nitro::nitroinput::views::JHybridNitroNumberViewStateUpdater::registerNatives();
|
|
103
|
+
margelo::nitro::nitroinput::JHybridNitroTextMeasureSpec::CxxPart::registerNatives();
|
|
104
|
+
margelo::nitro::nitroinput::JHybridNitroTextViewSpec::CxxPart::registerNatives();
|
|
105
|
+
margelo::nitro::nitroinput::views::JHybridNitroTextViewStateUpdater::registerNatives();
|
|
84
106
|
margelo::nitro::nitroinput::JHybridNitroPlatformNumberFormatterSpec::CxxPart::registerNatives();
|
|
85
107
|
margelo::nitro::nitroinput::JHybridNitroNumberFormatPlatformSpec::CxxPart::registerNatives();
|
|
86
108
|
|
|
@@ -121,6 +143,18 @@ void registerAllNatives() {
|
|
|
121
143
|
return JHybridNitroNumberFormatPlatformSpecImpl::create();
|
|
122
144
|
}
|
|
123
145
|
);
|
|
146
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
147
|
+
"NitroTextView",
|
|
148
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
149
|
+
return JHybridNitroTextViewSpecImpl::create();
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
153
|
+
"NitroTextMeasure",
|
|
154
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
155
|
+
return JHybridNitroTextMeasureSpecImpl::create();
|
|
156
|
+
}
|
|
157
|
+
);
|
|
124
158
|
}
|
|
125
159
|
|
|
126
160
|
} // namespace margelo::nitro::nitroinput
|
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
namespace margelo::nitro::nitroinput { enum class NitroInputMode; }
|
|
12
12
|
// Forward declaration of `NitroInputNotation` to properly resolve imports.
|
|
13
13
|
namespace margelo::nitro::nitroinput { struct NitroInputNotation; }
|
|
14
|
+
// Forward declaration of `NitroInputMaskAffinity` to properly resolve imports.
|
|
15
|
+
namespace margelo::nitro::nitroinput { enum class NitroInputMaskAffinity; }
|
|
16
|
+
// Forward declaration of `NitroInputTextCase` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::nitroinput { enum class NitroInputTextCase; }
|
|
18
|
+
// Forward declaration of `NitroInputCharacterMapping` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::nitroinput { struct NitroInputCharacterMapping; }
|
|
14
20
|
// Forward declaration of `NitroInputVariant` to properly resolve imports.
|
|
15
21
|
namespace margelo::nitro::nitroinput { enum class NitroInputVariant; }
|
|
16
22
|
// Forward declaration of `NitroInputLabelBehavior` to properly resolve imports.
|
|
@@ -44,6 +50,12 @@ namespace margelo::nitro::nitroinput { enum class NitroInputKeyboardAppearance;
|
|
|
44
50
|
#include "NitroInputNotation.hpp"
|
|
45
51
|
#include <vector>
|
|
46
52
|
#include "JNitroInputNotation.hpp"
|
|
53
|
+
#include "NitroInputMaskAffinity.hpp"
|
|
54
|
+
#include "JNitroInputMaskAffinity.hpp"
|
|
55
|
+
#include "NitroInputTextCase.hpp"
|
|
56
|
+
#include "JNitroInputTextCase.hpp"
|
|
57
|
+
#include "NitroInputCharacterMapping.hpp"
|
|
58
|
+
#include "JNitroInputCharacterMapping.hpp"
|
|
47
59
|
#include "NitroInputVariant.hpp"
|
|
48
60
|
#include "JNitroInputVariant.hpp"
|
|
49
61
|
#include "NitroInputLabelBehavior.hpp"
|
|
@@ -218,6 +230,96 @@ namespace margelo::nitro::nitroinput {
|
|
|
218
230
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jboolean /* maskAutoSkip */)>("setMaskAutoSkip");
|
|
219
231
|
method(_javaPart, maskAutoSkip);
|
|
220
232
|
}
|
|
233
|
+
std::vector<std::string> JHybridNitroInputViewSpec::getMaskAffinityFormats() {
|
|
234
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<jni::JString>>()>("getMaskAffinityFormats");
|
|
235
|
+
auto __result = method(_javaPart);
|
|
236
|
+
return [&](auto&& __input) {
|
|
237
|
+
size_t __size = __input->size();
|
|
238
|
+
std::vector<std::string> __vector;
|
|
239
|
+
__vector.reserve(__size);
|
|
240
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
241
|
+
auto __element = __input->getElement(__i);
|
|
242
|
+
__vector.push_back(__element->toStdString());
|
|
243
|
+
}
|
|
244
|
+
return __vector;
|
|
245
|
+
}(__result);
|
|
246
|
+
}
|
|
247
|
+
void JHybridNitroInputViewSpec::setMaskAffinityFormats(const std::vector<std::string>& maskAffinityFormats) {
|
|
248
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<jni::JString>> /* maskAffinityFormats */)>("setMaskAffinityFormats");
|
|
249
|
+
method(_javaPart, [&](auto&& __input) {
|
|
250
|
+
size_t __size = __input.size();
|
|
251
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
|
|
252
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
253
|
+
const auto& __element = __input[__i];
|
|
254
|
+
auto __elementJni = jni::make_jstring(__element);
|
|
255
|
+
__array->setElement(__i, *__elementJni);
|
|
256
|
+
}
|
|
257
|
+
return __array;
|
|
258
|
+
}(maskAffinityFormats));
|
|
259
|
+
}
|
|
260
|
+
NitroInputMaskAffinity JHybridNitroInputViewSpec::getMaskAffinityStrategy() {
|
|
261
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JNitroInputMaskAffinity>()>("getMaskAffinityStrategy");
|
|
262
|
+
auto __result = method(_javaPart);
|
|
263
|
+
return __result->toCpp();
|
|
264
|
+
}
|
|
265
|
+
void JHybridNitroInputViewSpec::setMaskAffinityStrategy(NitroInputMaskAffinity maskAffinityStrategy) {
|
|
266
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JNitroInputMaskAffinity> /* maskAffinityStrategy */)>("setMaskAffinityStrategy");
|
|
267
|
+
method(_javaPart, JNitroInputMaskAffinity::fromCpp(maskAffinityStrategy));
|
|
268
|
+
}
|
|
269
|
+
NitroInputTextCase JHybridNitroInputViewSpec::getMaskTextCase() {
|
|
270
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JNitroInputTextCase>()>("getMaskTextCase");
|
|
271
|
+
auto __result = method(_javaPart);
|
|
272
|
+
return __result->toCpp();
|
|
273
|
+
}
|
|
274
|
+
void JHybridNitroInputViewSpec::setMaskTextCase(NitroInputTextCase maskTextCase) {
|
|
275
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JNitroInputTextCase> /* maskTextCase */)>("setMaskTextCase");
|
|
276
|
+
method(_javaPart, JNitroInputTextCase::fromCpp(maskTextCase));
|
|
277
|
+
}
|
|
278
|
+
std::vector<NitroInputCharacterMapping> JHybridNitroInputViewSpec::getMaskCharacterMap() {
|
|
279
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<JNitroInputCharacterMapping>>()>("getMaskCharacterMap");
|
|
280
|
+
auto __result = method(_javaPart);
|
|
281
|
+
return [&](auto&& __input) {
|
|
282
|
+
size_t __size = __input->size();
|
|
283
|
+
std::vector<NitroInputCharacterMapping> __vector;
|
|
284
|
+
__vector.reserve(__size);
|
|
285
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
286
|
+
auto __element = __input->getElement(__i);
|
|
287
|
+
__vector.push_back(__element->toCpp());
|
|
288
|
+
}
|
|
289
|
+
return __vector;
|
|
290
|
+
}(__result);
|
|
291
|
+
}
|
|
292
|
+
void JHybridNitroInputViewSpec::setMaskCharacterMap(const std::vector<NitroInputCharacterMapping>& maskCharacterMap) {
|
|
293
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<JNitroInputCharacterMapping>> /* maskCharacterMap */)>("setMaskCharacterMap");
|
|
294
|
+
method(_javaPart, [&](auto&& __input) {
|
|
295
|
+
size_t __size = __input.size();
|
|
296
|
+
jni::local_ref<jni::JArrayClass<JNitroInputCharacterMapping>> __array = jni::JArrayClass<JNitroInputCharacterMapping>::newArray(__size);
|
|
297
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
298
|
+
const auto& __element = __input[__i];
|
|
299
|
+
auto __elementJni = JNitroInputCharacterMapping::fromCpp(__element);
|
|
300
|
+
__array->setElement(__i, *__elementJni);
|
|
301
|
+
}
|
|
302
|
+
return __array;
|
|
303
|
+
}(maskCharacterMap));
|
|
304
|
+
}
|
|
305
|
+
std::string JHybridNitroInputViewSpec::getMaskSlotPlaceholder() {
|
|
306
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getMaskSlotPlaceholder");
|
|
307
|
+
auto __result = method(_javaPart);
|
|
308
|
+
return __result->toStdString();
|
|
309
|
+
}
|
|
310
|
+
void JHybridNitroInputViewSpec::setMaskSlotPlaceholder(const std::string& maskSlotPlaceholder) {
|
|
311
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* maskSlotPlaceholder */)>("setMaskSlotPlaceholder");
|
|
312
|
+
method(_javaPart, jni::make_jstring(maskSlotPlaceholder));
|
|
313
|
+
}
|
|
314
|
+
bool JHybridNitroInputViewSpec::getKeepPlaceholder() {
|
|
315
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("getKeepPlaceholder");
|
|
316
|
+
auto __result = method(_javaPart);
|
|
317
|
+
return static_cast<bool>(__result);
|
|
318
|
+
}
|
|
319
|
+
void JHybridNitroInputViewSpec::setKeepPlaceholder(bool keepPlaceholder) {
|
|
320
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jboolean /* keepPlaceholder */)>("setKeepPlaceholder");
|
|
321
|
+
method(_javaPart, keepPlaceholder);
|
|
322
|
+
}
|
|
221
323
|
std::string JHybridNitroInputViewSpec::getGroupingSeparator() {
|
|
222
324
|
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getGroupingSeparator");
|
|
223
325
|
auto __result = method(_javaPart);
|
|
@@ -70,6 +70,18 @@ namespace margelo::nitro::nitroinput {
|
|
|
70
70
|
void setMaskAutocomplete(bool maskAutocomplete) override;
|
|
71
71
|
bool getMaskAutoSkip() override;
|
|
72
72
|
void setMaskAutoSkip(bool maskAutoSkip) override;
|
|
73
|
+
std::vector<std::string> getMaskAffinityFormats() override;
|
|
74
|
+
void setMaskAffinityFormats(const std::vector<std::string>& maskAffinityFormats) override;
|
|
75
|
+
NitroInputMaskAffinity getMaskAffinityStrategy() override;
|
|
76
|
+
void setMaskAffinityStrategy(NitroInputMaskAffinity maskAffinityStrategy) override;
|
|
77
|
+
NitroInputTextCase getMaskTextCase() override;
|
|
78
|
+
void setMaskTextCase(NitroInputTextCase maskTextCase) override;
|
|
79
|
+
std::vector<NitroInputCharacterMapping> getMaskCharacterMap() override;
|
|
80
|
+
void setMaskCharacterMap(const std::vector<NitroInputCharacterMapping>& maskCharacterMap) override;
|
|
81
|
+
std::string getMaskSlotPlaceholder() override;
|
|
82
|
+
void setMaskSlotPlaceholder(const std::string& maskSlotPlaceholder) override;
|
|
83
|
+
bool getKeepPlaceholder() override;
|
|
84
|
+
void setKeepPlaceholder(bool keepPlaceholder) override;
|
|
73
85
|
std::string getGroupingSeparator() override;
|
|
74
86
|
void setGroupingSeparator(const std::string& groupingSeparator) override;
|
|
75
87
|
std::string getDecimalSeparator() override;
|