react-native-nitro-input 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +343 -3
- package/NitroInput.podspec +4 -4
- package/README.md +420 -53
- package/android/CMakeLists.txt +9 -3
- package/android/gradle.properties +1 -1
- package/android/src/main/cpp/JOutlineGeometry.hpp +1 -1
- package/android/src/main/cpp/JReflowEngine.cpp +132 -0
- package/android/src/main/cpp/{JMorphEngine.hpp → JReflowEngine.hpp} +7 -7
- package/android/src/main/cpp/JRollingEngine.cpp +223 -0
- package/android/src/main/cpp/JRollingEngine.hpp +68 -0
- package/android/src/main/cpp/cpp-adapter.cpp +4 -2
- package/android/src/main/java/com/margelo/nitro/nitroinput/AmountFormatter.kt +1 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroInputView.kt +21 -1
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberFormatPlatform.kt +209 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/HybridNitroNumberView.kt +496 -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 +107 -26
- package/android/src/main/java/com/margelo/nitro/nitroinput/NitroNumberView.kt +1881 -0
- package/android/src/main/java/com/margelo/nitro/nitroinput/{MorphEngine.kt → ReflowEngine.kt} +2 -2
- package/android/src/main/java/com/margelo/nitro/nitroinput/RollingEngine.kt +60 -0
- package/cpp/AmountFormatter.cpp +5 -0
- package/cpp/AmountFormatter.hpp +10 -2
- package/cpp/{MorphEngine.cpp → ReflowEngine.cpp} +52 -47
- package/cpp/{MorphEngine.hpp → ReflowEngine.hpp} +12 -4
- package/cpp/RollingEngine.cpp +1234 -0
- package/cpp/RollingEngine.hpp +475 -0
- package/cpp/SwiftNonCopyable.hpp +22 -0
- 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/cpp/worklets/NitroInputWorkletsBridge.cpp +3 -3
- package/cpp/worklets/NitroInputWorkletsBridge.hpp +1 -1
- package/ios/{HybridMorphInputView.swift → HybridNitroInputView.swift} +16 -1
- package/ios/HybridNitroNumberFormatPlatform.swift +348 -0
- package/ios/HybridNitroNumberView.swift +458 -0
- package/ios/NitroInputView.swift +148 -64
- package/ios/NitroNumberView.swift +2074 -0
- package/lib/commonjs/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
- package/lib/commonjs/nitrogen/generated/shared/json/NitroNumberViewConfig.json +61 -0
- package/lib/commonjs/src/NitroInput.js +27 -56
- package/lib/commonjs/src/NitroNumber.js +141 -0
- package/lib/commonjs/src/NumberFormat.js +525 -0
- package/lib/commonjs/src/formatProps.js +48 -0
- package/lib/commonjs/src/index.js +6 -3
- package/lib/commonjs/src/specs/NitroNumber.nitro.js +2 -0
- package/lib/commonjs/src/specs/NumberFormat.nitro.js +2 -0
- package/lib/commonjs/src/styleHelpers.js +36 -0
- package/lib/module/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
- package/lib/module/nitrogen/generated/shared/json/NitroNumberViewConfig.json +61 -0
- package/lib/module/src/NitroInput.js +18 -47
- package/lib/module/src/NitroNumber.js +102 -0
- package/lib/module/src/NumberFormat.js +521 -0
- package/lib/module/src/formatProps.js +45 -0
- package/lib/module/src/index.js +2 -1
- package/lib/module/src/specs/NitroNumber.nitro.js +1 -0
- package/lib/module/src/specs/NumberFormat.nitro.js +1 -0
- package/lib/module/src/styleHelpers.js +32 -0
- package/lib/typescript/src/NitroInput.d.ts +50 -21
- package/lib/typescript/src/NitroNumber.d.ts +246 -0
- package/lib/typescript/src/NumberFormat.d.ts +47 -0
- package/lib/typescript/src/formatProps.d.ts +21 -0
- package/lib/typescript/src/index.d.ts +5 -2
- package/lib/typescript/src/specs/NitroInput.nitro.d.ts +19 -9
- package/lib/typescript/src/specs/NitroNumber.nitro.d.ts +250 -0
- package/lib/typescript/src/specs/NumberFormat.nitro.d.ts +139 -0
- package/lib/typescript/src/styleHelpers.d.ts +3 -0
- package/nitro.json +26 -0
- package/nitrogen/generated/android/NitroInput+autolinking.cmake +10 -0
- package/nitrogen/generated/android/NitroInputOnLoad.cpp +48 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_double_double.hpp +10 -10
- 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 +590 -0
- package/nitrogen/generated/android/c++/JHybridNitroNumberViewSpec.hpp +168 -0
- package/nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.cpp +65 -0
- package/nitrogen/generated/android/c++/JHybridNitroPlatformNumberFormatterSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JNitroNumberAffixAlign.hpp +64 -0
- package/nitrogen/generated/android/c++/JNitroNumberDirection.hpp +64 -0
- package/nitrogen/generated/android/c++/JNitroNumberEasing.hpp +67 -0
- package/nitrogen/generated/android/c++/JNitroNumberRevealStyle.hpp +58 -0
- package/nitrogen/generated/android/c++/JNitroNumberTextAlign.hpp +64 -0
- package/nitrogen/generated/android/c++/JNitroNumberTransition.hpp +61 -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 +329 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroNumberViewStateUpdater.hpp +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/Func_void.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/Func_void_double_double.kt +9 -9
- 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 +399 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/HybridNitroPlatformNumberFormatterSpec.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberAffixAlign.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberDirection.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberEasing.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberRevealStyle.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberTextAlign.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/NitroNumberTransition.kt +24 -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/HybridNitroNumberViewManager.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroinput/views/HybridNitroNumberViewStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.cpp +59 -0
- package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Bridge.hpp +311 -0
- package/nitrogen/generated/ios/NitroInput-Swift-Cxx-Umbrella.hpp +63 -0
- package/nitrogen/generated/ios/NitroInputAutolinking.mm +26 -0
- package/nitrogen/generated/ios/NitroInputAutolinking.swift +24 -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.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroNumberViewSpecSwift.hpp +474 -0
- package/nitrogen/generated/ios/c++/HybridNitroPlatformNumberFormatterSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroPlatformNumberFormatterSpecSwift.hpp +94 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroInputViewComponent.mm +30 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroNumberViewComponent.mm +450 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_double_double.swift +5 -5
- 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 +108 -0
- package/nitrogen/generated/ios/swift/HybridNitroNumberViewSpec_cxx.swift +1387 -0
- package/nitrogen/generated/ios/swift/HybridNitroPlatformNumberFormatterSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridNitroPlatformNumberFormatterSpec_cxx.swift +155 -0
- package/nitrogen/generated/ios/swift/NitroNumberAffixAlign.swift +48 -0
- package/nitrogen/generated/ios/swift/NitroNumberDirection.swift +48 -0
- package/nitrogen/generated/ios/swift/NitroNumberEasing.swift +52 -0
- package/nitrogen/generated/ios/swift/NitroNumberRevealStyle.swift +40 -0
- package/nitrogen/generated/ios/swift/NitroNumberTextAlign.swift +48 -0
- package/nitrogen/generated/ios/swift/NitroNumberTransition.swift +44 -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 +127 -0
- package/nitrogen/generated/shared/c++/HybridNitroNumberViewSpec.hpp +187 -0
- package/nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridNitroPlatformNumberFormatterSpec.hpp +65 -0
- package/nitrogen/generated/shared/c++/NitroNumberAffixAlign.hpp +84 -0
- package/nitrogen/generated/shared/c++/NitroNumberDirection.hpp +84 -0
- package/nitrogen/generated/shared/c++/NitroNumberEasing.hpp +88 -0
- package/nitrogen/generated/shared/c++/NitroNumberRevealStyle.hpp +76 -0
- package/nitrogen/generated/shared/c++/NitroNumberTextAlign.hpp +84 -0
- package/nitrogen/generated/shared/c++/NitroNumberTransition.hpp +80 -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 +136 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroNumberViewComponent.hpp +245 -0
- package/nitrogen/generated/shared/json/NitroInputViewConfig.json +5 -0
- package/nitrogen/generated/shared/json/NitroNumberViewConfig.json +61 -0
- package/package.json +15 -7
- package/src/NitroInput.tsx +79 -67
- package/src/NitroNumber.tsx +531 -0
- package/src/NumberFormat.ts +563 -0
- package/src/formatProps.ts +59 -0
- package/src/index.ts +38 -6
- package/src/specs/NitroInput.nitro.ts +19 -9
- package/src/specs/NitroNumber.nitro.ts +271 -0
- package/src/specs/NumberFormat.nitro.ts +145 -0
- package/src/styleHelpers.ts +32 -0
- package/android/src/main/cpp/JMorphEngine.cpp +0 -132
- package/lib/commonjs/src/MorphInput.js +0 -42
- package/lib/module/src/MorphInput.js +0 -6
- package/lib/typescript/src/MorphInput.d.ts +0 -18
- package/src/MorphInput.tsx +0 -30
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNumberFormatSignDisplay.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 <fbjni/fbjni.h>
|
|
11
|
+
#include "NumberFormatSignDisplay.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::nitroinput {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "NumberFormatSignDisplay" and the Kotlin enum "NumberFormatSignDisplay".
|
|
19
|
+
*/
|
|
20
|
+
struct JNumberFormatSignDisplay final: public jni::JavaClass<JNumberFormatSignDisplay> {
|
|
21
|
+
public:
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroinput/NumberFormatSignDisplay;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum NumberFormatSignDisplay.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
NumberFormatSignDisplay toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<NumberFormatSignDisplay>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JNumberFormatSignDisplay> fromCpp(NumberFormatSignDisplay value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case NumberFormatSignDisplay::AUTO:
|
|
46
|
+
static const auto fieldAUTO = clazz->getStaticField<JNumberFormatSignDisplay>("AUTO");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldAUTO);
|
|
48
|
+
case NumberFormatSignDisplay::ALWAYS:
|
|
49
|
+
static const auto fieldALWAYS = clazz->getStaticField<JNumberFormatSignDisplay>("ALWAYS");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldALWAYS);
|
|
51
|
+
case NumberFormatSignDisplay::NEVER:
|
|
52
|
+
static const auto fieldNEVER = clazz->getStaticField<JNumberFormatSignDisplay>("NEVER");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldNEVER);
|
|
54
|
+
case NumberFormatSignDisplay::EXCEPTZERO:
|
|
55
|
+
static const auto fieldEXCEPTZERO = clazz->getStaticField<JNumberFormatSignDisplay>("EXCEPTZERO");
|
|
56
|
+
return clazz->getStaticFieldValue(fieldEXCEPTZERO);
|
|
57
|
+
case NumberFormatSignDisplay::NEGATIVE:
|
|
58
|
+
static const auto fieldNEGATIVE = clazz->getStaticField<JNumberFormatSignDisplay>("NEGATIVE");
|
|
59
|
+
return clazz->getStaticFieldValue(fieldNEGATIVE);
|
|
60
|
+
default:
|
|
61
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
62
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
} // namespace margelo::nitro::nitroinput
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNumberFormatStyle.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 <fbjni/fbjni.h>
|
|
11
|
+
#include "NumberFormatStyle.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::nitroinput {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "NumberFormatStyle" and the Kotlin enum "NumberFormatStyle".
|
|
19
|
+
*/
|
|
20
|
+
struct JNumberFormatStyle final: public jni::JavaClass<JNumberFormatStyle> {
|
|
21
|
+
public:
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroinput/NumberFormatStyle;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum NumberFormatStyle.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
NumberFormatStyle toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<NumberFormatStyle>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JNumberFormatStyle> fromCpp(NumberFormatStyle value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case NumberFormatStyle::DECIMAL:
|
|
46
|
+
static const auto fieldDECIMAL = clazz->getStaticField<JNumberFormatStyle>("DECIMAL");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldDECIMAL);
|
|
48
|
+
case NumberFormatStyle::CURRENCY:
|
|
49
|
+
static const auto fieldCURRENCY = clazz->getStaticField<JNumberFormatStyle>("CURRENCY");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldCURRENCY);
|
|
51
|
+
case NumberFormatStyle::PERCENT:
|
|
52
|
+
static const auto fieldPERCENT = clazz->getStaticField<JNumberFormatStyle>("PERCENT");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldPERCENT);
|
|
54
|
+
case NumberFormatStyle::UNIT:
|
|
55
|
+
static const auto fieldUNIT = clazz->getStaticField<JNumberFormatStyle>("UNIT");
|
|
56
|
+
return clazz->getStaticFieldValue(fieldUNIT);
|
|
57
|
+
default:
|
|
58
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
59
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
} // namespace margelo::nitro::nitroinput
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNumberFormatUnitDisplay.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 <fbjni/fbjni.h>
|
|
11
|
+
#include "NumberFormatUnitDisplay.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::nitroinput {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "NumberFormatUnitDisplay" and the Kotlin enum "NumberFormatUnitDisplay".
|
|
19
|
+
*/
|
|
20
|
+
struct JNumberFormatUnitDisplay final: public jni::JavaClass<JNumberFormatUnitDisplay> {
|
|
21
|
+
public:
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroinput/NumberFormatUnitDisplay;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum NumberFormatUnitDisplay.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
NumberFormatUnitDisplay toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<NumberFormatUnitDisplay>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JNumberFormatUnitDisplay> fromCpp(NumberFormatUnitDisplay value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case NumberFormatUnitDisplay::SHORT:
|
|
46
|
+
static const auto fieldSHORT = clazz->getStaticField<JNumberFormatUnitDisplay>("SHORT");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldSHORT);
|
|
48
|
+
case NumberFormatUnitDisplay::NARROW:
|
|
49
|
+
static const auto fieldNARROW = clazz->getStaticField<JNumberFormatUnitDisplay>("NARROW");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldNARROW);
|
|
51
|
+
case NumberFormatUnitDisplay::LONG:
|
|
52
|
+
static const auto fieldLONG = clazz->getStaticField<JNumberFormatUnitDisplay>("LONG");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldLONG);
|
|
54
|
+
default:
|
|
55
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
56
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::nitroinput
|
|
@@ -203,6 +203,31 @@ void JHybridNitroInputViewStateUpdater::updateViewProps(jni::alias_ref<jni::JCla
|
|
|
203
203
|
: !newProps->suffixAlign.hasSameValue(oldProps->suffixAlign)) {
|
|
204
204
|
hybridView->setSuffixAlign(newProps->suffixAlign.get());
|
|
205
205
|
}
|
|
206
|
+
if (oldProps == nullptr
|
|
207
|
+
? newProps->letterSpacing.isProvided()
|
|
208
|
+
: !newProps->letterSpacing.hasSameValue(oldProps->letterSpacing)) {
|
|
209
|
+
hybridView->setLetterSpacing(newProps->letterSpacing.get());
|
|
210
|
+
}
|
|
211
|
+
if (oldProps == nullptr
|
|
212
|
+
? newProps->prefixSpacing.isProvided()
|
|
213
|
+
: !newProps->prefixSpacing.hasSameValue(oldProps->prefixSpacing)) {
|
|
214
|
+
hybridView->setPrefixSpacing(newProps->prefixSpacing.get());
|
|
215
|
+
}
|
|
216
|
+
if (oldProps == nullptr
|
|
217
|
+
? newProps->suffixSpacing.isProvided()
|
|
218
|
+
: !newProps->suffixSpacing.hasSameValue(oldProps->suffixSpacing)) {
|
|
219
|
+
hybridView->setSuffixSpacing(newProps->suffixSpacing.get());
|
|
220
|
+
}
|
|
221
|
+
if (oldProps == nullptr
|
|
222
|
+
? newProps->prefixOffset.isProvided()
|
|
223
|
+
: !newProps->prefixOffset.hasSameValue(oldProps->prefixOffset)) {
|
|
224
|
+
hybridView->setPrefixOffset(newProps->prefixOffset.get());
|
|
225
|
+
}
|
|
226
|
+
if (oldProps == nullptr
|
|
227
|
+
? newProps->suffixOffset.isProvided()
|
|
228
|
+
: !newProps->suffixOffset.hasSameValue(oldProps->suffixOffset)) {
|
|
229
|
+
hybridView->setSuffixOffset(newProps->suffixOffset.get());
|
|
230
|
+
}
|
|
206
231
|
if (oldProps == nullptr
|
|
207
232
|
? newProps->placeholder.isProvided()
|
|
208
233
|
: !newProps->placeholder.hasSameValue(oldProps->placeholder)) {
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridNitroNumberViewStateUpdater.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "JHybridNitroNumberViewStateUpdater.hpp"
|
|
9
|
+
#include "views/HybridNitroNumberViewComponent.hpp"
|
|
10
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
11
|
+
#include <react/fabric/StateWrapperImpl.h>
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::nitroinput::views {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
using ConcreteStateData = react::ConcreteState<HybridNitroNumberViewState>;
|
|
17
|
+
|
|
18
|
+
std::shared_ptr<const HybridNitroNumberViewProps> JHybridNitroNumberViewStateUpdater::getPropsFromStateWrapper(
|
|
19
|
+
jni::alias_ref<JStateWrapper::javaobject> stateWrapper) {
|
|
20
|
+
if (stateWrapper.get() == nullptr) {
|
|
21
|
+
return nullptr;
|
|
22
|
+
}
|
|
23
|
+
// Get concrete StateWrapperImpl from passed StateWrapper interface object
|
|
24
|
+
jobject rawStateWrapper = stateWrapper.get();
|
|
25
|
+
if (!stateWrapper->isInstanceOf(react::StateWrapperImpl::javaClassStatic())) [[unlikely]] {
|
|
26
|
+
throw std::runtime_error("StateWrapper is not a StateWrapperImpl");
|
|
27
|
+
}
|
|
28
|
+
auto stateWrapperImpl = jni::alias_ref<react::StateWrapperImpl::javaobject>{
|
|
29
|
+
static_cast<react::StateWrapperImpl::javaobject>(rawStateWrapper)
|
|
30
|
+
};
|
|
31
|
+
std::shared_ptr<const react::State> state = stateWrapperImpl->cthis()->getState();
|
|
32
|
+
if (state == nullptr) {
|
|
33
|
+
return nullptr;
|
|
34
|
+
}
|
|
35
|
+
auto concreteState = std::static_pointer_cast<const ConcreteStateData>(state);
|
|
36
|
+
const HybridNitroNumberViewState& data = concreteState->getData();
|
|
37
|
+
const std::shared_ptr<const HybridNitroNumberViewProps>& props = data.getProps();
|
|
38
|
+
if (props == nullptr) [[unlikely]] {
|
|
39
|
+
throw std::runtime_error("HybridNitroNumberViewState's data doesn't contain any props!");
|
|
40
|
+
}
|
|
41
|
+
return props;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
void JHybridNitroNumberViewStateUpdater::updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
45
|
+
jni::alias_ref<JHybridNitroNumberViewSpec::JavaPart> javaView,
|
|
46
|
+
jni::alias_ref<JStateWrapper::javaobject> newState,
|
|
47
|
+
jni::alias_ref<JStateWrapper::javaobject> oldState) {
|
|
48
|
+
std::shared_ptr<JHybridNitroNumberViewSpec> hybridView = javaView->getJHybridNitroNumberViewSpec();
|
|
49
|
+
std::shared_ptr<const HybridNitroNumberViewProps> newProps = getPropsFromStateWrapper(newState);
|
|
50
|
+
std::shared_ptr<const HybridNitroNumberViewProps> oldProps = getPropsFromStateWrapper(oldState);
|
|
51
|
+
if (newProps == nullptr) [[unlikely]] {
|
|
52
|
+
throw std::runtime_error("Current StateWrapper doesn't contain any props!");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Update only props that differ from the previous State snapshot.
|
|
56
|
+
if (oldProps == nullptr
|
|
57
|
+
? newProps->value.isProvided()
|
|
58
|
+
: !newProps->value.hasSameValue(oldProps->value)) {
|
|
59
|
+
hybridView->setValue(newProps->value.get());
|
|
60
|
+
}
|
|
61
|
+
if (oldProps == nullptr
|
|
62
|
+
? newProps->fractionDigits.isProvided()
|
|
63
|
+
: !newProps->fractionDigits.hasSameValue(oldProps->fractionDigits)) {
|
|
64
|
+
hybridView->setFractionDigits(newProps->fractionDigits.get());
|
|
65
|
+
}
|
|
66
|
+
if (oldProps == nullptr
|
|
67
|
+
? newProps->minimumIntegerDigits.isProvided()
|
|
68
|
+
: !newProps->minimumIntegerDigits.hasSameValue(oldProps->minimumIntegerDigits)) {
|
|
69
|
+
hybridView->setMinimumIntegerDigits(newProps->minimumIntegerDigits.get());
|
|
70
|
+
}
|
|
71
|
+
if (oldProps == nullptr
|
|
72
|
+
? newProps->groupingSeparator.isProvided()
|
|
73
|
+
: !newProps->groupingSeparator.hasSameValue(oldProps->groupingSeparator)) {
|
|
74
|
+
hybridView->setGroupingSeparator(newProps->groupingSeparator.get());
|
|
75
|
+
}
|
|
76
|
+
if (oldProps == nullptr
|
|
77
|
+
? newProps->decimalSeparator.isProvided()
|
|
78
|
+
: !newProps->decimalSeparator.hasSameValue(oldProps->decimalSeparator)) {
|
|
79
|
+
hybridView->setDecimalSeparator(newProps->decimalSeparator.get());
|
|
80
|
+
}
|
|
81
|
+
if (oldProps == nullptr
|
|
82
|
+
? newProps->prefix.isProvided()
|
|
83
|
+
: !newProps->prefix.hasSameValue(oldProps->prefix)) {
|
|
84
|
+
hybridView->setPrefix(newProps->prefix.get());
|
|
85
|
+
}
|
|
86
|
+
if (oldProps == nullptr
|
|
87
|
+
? newProps->suffix.isProvided()
|
|
88
|
+
: !newProps->suffix.hasSameValue(oldProps->suffix)) {
|
|
89
|
+
hybridView->setSuffix(newProps->suffix.get());
|
|
90
|
+
}
|
|
91
|
+
if (oldProps == nullptr
|
|
92
|
+
? newProps->duration.isProvided()
|
|
93
|
+
: !newProps->duration.hasSameValue(oldProps->duration)) {
|
|
94
|
+
hybridView->setDuration(newProps->duration.get());
|
|
95
|
+
}
|
|
96
|
+
if (oldProps == nullptr
|
|
97
|
+
? newProps->easing.isProvided()
|
|
98
|
+
: !newProps->easing.hasSameValue(oldProps->easing)) {
|
|
99
|
+
hybridView->setEasing(newProps->easing.get());
|
|
100
|
+
}
|
|
101
|
+
if (oldProps == nullptr
|
|
102
|
+
? newProps->bounce.isProvided()
|
|
103
|
+
: !newProps->bounce.hasSameValue(oldProps->bounce)) {
|
|
104
|
+
hybridView->setBounce(newProps->bounce.get());
|
|
105
|
+
}
|
|
106
|
+
if (oldProps == nullptr
|
|
107
|
+
? newProps->stagger.isProvided()
|
|
108
|
+
: !newProps->stagger.hasSameValue(oldProps->stagger)) {
|
|
109
|
+
hybridView->setStagger(newProps->stagger.get());
|
|
110
|
+
}
|
|
111
|
+
if (oldProps == nullptr
|
|
112
|
+
? newProps->transition.isProvided()
|
|
113
|
+
: !newProps->transition.hasSameValue(oldProps->transition)) {
|
|
114
|
+
hybridView->setTransition(newProps->transition.get());
|
|
115
|
+
}
|
|
116
|
+
if (oldProps == nullptr
|
|
117
|
+
? newProps->flashUpColor.isProvided()
|
|
118
|
+
: !newProps->flashUpColor.hasSameValue(oldProps->flashUpColor)) {
|
|
119
|
+
hybridView->setFlashUpColor(newProps->flashUpColor.get());
|
|
120
|
+
}
|
|
121
|
+
if (oldProps == nullptr
|
|
122
|
+
? newProps->flashDownColor.isProvided()
|
|
123
|
+
: !newProps->flashDownColor.hasSameValue(oldProps->flashDownColor)) {
|
|
124
|
+
hybridView->setFlashDownColor(newProps->flashDownColor.get());
|
|
125
|
+
}
|
|
126
|
+
if (oldProps == nullptr
|
|
127
|
+
? newProps->flashDuration.isProvided()
|
|
128
|
+
: !newProps->flashDuration.hasSameValue(oldProps->flashDuration)) {
|
|
129
|
+
hybridView->setFlashDuration(newProps->flashDuration.get());
|
|
130
|
+
}
|
|
131
|
+
if (oldProps == nullptr
|
|
132
|
+
? newProps->popOnChange.isProvided()
|
|
133
|
+
: !newProps->popOnChange.hasSameValue(oldProps->popOnChange)) {
|
|
134
|
+
hybridView->setPopOnChange(newProps->popOnChange.get());
|
|
135
|
+
}
|
|
136
|
+
if (oldProps == nullptr
|
|
137
|
+
? newProps->rollDirection.isProvided()
|
|
138
|
+
: !newProps->rollDirection.hasSameValue(oldProps->rollDirection)) {
|
|
139
|
+
hybridView->setRollDirection(newProps->rollDirection.get());
|
|
140
|
+
}
|
|
141
|
+
if (oldProps == nullptr
|
|
142
|
+
? newProps->revealState.isProvided()
|
|
143
|
+
: !newProps->revealState.hasSameValue(oldProps->revealState)) {
|
|
144
|
+
hybridView->setRevealState(newProps->revealState.get());
|
|
145
|
+
}
|
|
146
|
+
if (oldProps == nullptr
|
|
147
|
+
? newProps->revealStyle.isProvided()
|
|
148
|
+
: !newProps->revealStyle.hasSameValue(oldProps->revealStyle)) {
|
|
149
|
+
hybridView->setRevealStyle(newProps->revealStyle.get());
|
|
150
|
+
}
|
|
151
|
+
if (oldProps == nullptr
|
|
152
|
+
? newProps->revealDuration.isProvided()
|
|
153
|
+
: !newProps->revealDuration.hasSameValue(oldProps->revealDuration)) {
|
|
154
|
+
hybridView->setRevealDuration(newProps->revealDuration.get());
|
|
155
|
+
}
|
|
156
|
+
if (oldProps == nullptr
|
|
157
|
+
? newProps->revealBounce.isProvided()
|
|
158
|
+
: !newProps->revealBounce.hasSameValue(oldProps->revealBounce)) {
|
|
159
|
+
hybridView->setRevealBounce(newProps->revealBounce.get());
|
|
160
|
+
}
|
|
161
|
+
if (oldProps == nullptr
|
|
162
|
+
? newProps->revealGrow.isProvided()
|
|
163
|
+
: !newProps->revealGrow.hasSameValue(oldProps->revealGrow)) {
|
|
164
|
+
hybridView->setRevealGrow(newProps->revealGrow.get());
|
|
165
|
+
}
|
|
166
|
+
if (oldProps == nullptr
|
|
167
|
+
? newProps->revealStagger.isProvided()
|
|
168
|
+
: !newProps->revealStagger.hasSameValue(oldProps->revealStagger)) {
|
|
169
|
+
hybridView->setRevealStagger(newProps->revealStagger.get());
|
|
170
|
+
}
|
|
171
|
+
if (oldProps == nullptr
|
|
172
|
+
? newProps->revealMilestones.isProvided()
|
|
173
|
+
: !newProps->revealMilestones.hasSameValue(oldProps->revealMilestones)) {
|
|
174
|
+
hybridView->setRevealMilestones(newProps->revealMilestones.get());
|
|
175
|
+
}
|
|
176
|
+
if (oldProps == nullptr
|
|
177
|
+
? newProps->revealMilestoneHold.isProvided()
|
|
178
|
+
: !newProps->revealMilestoneHold.hasSameValue(oldProps->revealMilestoneHold)) {
|
|
179
|
+
hybridView->setRevealMilestoneHold(newProps->revealMilestoneHold.get());
|
|
180
|
+
}
|
|
181
|
+
if (oldProps == nullptr
|
|
182
|
+
? newProps->loading.isProvided()
|
|
183
|
+
: !newProps->loading.hasSameValue(oldProps->loading)) {
|
|
184
|
+
hybridView->setLoading(newProps->loading.get());
|
|
185
|
+
}
|
|
186
|
+
if (oldProps == nullptr
|
|
187
|
+
? newProps->shimmerColor.isProvided()
|
|
188
|
+
: !newProps->shimmerColor.hasSameValue(oldProps->shimmerColor)) {
|
|
189
|
+
hybridView->setShimmerColor(newProps->shimmerColor.get());
|
|
190
|
+
}
|
|
191
|
+
if (oldProps == nullptr
|
|
192
|
+
? newProps->shimmerDuration.isProvided()
|
|
193
|
+
: !newProps->shimmerDuration.hasSameValue(oldProps->shimmerDuration)) {
|
|
194
|
+
hybridView->setShimmerDuration(newProps->shimmerDuration.get());
|
|
195
|
+
}
|
|
196
|
+
if (oldProps == nullptr
|
|
197
|
+
? newProps->fontSize.isProvided()
|
|
198
|
+
: !newProps->fontSize.hasSameValue(oldProps->fontSize)) {
|
|
199
|
+
hybridView->setFontSize(newProps->fontSize.get());
|
|
200
|
+
}
|
|
201
|
+
if (oldProps == nullptr
|
|
202
|
+
? newProps->prefixFontSize.isProvided()
|
|
203
|
+
: !newProps->prefixFontSize.hasSameValue(oldProps->prefixFontSize)) {
|
|
204
|
+
hybridView->setPrefixFontSize(newProps->prefixFontSize.get());
|
|
205
|
+
}
|
|
206
|
+
if (oldProps == nullptr
|
|
207
|
+
? newProps->suffixFontSize.isProvided()
|
|
208
|
+
: !newProps->suffixFontSize.hasSameValue(oldProps->suffixFontSize)) {
|
|
209
|
+
hybridView->setSuffixFontSize(newProps->suffixFontSize.get());
|
|
210
|
+
}
|
|
211
|
+
if (oldProps == nullptr
|
|
212
|
+
? newProps->affixAlign.isProvided()
|
|
213
|
+
: !newProps->affixAlign.hasSameValue(oldProps->affixAlign)) {
|
|
214
|
+
hybridView->setAffixAlign(newProps->affixAlign.get());
|
|
215
|
+
}
|
|
216
|
+
if (oldProps == nullptr
|
|
217
|
+
? newProps->prefixAlign.isProvided()
|
|
218
|
+
: !newProps->prefixAlign.hasSameValue(oldProps->prefixAlign)) {
|
|
219
|
+
hybridView->setPrefixAlign(newProps->prefixAlign.get());
|
|
220
|
+
}
|
|
221
|
+
if (oldProps == nullptr
|
|
222
|
+
? newProps->suffixAlign.isProvided()
|
|
223
|
+
: !newProps->suffixAlign.hasSameValue(oldProps->suffixAlign)) {
|
|
224
|
+
hybridView->setSuffixAlign(newProps->suffixAlign.get());
|
|
225
|
+
}
|
|
226
|
+
if (oldProps == nullptr
|
|
227
|
+
? newProps->letterSpacing.isProvided()
|
|
228
|
+
: !newProps->letterSpacing.hasSameValue(oldProps->letterSpacing)) {
|
|
229
|
+
hybridView->setLetterSpacing(newProps->letterSpacing.get());
|
|
230
|
+
}
|
|
231
|
+
if (oldProps == nullptr
|
|
232
|
+
? newProps->prefixSpacing.isProvided()
|
|
233
|
+
: !newProps->prefixSpacing.hasSameValue(oldProps->prefixSpacing)) {
|
|
234
|
+
hybridView->setPrefixSpacing(newProps->prefixSpacing.get());
|
|
235
|
+
}
|
|
236
|
+
if (oldProps == nullptr
|
|
237
|
+
? newProps->suffixSpacing.isProvided()
|
|
238
|
+
: !newProps->suffixSpacing.hasSameValue(oldProps->suffixSpacing)) {
|
|
239
|
+
hybridView->setSuffixSpacing(newProps->suffixSpacing.get());
|
|
240
|
+
}
|
|
241
|
+
if (oldProps == nullptr
|
|
242
|
+
? newProps->prefixOffset.isProvided()
|
|
243
|
+
: !newProps->prefixOffset.hasSameValue(oldProps->prefixOffset)) {
|
|
244
|
+
hybridView->setPrefixOffset(newProps->prefixOffset.get());
|
|
245
|
+
}
|
|
246
|
+
if (oldProps == nullptr
|
|
247
|
+
? newProps->suffixOffset.isProvided()
|
|
248
|
+
: !newProps->suffixOffset.hasSameValue(oldProps->suffixOffset)) {
|
|
249
|
+
hybridView->setSuffixOffset(newProps->suffixOffset.get());
|
|
250
|
+
}
|
|
251
|
+
if (oldProps == nullptr
|
|
252
|
+
? newProps->tabularNums.isProvided()
|
|
253
|
+
: !newProps->tabularNums.hasSameValue(oldProps->tabularNums)) {
|
|
254
|
+
hybridView->setTabularNums(newProps->tabularNums.get());
|
|
255
|
+
}
|
|
256
|
+
if (oldProps == nullptr
|
|
257
|
+
? newProps->adjustsFontSizeToFit.isProvided()
|
|
258
|
+
: !newProps->adjustsFontSizeToFit.hasSameValue(oldProps->adjustsFontSizeToFit)) {
|
|
259
|
+
hybridView->setAdjustsFontSizeToFit(newProps->adjustsFontSizeToFit.get());
|
|
260
|
+
}
|
|
261
|
+
if (oldProps == nullptr
|
|
262
|
+
? newProps->minimumFontScale.isProvided()
|
|
263
|
+
: !newProps->minimumFontScale.hasSameValue(oldProps->minimumFontScale)) {
|
|
264
|
+
hybridView->setMinimumFontScale(newProps->minimumFontScale.get());
|
|
265
|
+
}
|
|
266
|
+
if (oldProps == nullptr
|
|
267
|
+
? newProps->allowFontScaling.isProvided()
|
|
268
|
+
: !newProps->allowFontScaling.hasSameValue(oldProps->allowFontScaling)) {
|
|
269
|
+
hybridView->setAllowFontScaling(newProps->allowFontScaling.get());
|
|
270
|
+
}
|
|
271
|
+
if (oldProps == nullptr
|
|
272
|
+
? newProps->maxFontSizeMultiplier.isProvided()
|
|
273
|
+
: !newProps->maxFontSizeMultiplier.hasSameValue(oldProps->maxFontSizeMultiplier)) {
|
|
274
|
+
hybridView->setMaxFontSizeMultiplier(newProps->maxFontSizeMultiplier.get());
|
|
275
|
+
}
|
|
276
|
+
if (oldProps == nullptr
|
|
277
|
+
? newProps->fontWeight.isProvided()
|
|
278
|
+
: !newProps->fontWeight.hasSameValue(oldProps->fontWeight)) {
|
|
279
|
+
hybridView->setFontWeight(newProps->fontWeight.get());
|
|
280
|
+
}
|
|
281
|
+
if (oldProps == nullptr
|
|
282
|
+
? newProps->fontFamily.isProvided()
|
|
283
|
+
: !newProps->fontFamily.hasSameValue(oldProps->fontFamily)) {
|
|
284
|
+
hybridView->setFontFamily(newProps->fontFamily.get());
|
|
285
|
+
}
|
|
286
|
+
if (oldProps == nullptr
|
|
287
|
+
? newProps->color.isProvided()
|
|
288
|
+
: !newProps->color.hasSameValue(oldProps->color)) {
|
|
289
|
+
hybridView->setColor(newProps->color.get());
|
|
290
|
+
}
|
|
291
|
+
if (oldProps == nullptr
|
|
292
|
+
? newProps->textAlign.isProvided()
|
|
293
|
+
: !newProps->textAlign.hasSameValue(oldProps->textAlign)) {
|
|
294
|
+
hybridView->setTextAlign(newProps->textAlign.get());
|
|
295
|
+
}
|
|
296
|
+
if (oldProps == nullptr
|
|
297
|
+
? newProps->rightToLeft.isProvided()
|
|
298
|
+
: !newProps->rightToLeft.hasSameValue(oldProps->rightToLeft)) {
|
|
299
|
+
hybridView->setRightToLeft(newProps->rightToLeft.get());
|
|
300
|
+
}
|
|
301
|
+
if (oldProps == nullptr
|
|
302
|
+
? newProps->onSizeChange.isProvided()
|
|
303
|
+
: !newProps->onSizeChange.hasSameValue(oldProps->onSizeChange)) {
|
|
304
|
+
hybridView->setOnSizeChange(newProps->onSizeChange.get());
|
|
305
|
+
}
|
|
306
|
+
if (oldProps == nullptr
|
|
307
|
+
? newProps->onRevealEnd.isProvided()
|
|
308
|
+
: !newProps->onRevealEnd.hasSameValue(oldProps->onRevealEnd)) {
|
|
309
|
+
hybridView->setOnRevealEnd(newProps->onRevealEnd.get());
|
|
310
|
+
}
|
|
311
|
+
if (oldProps == nullptr
|
|
312
|
+
? newProps->onRevealMilestone.isProvided()
|
|
313
|
+
: !newProps->onRevealMilestone.hasSameValue(oldProps->onRevealMilestone)) {
|
|
314
|
+
hybridView->setOnRevealMilestone(newProps->onRevealMilestone.get());
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// Update hybridRef if it changed
|
|
318
|
+
if (oldProps == nullptr
|
|
319
|
+
? newProps->hybridRef.isProvided()
|
|
320
|
+
: !newProps->hybridRef.hasSameValue(oldProps->hybridRef)) {
|
|
321
|
+
// hybridRef changed - call it with new this
|
|
322
|
+
const auto& maybeFunc = newProps->hybridRef.get();
|
|
323
|
+
if (maybeFunc.has_value()) {
|
|
324
|
+
maybeFunc.value()(hybridView);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
} // namespace margelo::nitro::nitroinput::views
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridNitroNumberViewStateUpdater.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
|
+
#ifndef RN_SERIALIZABLE_STATE
|
|
11
|
+
#error NitroInput was compiled without the 'RN_SERIALIZABLE_STATE' flag. This flag is required for Nitro Views - set it in your CMakeLists!
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#include <fbjni/fbjni.h>
|
|
15
|
+
#include <react/fabric/CoreComponentsRegistry.h>
|
|
16
|
+
#include <react/fabric/StateWrapperImpl.h>
|
|
17
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
18
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
19
|
+
#include <NitroModules/JStateWrapper.hpp>
|
|
20
|
+
#include "JHybridNitroNumberViewSpec.hpp"
|
|
21
|
+
#include "views/HybridNitroNumberViewComponent.hpp"
|
|
22
|
+
|
|
23
|
+
namespace margelo::nitro::nitroinput::views {
|
|
24
|
+
|
|
25
|
+
using namespace facebook;
|
|
26
|
+
|
|
27
|
+
class JHybridNitroNumberViewStateUpdater final: public jni::JavaClass<JHybridNitroNumberViewStateUpdater> {
|
|
28
|
+
public:
|
|
29
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroinput/views/HybridNitroNumberViewStateUpdater;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
static void updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
33
|
+
jni::alias_ref<JHybridNitroNumberViewSpec::JavaPart> view,
|
|
34
|
+
jni::alias_ref<JStateWrapper::javaobject> newState,
|
|
35
|
+
jni::alias_ref<JStateWrapper::javaobject> oldState);
|
|
36
|
+
|
|
37
|
+
private:
|
|
38
|
+
static std::shared_ptr<const HybridNitroNumberViewProps> getPropsFromStateWrapper(
|
|
39
|
+
jni::alias_ref<JStateWrapper::javaobject> stateWrapper);
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
static void registerNatives() {
|
|
43
|
+
// Register JNI calls
|
|
44
|
+
javaClassStatic()->registerNatives({
|
|
45
|
+
makeNativeMethod("updateViewProps", JHybridNitroNumberViewStateUpdater::updateViewProps),
|
|
46
|
+
});
|
|
47
|
+
// Register React Native view component descriptor
|
|
48
|
+
auto provider = react::concreteComponentDescriptorProvider<HybridNitroNumberViewComponentDescriptor>();
|
|
49
|
+
auto providerRegistry = react::CoreComponentsRegistry::sharedProviderRegistry();
|
|
50
|
+
providerRegistry->add(provider);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::nitroinput::views
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void.kt
|
|
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
|
+
package com.margelo.nitro.nitroinput
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript callback `() => void`.
|
|
17
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
+
fun interface Func_void: () -> Unit {
|
|
24
|
+
/**
|
|
25
|
+
* Call the given JS callback.
|
|
26
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
override fun invoke(): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `() => void`.
|
|
35
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
36
|
+
* The callback might be coming from JS.
|
|
37
|
+
*/
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
@Suppress(
|
|
41
|
+
"KotlinJniMissingFunction", "unused",
|
|
42
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
|
+
)
|
|
45
|
+
class Func_void_cxx: Func_void {
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
private val mHybridData: HybridData
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
private constructor(hybridData: HybridData) {
|
|
53
|
+
mHybridData = hybridData
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
override fun invoke(): Unit
|
|
59
|
+
= invoke_cxx()
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `() => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `() -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_java(private val function: () -> Unit): Func_void {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(): Unit {
|
|
76
|
+
return this.function()
|
|
77
|
+
}
|
|
78
|
+
}
|