react-native-nitro-input 0.2.0 → 0.3.1
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 +87 -0
- package/README.md +132 -2
- package/android/CMakeLists.txt +4 -0
- package/android/gradle.properties +1 -1
- 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 +43 -2
- package/android/src/main/cpp/JRollingEngine.hpp +9 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroInputView.kt +20 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatform.kt +284 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberView.kt +113 -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/NitroInputPackage.kt +2 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroInputView.kt +69 -10
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroNumberView.kt +522 -130
- 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 +14 -2
- package/cpp/RollingEngine.cpp +102 -8
- package/cpp/RollingEngine.hpp +44 -3
- package/cpp/numberformat/HybridNitroNumberFormat.cpp +498 -0
- package/cpp/numberformat/HybridNitroNumberFormat.hpp +74 -0
- package/cpp/numberformat/HybridNitroNumberFormatFactory.hpp +11 -0
- package/cpp/numberformat/NumberFormatCore.cpp +629 -0
- package/cpp/numberformat/NumberFormatCore.hpp +154 -0
- package/cpp/numberformat/NumberFormatProbe.cpp +354 -0
- package/cpp/numberformat/NumberFormatProbe.hpp +63 -0
- package/ios/HybridNitroInputView.swift +15 -0
- package/ios/HybridNitroNumberFormatPlatform.swift +426 -0
- package/ios/HybridNitroNumberView.swift +101 -1
- package/ios/HybridNitroTextView.swift +134 -0
- package/ios/NitroInputView.swift +79 -19
- package/ios/NitroNumberView.swift +520 -147
- package/ios/NitroTextView.swift +583 -0
- package/lib/commonjs/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
- package/lib/commonjs/nitrogen/generated/shared/json/NitroNumberViewConfig.json +26 -0
- package/lib/commonjs/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
- package/lib/commonjs/src/NitroInput.js +8 -6
- package/lib/commonjs/src/NitroNumber.js +54 -3
- package/lib/commonjs/src/NitroText.js +138 -0
- package/lib/commonjs/src/NitroTime.js +65 -0
- package/lib/commonjs/src/NumberFormat.js +525 -0
- package/lib/commonjs/src/formatProps.js +108 -0
- package/lib/commonjs/src/index.js +8 -1
- package/lib/commonjs/src/specs/NitroText.nitro.js +2 -0
- package/lib/commonjs/src/specs/NumberFormat.nitro.js +2 -0
- package/lib/module/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
- package/lib/module/nitrogen/generated/shared/json/NitroNumberViewConfig.json +26 -0
- package/lib/module/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
- package/lib/module/src/NitroInput.js +8 -6
- package/lib/module/src/NitroNumber.js +54 -3
- package/lib/module/src/NitroText.js +98 -0
- package/lib/module/src/NitroTime.js +29 -0
- package/lib/module/src/NumberFormat.js +521 -0
- package/lib/module/src/formatProps.js +104 -0
- package/lib/module/src/index.js +3 -0
- package/lib/module/src/specs/NitroText.nitro.js +1 -0
- package/lib/module/src/specs/NumberFormat.nitro.js +1 -0
- package/lib/typescript/src/NitroInput.d.ts +22 -0
- package/lib/typescript/src/NitroNumber.d.ts +115 -2
- package/lib/typescript/src/NitroText.d.ts +67 -0
- package/lib/typescript/src/NitroTime.d.ts +19 -0
- package/lib/typescript/src/NumberFormat.d.ts +47 -0
- package/lib/typescript/src/formatProps.d.ts +47 -0
- package/lib/typescript/src/index.d.ts +6 -1
- package/lib/typescript/src/specs/NitroInput.nitro.d.ts +10 -0
- package/lib/typescript/src/specs/NitroNumber.nitro.d.ts +80 -1
- package/lib/typescript/src/specs/NitroText.nitro.d.ts +60 -0
- package/lib/typescript/src/specs/NumberFormat.nitro.d.ts +139 -0
- package/nitro.json +36 -0
- package/nitrogen/generated/android/NitroInput+autolinking.cmake +12 -0
- package/nitrogen/generated/android/NitroInputOnLoad.cpp +62 -0
- package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.cpp +45 -0
- package/nitrogen/generated/android/c++/JHybridNitroInputViewSpec.hpp +10 -0
- package/nitrogen/generated/android/c++/JHybridNitroNumberFormatPlatformSpec.cpp +118 -0
- package/nitrogen/generated/android/c++/JHybridNitroNumberFormatPlatformSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.cpp +297 -0
- package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.hpp +52 -0
- package/nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.cpp +65 -0
- package/nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.hpp +64 -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++/JNitroNumberDirection.hpp +3 -0
- package/nitrogen/generated/android/c++/JNitroNumberShimmerDirection.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroNumberSignDisplay.hpp +67 -0
- package/nitrogen/generated/android/c++/JNumberFormatCompactDisplay.hpp +58 -0
- package/nitrogen/generated/android/c++/JNumberFormatCurrencyDisplay.hpp +64 -0
- package/nitrogen/generated/android/c++/JNumberFormatCurrencySign.hpp +58 -0
- package/nitrogen/generated/android/c++/JNumberFormatNotation.hpp +64 -0
- package/nitrogen/generated/android/c++/JNumberFormatPlatformOptions.hpp +161 -0
- package/nitrogen/generated/android/c++/JNumberFormatPlatformSymbols.hpp +89 -0
- package/nitrogen/generated/android/c++/JNumberFormatRoundingMode.hpp +79 -0
- package/nitrogen/generated/android/c++/JNumberFormatSignDisplay.hpp +67 -0
- package/nitrogen/generated/android/c++/JNumberFormatStyle.hpp +64 -0
- package/nitrogen/generated/android/c++/JNumberFormatUnitDisplay.hpp +61 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroInputViewStateUpdater.cpp +25 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.cpp +130 -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 +30 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatformSpec.kt +60 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroNumberViewSpec.kt +172 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroPlatformNumberFormatterSpec.kt +62 -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/NitroNumberDirection.kt +2 -1
- 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/NumberFormatCompactDisplay.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCurrencyDisplay.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatCurrencySign.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatNotation.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatPlatformOptions.kt +136 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatPlatformSymbols.kt +91 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatRoundingMode.kt +30 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatSignDisplay.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatStyle.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NumberFormatUnitDisplay.kt +24 -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 +68 -0
- package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.hpp +184 -0
- package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Umbrella.hpp +56 -0
- package/nitrogen/generated/ios/NitroInputAutolinking.mm +34 -0
- package/nitrogen/generated/ios/NitroInputAutolinking.swift +36 -0
- package/nitrogen/generated/ios/c++/HybridNitroInputViewSpecSwift.hpp +30 -0
- package/nitrogen/generated/ios/c++/HybridNitroNumberFormatPlatformSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroNumberFormatPlatformSpecSwift.hpp +122 -0
- package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.hpp +188 -0
- package/nitrogen/generated/ios/c++/HybridNitroPlatformNumberFormatterSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroPlatformNumberFormatterSpecSwift.hpp +94 -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 +30 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroNumberViewComponent.mm +156 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroTextViewComponent.mm +264 -0
- package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec.swift +5 -0
- package/nitrogen/generated/ios/swift/HybridNitroInputViewSpec_cxx.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridNitroNumberFormatPlatformSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridNitroNumberFormatPlatformSpec_cxx.swift +159 -0
- package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec.swift +26 -0
- package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec_cxx.swift +658 -21
- package/nitrogen/generated/ios/swift/HybridNitroPlatformNumberFormatterSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridNitroPlatformNumberFormatterSpec_cxx.swift +155 -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/NitroNumberDirection.swift +4 -0
- package/nitrogen/generated/ios/swift/NitroNumberShimmerDirection.swift +44 -0
- package/nitrogen/generated/ios/swift/NitroNumberSignDisplay.swift +52 -0
- package/nitrogen/generated/ios/swift/NumberFormatCompactDisplay.swift +40 -0
- package/nitrogen/generated/ios/swift/NumberFormatCurrencyDisplay.swift +48 -0
- package/nitrogen/generated/ios/swift/NumberFormatCurrencySign.swift +40 -0
- package/nitrogen/generated/ios/swift/NumberFormatNotation.swift +48 -0
- package/nitrogen/generated/ios/swift/NumberFormatPlatformOptions.swift +159 -0
- package/nitrogen/generated/ios/swift/NumberFormatPlatformSymbols.swift +69 -0
- package/nitrogen/generated/ios/swift/NumberFormatRoundingMode.swift +68 -0
- package/nitrogen/generated/ios/swift/NumberFormatSignDisplay.swift +52 -0
- package/nitrogen/generated/ios/swift/NumberFormatStyle.swift +48 -0
- package/nitrogen/generated/ios/swift/NumberFormatUnitDisplay.swift +44 -0
- package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.cpp +10 -0
- package/nitrogen/generated/shared/c++/HybridNitroInputViewSpec.hpp +10 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberFormatFactorySpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberFormatFactorySpec.hpp +70 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberFormatPlatformSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberFormatPlatformSpec.hpp +70 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberFormatSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberFormatSpec.hpp +71 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.cpp +52 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.hpp +58 -0
- package/nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.hpp +65 -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++/NitroNumberDirection.hpp +4 -0
- package/nitrogen/generated/shared/c++/NitroNumberShimmerDirection.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroNumberSignDisplay.hpp +88 -0
- package/nitrogen/generated/shared/c++/NumberFormatCompactDisplay.hpp +76 -0
- package/nitrogen/generated/shared/c++/NumberFormatCurrencyDisplay.hpp +84 -0
- package/nitrogen/generated/shared/c++/NumberFormatCurrencySign.hpp +76 -0
- package/nitrogen/generated/shared/c++/NumberFormatGrouping.hpp +80 -0
- package/nitrogen/generated/shared/c++/NumberFormatNotation.hpp +84 -0
- package/nitrogen/generated/shared/c++/NumberFormatOptions.hpp +193 -0
- package/nitrogen/generated/shared/c++/NumberFormatPart.hpp +87 -0
- package/nitrogen/generated/shared/c++/NumberFormatPlatformOptions.hpp +176 -0
- package/nitrogen/generated/shared/c++/NumberFormatPlatformSymbols.hpp +115 -0
- package/nitrogen/generated/shared/c++/NumberFormatRoundingMode.hpp +104 -0
- package/nitrogen/generated/shared/c++/NumberFormatRoundingPriority.hpp +80 -0
- package/nitrogen/generated/shared/c++/NumberFormatSignDisplay.hpp +88 -0
- package/nitrogen/generated/shared/c++/NumberFormatStyle.hpp +84 -0
- package/nitrogen/generated/shared/c++/NumberFormatTrailingZeroDisplay.hpp +76 -0
- package/nitrogen/generated/shared/c++/NumberFormatUnitDisplay.hpp +80 -0
- package/nitrogen/generated/shared/c++/ResolvedNumberFormatOptions.hpp +197 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.cpp +10 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroInputViewComponent.hpp +15 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.cpp +52 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.hpp +80 -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 +5 -0
- package/nitrogen/generated/shared/json/NitroNumberViewConfig.json +26 -0
- package/nitrogen/generated/shared/json/NitroTextViewConfig.json +30 -0
- package/package.json +2 -2
- package/src/NitroInput.tsx +42 -7
- package/src/NitroNumber.tsx +236 -12
- package/src/NitroText.tsx +166 -0
- package/src/NitroTime.tsx +68 -0
- package/src/NumberFormat.ts +563 -0
- package/src/formatProps.ts +149 -0
- package/src/index.ts +23 -0
- package/src/specs/NitroInput.nitro.ts +10 -0
- package/src/specs/NitroNumber.nitro.ts +82 -1
- package/src/specs/NitroText.nitro.ts +65 -0
- package/src/specs/NumberFormat.nitro.ts +145 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroTextViewComponent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/ReactProp.hpp>
|
|
11
|
+
#include <NitroModules/ViewComponentDescriptor.hpp>
|
|
12
|
+
#include <NitroModules/ViewPropsHolderState.hpp>
|
|
13
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
14
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
15
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
16
|
+
#include <react/renderer/core/RawProps.h>
|
|
17
|
+
|
|
18
|
+
#include <string>
|
|
19
|
+
|
|
20
|
+
#include <string>
|
|
21
|
+
#include <optional>
|
|
22
|
+
#include "NitroNumberTextAlign.hpp"
|
|
23
|
+
#include "NitroInputEasing.hpp"
|
|
24
|
+
#include "NitroInputEffect.hpp"
|
|
25
|
+
#include "NitroNumberShimmerDirection.hpp"
|
|
26
|
+
#include <memory>
|
|
27
|
+
#include "HybridNitroTextViewSpec.hpp"
|
|
28
|
+
#include <functional>
|
|
29
|
+
|
|
30
|
+
namespace margelo::nitro::nitroinput::views {
|
|
31
|
+
|
|
32
|
+
using namespace facebook;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The name of the actual native View.
|
|
36
|
+
*/
|
|
37
|
+
extern const char HybridNitroTextViewComponentName[];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Props for the "NitroTextView" View.
|
|
41
|
+
*/
|
|
42
|
+
class HybridNitroTextViewProps final: public react::ViewProps {
|
|
43
|
+
public:
|
|
44
|
+
HybridNitroTextViewProps() = default;
|
|
45
|
+
HybridNitroTextViewProps(const react::PropsParserContext& context,
|
|
46
|
+
const HybridNitroTextViewProps& sourceProps,
|
|
47
|
+
const react::RawProps& rawProps);
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
nitro::ReactProp<std::string> text;
|
|
51
|
+
nitro::ReactProp<std::optional<double>> fontSize;
|
|
52
|
+
nitro::ReactProp<std::optional<double>> fontWeight;
|
|
53
|
+
nitro::ReactProp<std::optional<std::string>> fontFamily;
|
|
54
|
+
nitro::ReactProp<std::optional<double>> color;
|
|
55
|
+
nitro::ReactProp<std::optional<double>> letterSpacing;
|
|
56
|
+
nitro::ReactProp<std::optional<NitroNumberTextAlign>> textAlign;
|
|
57
|
+
nitro::ReactProp<std::optional<bool>> rightToLeft;
|
|
58
|
+
nitro::ReactProp<std::optional<double>> duration;
|
|
59
|
+
nitro::ReactProp<std::optional<NitroInputEasing>> easing;
|
|
60
|
+
nitro::ReactProp<std::optional<double>> bounce;
|
|
61
|
+
nitro::ReactProp<std::optional<NitroInputEffect>> effect;
|
|
62
|
+
nitro::ReactProp<std::optional<bool>> respectReduceMotion;
|
|
63
|
+
nitro::ReactProp<std::optional<bool>> loading;
|
|
64
|
+
nitro::ReactProp<std::optional<double>> shimmerColor;
|
|
65
|
+
nitro::ReactProp<std::optional<double>> shimmerDuration;
|
|
66
|
+
nitro::ReactProp<std::optional<double>> shimmerAngle;
|
|
67
|
+
nitro::ReactProp<std::optional<double>> shimmerWidth;
|
|
68
|
+
nitro::ReactProp<std::optional<double>> shimmerBaseColor;
|
|
69
|
+
nitro::ReactProp<std::optional<NitroNumberShimmerDirection>> shimmerDirection;
|
|
70
|
+
nitro::ReactProp<std::optional<double>> shimmerDelay;
|
|
71
|
+
nitro::ReactProp<std::optional<std::function<void(const std::shared_ptr<HybridNitroTextViewSpec>& /* ref */)>>> hybridRef;
|
|
72
|
+
|
|
73
|
+
[[nodiscard]]
|
|
74
|
+
bool hasSameProps(const HybridNitroTextViewProps& other) const noexcept {
|
|
75
|
+
return text.hasSameValue(other.text) &&
|
|
76
|
+
fontSize.hasSameValue(other.fontSize) &&
|
|
77
|
+
fontWeight.hasSameValue(other.fontWeight) &&
|
|
78
|
+
fontFamily.hasSameValue(other.fontFamily) &&
|
|
79
|
+
color.hasSameValue(other.color) &&
|
|
80
|
+
letterSpacing.hasSameValue(other.letterSpacing) &&
|
|
81
|
+
textAlign.hasSameValue(other.textAlign) &&
|
|
82
|
+
rightToLeft.hasSameValue(other.rightToLeft) &&
|
|
83
|
+
duration.hasSameValue(other.duration) &&
|
|
84
|
+
easing.hasSameValue(other.easing) &&
|
|
85
|
+
bounce.hasSameValue(other.bounce) &&
|
|
86
|
+
effect.hasSameValue(other.effect) &&
|
|
87
|
+
respectReduceMotion.hasSameValue(other.respectReduceMotion) &&
|
|
88
|
+
loading.hasSameValue(other.loading) &&
|
|
89
|
+
shimmerColor.hasSameValue(other.shimmerColor) &&
|
|
90
|
+
shimmerDuration.hasSameValue(other.shimmerDuration) &&
|
|
91
|
+
shimmerAngle.hasSameValue(other.shimmerAngle) &&
|
|
92
|
+
shimmerWidth.hasSameValue(other.shimmerWidth) &&
|
|
93
|
+
shimmerBaseColor.hasSameValue(other.shimmerBaseColor) &&
|
|
94
|
+
shimmerDirection.hasSameValue(other.shimmerDirection) &&
|
|
95
|
+
shimmerDelay.hasSameValue(other.shimmerDelay) &&
|
|
96
|
+
hybridRef.hasSameValue(other.hybridRef);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
[[nodiscard]]
|
|
100
|
+
bool hasAnyProvidedProps() const noexcept {
|
|
101
|
+
return text.isProvided() ||
|
|
102
|
+
fontSize.isProvided() ||
|
|
103
|
+
fontWeight.isProvided() ||
|
|
104
|
+
fontFamily.isProvided() ||
|
|
105
|
+
color.isProvided() ||
|
|
106
|
+
letterSpacing.isProvided() ||
|
|
107
|
+
textAlign.isProvided() ||
|
|
108
|
+
rightToLeft.isProvided() ||
|
|
109
|
+
duration.isProvided() ||
|
|
110
|
+
easing.isProvided() ||
|
|
111
|
+
bounce.isProvided() ||
|
|
112
|
+
effect.isProvided() ||
|
|
113
|
+
respectReduceMotion.isProvided() ||
|
|
114
|
+
loading.isProvided() ||
|
|
115
|
+
shimmerColor.isProvided() ||
|
|
116
|
+
shimmerDuration.isProvided() ||
|
|
117
|
+
shimmerAngle.isProvided() ||
|
|
118
|
+
shimmerWidth.isProvided() ||
|
|
119
|
+
shimmerBaseColor.isProvided() ||
|
|
120
|
+
shimmerDirection.isProvided() ||
|
|
121
|
+
shimmerDelay.isProvided() ||
|
|
122
|
+
hybridRef.isProvided();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private:
|
|
126
|
+
static bool filterObjectKeys(const std::string& propName);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* State for the "NitroTextView" View.
|
|
131
|
+
*/
|
|
132
|
+
using HybridNitroTextViewState = nitro::ViewPropsHolderState<HybridNitroTextViewProps>;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The Shadow Node for the "NitroTextView" View.
|
|
136
|
+
*/
|
|
137
|
+
using HybridNitroTextViewShadowNode = react::ConcreteViewShadowNode<HybridNitroTextViewComponentName /* "HybridNitroTextView" */,
|
|
138
|
+
HybridNitroTextViewProps /* custom props */,
|
|
139
|
+
react::ViewEventEmitter /* default */,
|
|
140
|
+
HybridNitroTextViewState /* custom state */>;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The Component Descriptor for the "NitroTextView" View.
|
|
144
|
+
*/
|
|
145
|
+
using HybridNitroTextViewComponentDescriptor = nitro::ViewComponentDescriptor<HybridNitroTextViewShadowNode>;
|
|
146
|
+
|
|
147
|
+
/* The actual view for "NitroTextView" needs to be implemented in platform-specific code. */
|
|
148
|
+
|
|
149
|
+
} // namespace margelo::nitro::nitroinput::views
|
|
@@ -34,6 +34,11 @@
|
|
|
34
34
|
"signPlacement": true,
|
|
35
35
|
"prefixAlign": true,
|
|
36
36
|
"suffixAlign": true,
|
|
37
|
+
"letterSpacing": true,
|
|
38
|
+
"prefixSpacing": true,
|
|
39
|
+
"suffixSpacing": true,
|
|
40
|
+
"prefixOffset": true,
|
|
41
|
+
"suffixOffset": true,
|
|
37
42
|
"placeholder": true,
|
|
38
43
|
"placeholderColor": true,
|
|
39
44
|
"duration": true,
|
|
@@ -32,12 +32,36 @@
|
|
|
32
32
|
"loading": true,
|
|
33
33
|
"shimmerColor": true,
|
|
34
34
|
"shimmerDuration": true,
|
|
35
|
+
"shimmerAngle": true,
|
|
36
|
+
"shimmerWidth": true,
|
|
37
|
+
"shimmerBaseColor": true,
|
|
38
|
+
"shimmerDirection": true,
|
|
39
|
+
"shimmerDelay": true,
|
|
35
40
|
"fontSize": true,
|
|
36
41
|
"prefixFontSize": true,
|
|
37
42
|
"suffixFontSize": true,
|
|
38
43
|
"affixAlign": true,
|
|
39
44
|
"prefixAlign": true,
|
|
40
45
|
"suffixAlign": true,
|
|
46
|
+
"letterSpacing": true,
|
|
47
|
+
"prefixSpacing": true,
|
|
48
|
+
"suffixSpacing": true,
|
|
49
|
+
"prefixOffset": true,
|
|
50
|
+
"suffixOffset": true,
|
|
51
|
+
"tabularNums": true,
|
|
52
|
+
"signDisplay": true,
|
|
53
|
+
"plusSign": true,
|
|
54
|
+
"minusSign": true,
|
|
55
|
+
"digitGlyphs": true,
|
|
56
|
+
"groupingSizes": true,
|
|
57
|
+
"digitMax": true,
|
|
58
|
+
"continuous": true,
|
|
59
|
+
"prefixColor": true,
|
|
60
|
+
"suffixColor": true,
|
|
61
|
+
"fractionColor": true,
|
|
62
|
+
"fractionFontSize": true,
|
|
63
|
+
"fractionAlign": true,
|
|
64
|
+
"respectReduceMotion": true,
|
|
41
65
|
"adjustsFontSizeToFit": true,
|
|
42
66
|
"minimumFontScale": true,
|
|
43
67
|
"allowFontScaling": true,
|
|
@@ -50,6 +74,8 @@
|
|
|
50
74
|
"onSizeChange": true,
|
|
51
75
|
"onRevealEnd": true,
|
|
52
76
|
"onRevealMilestone": true,
|
|
77
|
+
"onAnimationStart": true,
|
|
78
|
+
"onAnimationEnd": true,
|
|
53
79
|
"hybridRef": true
|
|
54
80
|
}
|
|
55
81
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"uiViewClassName": "NitroTextView",
|
|
3
|
+
"supportsRawText": false,
|
|
4
|
+
"bubblingEventTypes": {},
|
|
5
|
+
"directEventTypes": {},
|
|
6
|
+
"validAttributes": {
|
|
7
|
+
"text": true,
|
|
8
|
+
"fontSize": true,
|
|
9
|
+
"fontWeight": true,
|
|
10
|
+
"fontFamily": true,
|
|
11
|
+
"color": true,
|
|
12
|
+
"letterSpacing": true,
|
|
13
|
+
"textAlign": true,
|
|
14
|
+
"rightToLeft": true,
|
|
15
|
+
"duration": true,
|
|
16
|
+
"easing": true,
|
|
17
|
+
"bounce": true,
|
|
18
|
+
"effect": true,
|
|
19
|
+
"respectReduceMotion": true,
|
|
20
|
+
"loading": true,
|
|
21
|
+
"shimmerColor": true,
|
|
22
|
+
"shimmerDuration": true,
|
|
23
|
+
"shimmerAngle": true,
|
|
24
|
+
"shimmerWidth": true,
|
|
25
|
+
"shimmerBaseColor": true,
|
|
26
|
+
"shimmerDirection": true,
|
|
27
|
+
"shimmerDelay": true,
|
|
28
|
+
"hybridRef": true
|
|
29
|
+
}
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nitro-input",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Native text for React Native, built with Nitro: a text and amount input with native formatting, masks and a Torph-style reflow, and an animated number (odometer, SwiftUI-style numeric text, ticker) whose digits roll or swap natively, with currency layouts and animated currency switches, shrink-to-fit, a loading shimmer and a jackpot reveal.",
|
|
5
5
|
"main": "lib/commonjs/src/index.js",
|
|
6
6
|
"module": "lib/module/src/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"specs": "nitrogen --logLevel=\"debug\"",
|
|
40
40
|
"prepack": "bun run build",
|
|
41
41
|
"test": "jest",
|
|
42
|
-
"test:cpp": "mkdir -p .cache && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/ReflowEngine.cpp cpp/AmountFormatter.cpp cpp/__tests__/ReflowEngineTest.cpp -o .cache/reflow-engine-test && .cache/reflow-engine-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/AmountFormatter.cpp cpp/__tests__/AmountFormatterTest.cpp -o .cache/amount-formatter-test && .cache/amount-formatter-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/AmountFormatter.cpp cpp/MaskEngine.cpp cpp/__tests__/MaskEngineTest.cpp -o .cache/mask-engine-test && .cache/mask-engine-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/OutlineGeometry.cpp cpp/__tests__/OutlineGeometryTest.cpp -o .cache/outline-geometry-test && .cache/outline-geometry-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/RollingEngine.cpp cpp/__tests__/RollingEngineTest.cpp -o .cache/rolling-engine-test && .cache/rolling-engine-test",
|
|
42
|
+
"test:cpp": "mkdir -p .cache && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/ReflowEngine.cpp cpp/AmountFormatter.cpp cpp/__tests__/ReflowEngineTest.cpp -o .cache/reflow-engine-test && .cache/reflow-engine-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/AmountFormatter.cpp cpp/__tests__/AmountFormatterTest.cpp -o .cache/amount-formatter-test && .cache/amount-formatter-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/AmountFormatter.cpp cpp/MaskEngine.cpp cpp/__tests__/MaskEngineTest.cpp -o .cache/mask-engine-test && .cache/mask-engine-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/OutlineGeometry.cpp cpp/__tests__/OutlineGeometryTest.cpp -o .cache/outline-geometry-test && .cache/outline-geometry-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/RollingEngine.cpp cpp/__tests__/RollingEngineTest.cpp -o .cache/rolling-engine-test && .cache/rolling-engine-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/numberformat/NumberFormatCore.cpp cpp/__tests__/NumberFormatCoreTest.cpp -o .cache/number-format-core-test && .cache/number-format-core-test && clang++ -std=c++20 -O1 -Wall -Wextra -Icpp cpp/numberformat/NumberFormatCore.cpp cpp/numberformat/NumberFormatProbe.cpp cpp/__tests__/NumberFormatProbeTest.cpp -o .cache/number-format-probe-test && .cache/number-format-probe-test",
|
|
43
43
|
"test:cpp:sanitize": "mkdir -p .cache && clang++ -std=c++20 -O1 -g -fsanitize=address,undefined -fno-omit-frame-pointer -Icpp cpp/RollingEngine.cpp cpp/__tests__/RollingEngineTest.cpp -o .cache/rolling-engine-sanitize && .cache/rolling-engine-sanitize",
|
|
44
44
|
"release": "release-it"
|
|
45
45
|
},
|
package/src/NitroInput.tsx
CHANGED
|
@@ -52,6 +52,8 @@ import {
|
|
|
52
52
|
type NitroInputTransform,
|
|
53
53
|
} from './worklets'
|
|
54
54
|
import { toNumericWeight, toProcessedColor } from './styleHelpers'
|
|
55
|
+
import { formatProps } from './formatProps'
|
|
56
|
+
import type { NumberFormat } from './NumberFormat'
|
|
55
57
|
|
|
56
58
|
/**
|
|
57
59
|
* React Native's registry of mounted text inputs. `TextInput.State` only
|
|
@@ -362,6 +364,27 @@ export interface NitroInputProps extends Omit<ViewProps, 'children' | 'onFocus'
|
|
|
362
364
|
prefixAlign?: NitroInputAffixAlign
|
|
363
365
|
/** Alignment of `suffix` only. Defaults to `affixAlign`. */
|
|
364
366
|
suffixAlign?: NitroInputAffixAlign
|
|
367
|
+
/**
|
|
368
|
+
* Points added after every glyph, like `Text`'s `letterSpacing` (negative
|
|
369
|
+
* tightens). A smaller prefix or suffix gets it in proportion to its size.
|
|
370
|
+
* Default: `0`.
|
|
371
|
+
*/
|
|
372
|
+
letterSpacing?: number
|
|
373
|
+
/** Points between the prefix and the text, in place of the letter spacing there. Defaults to the letter spacing. */
|
|
374
|
+
prefixSpacing?: number
|
|
375
|
+
/** Points between the text and the suffix, in place of the letter spacing there. Defaults to the letter spacing. */
|
|
376
|
+
suffixSpacing?: number
|
|
377
|
+
/** Points the prefix is moved down after `prefixAlign` places it (negative: up). Default: `0`. */
|
|
378
|
+
prefixOffset?: number
|
|
379
|
+
/** Points the suffix is moved down after `suffixAlign` places it (negative: up). Default: `0`. */
|
|
380
|
+
suffixOffset?: number
|
|
381
|
+
/**
|
|
382
|
+
* A `NumberFormat` the amount follows: its prefix and suffix (the currency
|
|
383
|
+
* where the locale puts it), grouping and decimal separators, fraction
|
|
384
|
+
* digits and where the sign goes. Sets `mode` to `'number'` unless it is
|
|
385
|
+
* given. The individual props override what it says.
|
|
386
|
+
*/
|
|
387
|
+
format?: NumberFormat
|
|
365
388
|
/** Shown while the field is empty and reflowed away by the first character. In `'number'` mode `'0'` reads well. */
|
|
366
389
|
placeholder?: string
|
|
367
390
|
/** Color of the placeholder. Defaults to the platform placeholder color. */
|
|
@@ -632,6 +655,12 @@ export const NitroInput = forwardRef<NitroInputHandle, NitroInputProps>(
|
|
|
632
655
|
signPlacement,
|
|
633
656
|
prefixAlign,
|
|
634
657
|
suffixAlign,
|
|
658
|
+
letterSpacing,
|
|
659
|
+
prefixSpacing,
|
|
660
|
+
suffixSpacing,
|
|
661
|
+
prefixOffset,
|
|
662
|
+
suffixOffset,
|
|
663
|
+
format,
|
|
635
664
|
placeholder,
|
|
636
665
|
placeholderTextColor,
|
|
637
666
|
duration,
|
|
@@ -1074,13 +1103,14 @@ export const NitroInput = forwardRef<NitroInputHandle, NitroInputProps>(
|
|
|
1074
1103
|
if (prefix) warnIncompatible('prefix')
|
|
1075
1104
|
if (suffix) warnIncompatible('suffix')
|
|
1076
1105
|
}
|
|
1077
|
-
const
|
|
1106
|
+
const derived = format ? formatProps(format) : undefined
|
|
1107
|
+
const resolvedMode = isMultiline ? 'text' : (mode ?? (derived ? 'number' : 'text'))
|
|
1078
1108
|
const reflows = !isMultiline && transition === 'reflow'
|
|
1079
1109
|
// The affixes are accessory views beside one line of text; a wrapping text
|
|
1080
1110
|
// view has no slot for them, so they go with the mode rather than being
|
|
1081
1111
|
// half-drawn on one platform and not the other.
|
|
1082
|
-
const resolvedPrefix = isMultiline ? '' : (prefix ?? '')
|
|
1083
|
-
const resolvedSuffix = isMultiline ? '' : (suffix ?? '')
|
|
1112
|
+
const resolvedPrefix = isMultiline ? '' : (prefix ?? derived?.prefix ?? '')
|
|
1113
|
+
const resolvedSuffix = isMultiline ? '' : (suffix ?? derived?.suffix ?? '')
|
|
1084
1114
|
// A new `maskNotations` literal each render must not re-set the native
|
|
1085
1115
|
// prop, so it is keyed on its contents. Always an array (empty = none):
|
|
1086
1116
|
// removing the prop would reach native as `null`, which Nitro's array
|
|
@@ -1092,7 +1122,7 @@ export const NitroInput = forwardRef<NitroInputHandle, NitroInputProps>(
|
|
|
1092
1122
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1093
1123
|
[notationsKey]
|
|
1094
1124
|
)
|
|
1095
|
-
const resolvedFractionDigits = fractionDigits ?? 2
|
|
1125
|
+
const resolvedFractionDigits = fractionDigits ?? derived?.fractionDigits ?? 2
|
|
1096
1126
|
const resolvedKeyboardType =
|
|
1097
1127
|
keyboardType ??
|
|
1098
1128
|
(inputMode != null
|
|
@@ -1196,15 +1226,20 @@ export const NitroInput = forwardRef<NitroInputHandle, NitroInputProps>(
|
|
|
1196
1226
|
plain={!reflows}
|
|
1197
1227
|
fractionDigits={resolvedFractionDigits}
|
|
1198
1228
|
maxIntegerDigits={maxIntegerDigits ?? 15}
|
|
1199
|
-
groupingSeparator={groupingSeparator ?? ','}
|
|
1200
|
-
decimalSeparator={decimalSeparator ?? '.'}
|
|
1229
|
+
groupingSeparator={groupingSeparator ?? derived?.groupingSeparator ?? ','}
|
|
1230
|
+
decimalSeparator={decimalSeparator ?? derived?.decimalSeparator ?? '.'}
|
|
1201
1231
|
prefix={resolvedPrefix}
|
|
1202
1232
|
suffix={resolvedSuffix}
|
|
1203
1233
|
prefixFontSize={prefixFontSize ?? resolvedFontSize}
|
|
1204
1234
|
suffixFontSize={suffixFontSize ?? resolvedFontSize}
|
|
1205
|
-
signPlacement={signPlacement ?? 'beforeAffix'}
|
|
1235
|
+
signPlacement={signPlacement ?? derived?.signPlacement ?? 'beforeAffix'}
|
|
1206
1236
|
prefixAlign={prefixAlign ?? resolvedAffixAlign}
|
|
1207
1237
|
suffixAlign={suffixAlign ?? resolvedAffixAlign}
|
|
1238
|
+
letterSpacing={letterSpacing ?? 0}
|
|
1239
|
+
prefixSpacing={prefixSpacing ?? Infinity}
|
|
1240
|
+
suffixSpacing={suffixSpacing ?? Infinity}
|
|
1241
|
+
prefixOffset={prefixOffset ?? 0}
|
|
1242
|
+
suffixOffset={suffixOffset ?? 0}
|
|
1208
1243
|
placeholder={placeholder ?? ''}
|
|
1209
1244
|
placeholderColor={processedPlaceholderColor}
|
|
1210
1245
|
duration={duration ?? 400}
|