@onekeyfe/react-native-auto-size-input 1.0.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.
Files changed (90) hide show
  1. package/AutoSizeInput.podspec +29 -0
  2. package/android/CMakeLists.txt +24 -0
  3. package/android/build.gradle +128 -0
  4. package/android/src/main/AndroidManifest.xml +2 -0
  5. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  6. package/android/src/main/java/com/margelo/nitro/autosizeinput/AutoSizeInput.kt +565 -0
  7. package/android/src/main/java/com/margelo/nitro/autosizeinput/AutoSizeInputPackage.kt +29 -0
  8. package/ios/AutoSizeInput.swift +620 -0
  9. package/lib/module/AutoSizeInput.nitro.js +4 -0
  10. package/lib/module/AutoSizeInput.nitro.js.map +1 -0
  11. package/lib/module/index.js +6 -0
  12. package/lib/module/index.js.map +1 -0
  13. package/lib/module/package.json +1 -0
  14. package/lib/nitrogen/generated/android/autosizeinput+autolinking.cmake +83 -0
  15. package/lib/nitrogen/generated/android/autosizeinput+autolinking.gradle +27 -0
  16. package/lib/nitrogen/generated/android/autosizeinputOnLoad.cpp +50 -0
  17. package/lib/nitrogen/generated/android/autosizeinputOnLoad.hpp +25 -0
  18. package/lib/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
  19. package/lib/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
  20. package/lib/nitrogen/generated/android/c++/JHybridAutoSizeInputSpec.cpp +317 -0
  21. package/lib/nitrogen/generated/android/c++/JHybridAutoSizeInputSpec.hpp +117 -0
  22. package/lib/nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.cpp +156 -0
  23. package/lib/nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.hpp +49 -0
  24. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/Func_void.kt +80 -0
  25. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/Func_void_std__string.kt +80 -0
  26. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/HybridAutoSizeInputSpec.kt +239 -0
  27. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/autosizeinputOnLoad.kt +35 -0
  28. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/views/HybridAutoSizeInputManager.kt +50 -0
  29. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/views/HybridAutoSizeInputStateUpdater.kt +23 -0
  30. package/lib/nitrogen/generated/ios/AutoSizeInput+autolinking.rb +60 -0
  31. package/lib/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Bridge.cpp +49 -0
  32. package/lib/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Bridge.hpp +173 -0
  33. package/lib/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Umbrella.hpp +46 -0
  34. package/lib/nitrogen/generated/ios/AutoSizeInputAutolinking.mm +33 -0
  35. package/lib/nitrogen/generated/ios/AutoSizeInputAutolinking.swift +25 -0
  36. package/lib/nitrogen/generated/ios/c++/HybridAutoSizeInputSpecSwift.cpp +11 -0
  37. package/lib/nitrogen/generated/ios/c++/HybridAutoSizeInputSpecSwift.hpp +263 -0
  38. package/lib/nitrogen/generated/ios/c++/views/HybridAutoSizeInputComponent.mm +221 -0
  39. package/lib/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  40. package/lib/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
  41. package/lib/nitrogen/generated/ios/swift/HybridAutoSizeInputSpec.swift +82 -0
  42. package/lib/nitrogen/generated/ios/swift/HybridAutoSizeInputSpec_cxx.swift +764 -0
  43. package/lib/nitrogen/generated/shared/c++/HybridAutoSizeInputSpec.cpp +74 -0
  44. package/lib/nitrogen/generated/shared/c++/HybridAutoSizeInputSpec.hpp +116 -0
  45. package/lib/nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.cpp +387 -0
  46. package/lib/nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.hpp +133 -0
  47. package/lib/nitrogen/generated/shared/json/AutoSizeInputConfig.json +35 -0
  48. package/lib/typescript/package.json +1 -0
  49. package/lib/typescript/src/AutoSizeInput.nitro.d.ts +35 -0
  50. package/lib/typescript/src/AutoSizeInput.nitro.d.ts.map +1 -0
  51. package/lib/typescript/src/index.d.ts +4 -0
  52. package/lib/typescript/src/index.d.ts.map +1 -0
  53. package/nitro.json +17 -0
  54. package/nitrogen/generated/android/autosizeinput+autolinking.cmake +83 -0
  55. package/nitrogen/generated/android/autosizeinput+autolinking.gradle +27 -0
  56. package/nitrogen/generated/android/autosizeinputOnLoad.cpp +50 -0
  57. package/nitrogen/generated/android/autosizeinputOnLoad.hpp +25 -0
  58. package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
  59. package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
  60. package/nitrogen/generated/android/c++/JHybridAutoSizeInputSpec.cpp +317 -0
  61. package/nitrogen/generated/android/c++/JHybridAutoSizeInputSpec.hpp +117 -0
  62. package/nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.cpp +156 -0
  63. package/nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.hpp +49 -0
  64. package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/Func_void.kt +80 -0
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/Func_void_std__string.kt +80 -0
  66. package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/HybridAutoSizeInputSpec.kt +239 -0
  67. package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/autosizeinputOnLoad.kt +35 -0
  68. package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/views/HybridAutoSizeInputManager.kt +50 -0
  69. package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/views/HybridAutoSizeInputStateUpdater.kt +23 -0
  70. package/nitrogen/generated/ios/AutoSizeInput+autolinking.rb +60 -0
  71. package/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Bridge.cpp +49 -0
  72. package/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Bridge.hpp +173 -0
  73. package/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Umbrella.hpp +46 -0
  74. package/nitrogen/generated/ios/AutoSizeInputAutolinking.mm +33 -0
  75. package/nitrogen/generated/ios/AutoSizeInputAutolinking.swift +25 -0
  76. package/nitrogen/generated/ios/c++/HybridAutoSizeInputSpecSwift.cpp +11 -0
  77. package/nitrogen/generated/ios/c++/HybridAutoSizeInputSpecSwift.hpp +263 -0
  78. package/nitrogen/generated/ios/c++/views/HybridAutoSizeInputComponent.mm +221 -0
  79. package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  80. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
  81. package/nitrogen/generated/ios/swift/HybridAutoSizeInputSpec.swift +82 -0
  82. package/nitrogen/generated/ios/swift/HybridAutoSizeInputSpec_cxx.swift +764 -0
  83. package/nitrogen/generated/shared/c++/HybridAutoSizeInputSpec.cpp +74 -0
  84. package/nitrogen/generated/shared/c++/HybridAutoSizeInputSpec.hpp +116 -0
  85. package/nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.cpp +387 -0
  86. package/nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.hpp +133 -0
  87. package/nitrogen/generated/shared/json/AutoSizeInputConfig.json +35 -0
  88. package/package.json +170 -0
  89. package/src/AutoSizeInput.nitro.ts +56 -0
  90. package/src/index.tsx +13 -0
@@ -0,0 +1,74 @@
1
+ ///
2
+ /// HybridAutoSizeInputSpec.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "HybridAutoSizeInputSpec.hpp"
9
+
10
+ namespace margelo::nitro::autosizeinput {
11
+
12
+ void HybridAutoSizeInputSpec::loadHybridMethods() {
13
+ // load base methods/properties
14
+ HybridObject::loadHybridMethods();
15
+ // load custom methods/properties
16
+ registerHybrids(this, [](Prototype& prototype) {
17
+ prototype.registerHybridGetter("text", &HybridAutoSizeInputSpec::getText);
18
+ prototype.registerHybridSetter("text", &HybridAutoSizeInputSpec::setText);
19
+ prototype.registerHybridGetter("prefix", &HybridAutoSizeInputSpec::getPrefix);
20
+ prototype.registerHybridSetter("prefix", &HybridAutoSizeInputSpec::setPrefix);
21
+ prototype.registerHybridGetter("suffix", &HybridAutoSizeInputSpec::getSuffix);
22
+ prototype.registerHybridSetter("suffix", &HybridAutoSizeInputSpec::setSuffix);
23
+ prototype.registerHybridGetter("placeholder", &HybridAutoSizeInputSpec::getPlaceholder);
24
+ prototype.registerHybridSetter("placeholder", &HybridAutoSizeInputSpec::setPlaceholder);
25
+ prototype.registerHybridGetter("fontSize", &HybridAutoSizeInputSpec::getFontSize);
26
+ prototype.registerHybridSetter("fontSize", &HybridAutoSizeInputSpec::setFontSize);
27
+ prototype.registerHybridGetter("minFontSize", &HybridAutoSizeInputSpec::getMinFontSize);
28
+ prototype.registerHybridSetter("minFontSize", &HybridAutoSizeInputSpec::setMinFontSize);
29
+ prototype.registerHybridGetter("multiline", &HybridAutoSizeInputSpec::getMultiline);
30
+ prototype.registerHybridSetter("multiline", &HybridAutoSizeInputSpec::setMultiline);
31
+ prototype.registerHybridGetter("maxNumberOfLines", &HybridAutoSizeInputSpec::getMaxNumberOfLines);
32
+ prototype.registerHybridSetter("maxNumberOfLines", &HybridAutoSizeInputSpec::setMaxNumberOfLines);
33
+ prototype.registerHybridGetter("textColor", &HybridAutoSizeInputSpec::getTextColor);
34
+ prototype.registerHybridSetter("textColor", &HybridAutoSizeInputSpec::setTextColor);
35
+ prototype.registerHybridGetter("prefixColor", &HybridAutoSizeInputSpec::getPrefixColor);
36
+ prototype.registerHybridSetter("prefixColor", &HybridAutoSizeInputSpec::setPrefixColor);
37
+ prototype.registerHybridGetter("suffixColor", &HybridAutoSizeInputSpec::getSuffixColor);
38
+ prototype.registerHybridSetter("suffixColor", &HybridAutoSizeInputSpec::setSuffixColor);
39
+ prototype.registerHybridGetter("placeholderColor", &HybridAutoSizeInputSpec::getPlaceholderColor);
40
+ prototype.registerHybridSetter("placeholderColor", &HybridAutoSizeInputSpec::setPlaceholderColor);
41
+ prototype.registerHybridGetter("textAlign", &HybridAutoSizeInputSpec::getTextAlign);
42
+ prototype.registerHybridSetter("textAlign", &HybridAutoSizeInputSpec::setTextAlign);
43
+ prototype.registerHybridGetter("fontFamily", &HybridAutoSizeInputSpec::getFontFamily);
44
+ prototype.registerHybridSetter("fontFamily", &HybridAutoSizeInputSpec::setFontFamily);
45
+ prototype.registerHybridGetter("fontWeight", &HybridAutoSizeInputSpec::getFontWeight);
46
+ prototype.registerHybridSetter("fontWeight", &HybridAutoSizeInputSpec::setFontWeight);
47
+ prototype.registerHybridGetter("editable", &HybridAutoSizeInputSpec::getEditable);
48
+ prototype.registerHybridSetter("editable", &HybridAutoSizeInputSpec::setEditable);
49
+ prototype.registerHybridGetter("keyboardType", &HybridAutoSizeInputSpec::getKeyboardType);
50
+ prototype.registerHybridSetter("keyboardType", &HybridAutoSizeInputSpec::setKeyboardType);
51
+ prototype.registerHybridGetter("returnKeyType", &HybridAutoSizeInputSpec::getReturnKeyType);
52
+ prototype.registerHybridSetter("returnKeyType", &HybridAutoSizeInputSpec::setReturnKeyType);
53
+ prototype.registerHybridGetter("autoCorrect", &HybridAutoSizeInputSpec::getAutoCorrect);
54
+ prototype.registerHybridSetter("autoCorrect", &HybridAutoSizeInputSpec::setAutoCorrect);
55
+ prototype.registerHybridGetter("autoCapitalize", &HybridAutoSizeInputSpec::getAutoCapitalize);
56
+ prototype.registerHybridSetter("autoCapitalize", &HybridAutoSizeInputSpec::setAutoCapitalize);
57
+ prototype.registerHybridGetter("selectionColor", &HybridAutoSizeInputSpec::getSelectionColor);
58
+ prototype.registerHybridSetter("selectionColor", &HybridAutoSizeInputSpec::setSelectionColor);
59
+ prototype.registerHybridGetter("prefixMarginRight", &HybridAutoSizeInputSpec::getPrefixMarginRight);
60
+ prototype.registerHybridSetter("prefixMarginRight", &HybridAutoSizeInputSpec::setPrefixMarginRight);
61
+ prototype.registerHybridGetter("suffixMarginLeft", &HybridAutoSizeInputSpec::getSuffixMarginLeft);
62
+ prototype.registerHybridSetter("suffixMarginLeft", &HybridAutoSizeInputSpec::setSuffixMarginLeft);
63
+ prototype.registerHybridGetter("onChangeText", &HybridAutoSizeInputSpec::getOnChangeText);
64
+ prototype.registerHybridSetter("onChangeText", &HybridAutoSizeInputSpec::setOnChangeText);
65
+ prototype.registerHybridGetter("onFocus", &HybridAutoSizeInputSpec::getOnFocus);
66
+ prototype.registerHybridSetter("onFocus", &HybridAutoSizeInputSpec::setOnFocus);
67
+ prototype.registerHybridGetter("onBlur", &HybridAutoSizeInputSpec::getOnBlur);
68
+ prototype.registerHybridSetter("onBlur", &HybridAutoSizeInputSpec::setOnBlur);
69
+ prototype.registerHybridMethod("focus", &HybridAutoSizeInputSpec::focus);
70
+ prototype.registerHybridMethod("blur", &HybridAutoSizeInputSpec::blur);
71
+ });
72
+ }
73
+
74
+ } // namespace margelo::nitro::autosizeinput
@@ -0,0 +1,116 @@
1
+ ///
2
+ /// HybridAutoSizeInputSpec.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/HybridObject.hpp>)
11
+ #include <NitroModules/HybridObject.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+
16
+
17
+
18
+ #include <string>
19
+ #include <optional>
20
+ #include <functional>
21
+
22
+ namespace margelo::nitro::autosizeinput {
23
+
24
+ using namespace margelo::nitro;
25
+
26
+ /**
27
+ * An abstract base class for `AutoSizeInput`
28
+ * Inherit this class to create instances of `HybridAutoSizeInputSpec` in C++.
29
+ * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
30
+ * @example
31
+ * ```cpp
32
+ * class HybridAutoSizeInput: public HybridAutoSizeInputSpec {
33
+ * public:
34
+ * HybridAutoSizeInput(...): HybridObject(TAG) { ... }
35
+ * // ...
36
+ * };
37
+ * ```
38
+ */
39
+ class HybridAutoSizeInputSpec: public virtual HybridObject {
40
+ public:
41
+ // Constructor
42
+ explicit HybridAutoSizeInputSpec(): HybridObject(TAG) { }
43
+
44
+ // Destructor
45
+ ~HybridAutoSizeInputSpec() override = default;
46
+
47
+ public:
48
+ // Properties
49
+ virtual std::optional<std::string> getText() = 0;
50
+ virtual void setText(const std::optional<std::string>& text) = 0;
51
+ virtual std::optional<std::string> getPrefix() = 0;
52
+ virtual void setPrefix(const std::optional<std::string>& prefix) = 0;
53
+ virtual std::optional<std::string> getSuffix() = 0;
54
+ virtual void setSuffix(const std::optional<std::string>& suffix) = 0;
55
+ virtual std::optional<std::string> getPlaceholder() = 0;
56
+ virtual void setPlaceholder(const std::optional<std::string>& placeholder) = 0;
57
+ virtual std::optional<double> getFontSize() = 0;
58
+ virtual void setFontSize(std::optional<double> fontSize) = 0;
59
+ virtual std::optional<double> getMinFontSize() = 0;
60
+ virtual void setMinFontSize(std::optional<double> minFontSize) = 0;
61
+ virtual std::optional<bool> getMultiline() = 0;
62
+ virtual void setMultiline(std::optional<bool> multiline) = 0;
63
+ virtual std::optional<double> getMaxNumberOfLines() = 0;
64
+ virtual void setMaxNumberOfLines(std::optional<double> maxNumberOfLines) = 0;
65
+ virtual std::optional<std::string> getTextColor() = 0;
66
+ virtual void setTextColor(const std::optional<std::string>& textColor) = 0;
67
+ virtual std::optional<std::string> getPrefixColor() = 0;
68
+ virtual void setPrefixColor(const std::optional<std::string>& prefixColor) = 0;
69
+ virtual std::optional<std::string> getSuffixColor() = 0;
70
+ virtual void setSuffixColor(const std::optional<std::string>& suffixColor) = 0;
71
+ virtual std::optional<std::string> getPlaceholderColor() = 0;
72
+ virtual void setPlaceholderColor(const std::optional<std::string>& placeholderColor) = 0;
73
+ virtual std::optional<std::string> getTextAlign() = 0;
74
+ virtual void setTextAlign(const std::optional<std::string>& textAlign) = 0;
75
+ virtual std::optional<std::string> getFontFamily() = 0;
76
+ virtual void setFontFamily(const std::optional<std::string>& fontFamily) = 0;
77
+ virtual std::optional<std::string> getFontWeight() = 0;
78
+ virtual void setFontWeight(const std::optional<std::string>& fontWeight) = 0;
79
+ virtual std::optional<bool> getEditable() = 0;
80
+ virtual void setEditable(std::optional<bool> editable) = 0;
81
+ virtual std::optional<std::string> getKeyboardType() = 0;
82
+ virtual void setKeyboardType(const std::optional<std::string>& keyboardType) = 0;
83
+ virtual std::optional<std::string> getReturnKeyType() = 0;
84
+ virtual void setReturnKeyType(const std::optional<std::string>& returnKeyType) = 0;
85
+ virtual std::optional<bool> getAutoCorrect() = 0;
86
+ virtual void setAutoCorrect(std::optional<bool> autoCorrect) = 0;
87
+ virtual std::optional<std::string> getAutoCapitalize() = 0;
88
+ virtual void setAutoCapitalize(const std::optional<std::string>& autoCapitalize) = 0;
89
+ virtual std::optional<std::string> getSelectionColor() = 0;
90
+ virtual void setSelectionColor(const std::optional<std::string>& selectionColor) = 0;
91
+ virtual std::optional<double> getPrefixMarginRight() = 0;
92
+ virtual void setPrefixMarginRight(std::optional<double> prefixMarginRight) = 0;
93
+ virtual std::optional<double> getSuffixMarginLeft() = 0;
94
+ virtual void setSuffixMarginLeft(std::optional<double> suffixMarginLeft) = 0;
95
+ virtual std::optional<std::function<void(const std::string& /* text */)>> getOnChangeText() = 0;
96
+ virtual void setOnChangeText(const std::optional<std::function<void(const std::string& /* text */)>>& onChangeText) = 0;
97
+ virtual std::optional<std::function<void()>> getOnFocus() = 0;
98
+ virtual void setOnFocus(const std::optional<std::function<void()>>& onFocus) = 0;
99
+ virtual std::optional<std::function<void()>> getOnBlur() = 0;
100
+ virtual void setOnBlur(const std::optional<std::function<void()>>& onBlur) = 0;
101
+
102
+ public:
103
+ // Methods
104
+ virtual void focus() = 0;
105
+ virtual void blur() = 0;
106
+
107
+ protected:
108
+ // Hybrid Setup
109
+ void loadHybridMethods() override;
110
+
111
+ protected:
112
+ // Tag for logging
113
+ static constexpr auto TAG = "AutoSizeInput";
114
+ };
115
+
116
+ } // namespace margelo::nitro::autosizeinput
@@ -0,0 +1,387 @@
1
+ ///
2
+ /// HybridAutoSizeInputComponent.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "HybridAutoSizeInputComponent.hpp"
9
+
10
+ #include <string>
11
+ #include <exception>
12
+ #include <utility>
13
+ #include <NitroModules/NitroDefines.hpp>
14
+ #include <NitroModules/JSIConverter.hpp>
15
+ #include <react/renderer/core/RawValue.h>
16
+ #include <react/renderer/core/ShadowNode.h>
17
+ #include <react/renderer/core/ComponentDescriptor.h>
18
+ #include <react/renderer/components/view/ViewProps.h>
19
+
20
+ namespace margelo::nitro::autosizeinput::views {
21
+
22
+ extern const char HybridAutoSizeInputComponentName[] = "AutoSizeInput";
23
+
24
+ HybridAutoSizeInputProps::HybridAutoSizeInputProps(const react::PropsParserContext& context,
25
+ const HybridAutoSizeInputProps& sourceProps,
26
+ const react::RawProps& rawProps):
27
+ react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
28
+ text([&]() -> CachedProp<std::optional<std::string>> {
29
+ try {
30
+ const react::RawValue* rawValue = rawProps.at("text", nullptr, nullptr);
31
+ if (rawValue == nullptr) return sourceProps.text;
32
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
33
+ return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.text);
34
+ } catch (const std::exception& exc) {
35
+ throw std::runtime_error(std::string("AutoSizeInput.text: ") + exc.what());
36
+ }
37
+ }()),
38
+ prefix([&]() -> CachedProp<std::optional<std::string>> {
39
+ try {
40
+ const react::RawValue* rawValue = rawProps.at("prefix", nullptr, nullptr);
41
+ if (rawValue == nullptr) return sourceProps.prefix;
42
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
43
+ return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.prefix);
44
+ } catch (const std::exception& exc) {
45
+ throw std::runtime_error(std::string("AutoSizeInput.prefix: ") + exc.what());
46
+ }
47
+ }()),
48
+ suffix([&]() -> CachedProp<std::optional<std::string>> {
49
+ try {
50
+ const react::RawValue* rawValue = rawProps.at("suffix", nullptr, nullptr);
51
+ if (rawValue == nullptr) return sourceProps.suffix;
52
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
53
+ return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.suffix);
54
+ } catch (const std::exception& exc) {
55
+ throw std::runtime_error(std::string("AutoSizeInput.suffix: ") + exc.what());
56
+ }
57
+ }()),
58
+ placeholder([&]() -> CachedProp<std::optional<std::string>> {
59
+ try {
60
+ const react::RawValue* rawValue = rawProps.at("placeholder", nullptr, nullptr);
61
+ if (rawValue == nullptr) return sourceProps.placeholder;
62
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
63
+ return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.placeholder);
64
+ } catch (const std::exception& exc) {
65
+ throw std::runtime_error(std::string("AutoSizeInput.placeholder: ") + exc.what());
66
+ }
67
+ }()),
68
+ fontSize([&]() -> CachedProp<std::optional<double>> {
69
+ try {
70
+ const react::RawValue* rawValue = rawProps.at("fontSize", nullptr, nullptr);
71
+ if (rawValue == nullptr) return sourceProps.fontSize;
72
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
73
+ return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.fontSize);
74
+ } catch (const std::exception& exc) {
75
+ throw std::runtime_error(std::string("AutoSizeInput.fontSize: ") + exc.what());
76
+ }
77
+ }()),
78
+ minFontSize([&]() -> CachedProp<std::optional<double>> {
79
+ try {
80
+ const react::RawValue* rawValue = rawProps.at("minFontSize", nullptr, nullptr);
81
+ if (rawValue == nullptr) return sourceProps.minFontSize;
82
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
83
+ return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.minFontSize);
84
+ } catch (const std::exception& exc) {
85
+ throw std::runtime_error(std::string("AutoSizeInput.minFontSize: ") + exc.what());
86
+ }
87
+ }()),
88
+ multiline([&]() -> CachedProp<std::optional<bool>> {
89
+ try {
90
+ const react::RawValue* rawValue = rawProps.at("multiline", nullptr, nullptr);
91
+ if (rawValue == nullptr) return sourceProps.multiline;
92
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
93
+ return CachedProp<std::optional<bool>>::fromRawValue(*runtime, value, sourceProps.multiline);
94
+ } catch (const std::exception& exc) {
95
+ throw std::runtime_error(std::string("AutoSizeInput.multiline: ") + exc.what());
96
+ }
97
+ }()),
98
+ maxNumberOfLines([&]() -> CachedProp<std::optional<double>> {
99
+ try {
100
+ const react::RawValue* rawValue = rawProps.at("maxNumberOfLines", nullptr, nullptr);
101
+ if (rawValue == nullptr) return sourceProps.maxNumberOfLines;
102
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
103
+ return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.maxNumberOfLines);
104
+ } catch (const std::exception& exc) {
105
+ throw std::runtime_error(std::string("AutoSizeInput.maxNumberOfLines: ") + exc.what());
106
+ }
107
+ }()),
108
+ textColor([&]() -> CachedProp<std::optional<std::string>> {
109
+ try {
110
+ const react::RawValue* rawValue = rawProps.at("textColor", nullptr, nullptr);
111
+ if (rawValue == nullptr) return sourceProps.textColor;
112
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
113
+ return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.textColor);
114
+ } catch (const std::exception& exc) {
115
+ throw std::runtime_error(std::string("AutoSizeInput.textColor: ") + exc.what());
116
+ }
117
+ }()),
118
+ prefixColor([&]() -> CachedProp<std::optional<std::string>> {
119
+ try {
120
+ const react::RawValue* rawValue = rawProps.at("prefixColor", nullptr, nullptr);
121
+ if (rawValue == nullptr) return sourceProps.prefixColor;
122
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
123
+ return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.prefixColor);
124
+ } catch (const std::exception& exc) {
125
+ throw std::runtime_error(std::string("AutoSizeInput.prefixColor: ") + exc.what());
126
+ }
127
+ }()),
128
+ suffixColor([&]() -> CachedProp<std::optional<std::string>> {
129
+ try {
130
+ const react::RawValue* rawValue = rawProps.at("suffixColor", nullptr, nullptr);
131
+ if (rawValue == nullptr) return sourceProps.suffixColor;
132
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
133
+ return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.suffixColor);
134
+ } catch (const std::exception& exc) {
135
+ throw std::runtime_error(std::string("AutoSizeInput.suffixColor: ") + exc.what());
136
+ }
137
+ }()),
138
+ placeholderColor([&]() -> CachedProp<std::optional<std::string>> {
139
+ try {
140
+ const react::RawValue* rawValue = rawProps.at("placeholderColor", nullptr, nullptr);
141
+ if (rawValue == nullptr) return sourceProps.placeholderColor;
142
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
143
+ return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.placeholderColor);
144
+ } catch (const std::exception& exc) {
145
+ throw std::runtime_error(std::string("AutoSizeInput.placeholderColor: ") + exc.what());
146
+ }
147
+ }()),
148
+ textAlign([&]() -> CachedProp<std::optional<std::string>> {
149
+ try {
150
+ const react::RawValue* rawValue = rawProps.at("textAlign", nullptr, nullptr);
151
+ if (rawValue == nullptr) return sourceProps.textAlign;
152
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
153
+ return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.textAlign);
154
+ } catch (const std::exception& exc) {
155
+ throw std::runtime_error(std::string("AutoSizeInput.textAlign: ") + exc.what());
156
+ }
157
+ }()),
158
+ fontFamily([&]() -> CachedProp<std::optional<std::string>> {
159
+ try {
160
+ const react::RawValue* rawValue = rawProps.at("fontFamily", nullptr, nullptr);
161
+ if (rawValue == nullptr) return sourceProps.fontFamily;
162
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
163
+ return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.fontFamily);
164
+ } catch (const std::exception& exc) {
165
+ throw std::runtime_error(std::string("AutoSizeInput.fontFamily: ") + exc.what());
166
+ }
167
+ }()),
168
+ fontWeight([&]() -> CachedProp<std::optional<std::string>> {
169
+ try {
170
+ const react::RawValue* rawValue = rawProps.at("fontWeight", nullptr, nullptr);
171
+ if (rawValue == nullptr) return sourceProps.fontWeight;
172
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
173
+ return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.fontWeight);
174
+ } catch (const std::exception& exc) {
175
+ throw std::runtime_error(std::string("AutoSizeInput.fontWeight: ") + exc.what());
176
+ }
177
+ }()),
178
+ editable([&]() -> CachedProp<std::optional<bool>> {
179
+ try {
180
+ const react::RawValue* rawValue = rawProps.at("editable", nullptr, nullptr);
181
+ if (rawValue == nullptr) return sourceProps.editable;
182
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
183
+ return CachedProp<std::optional<bool>>::fromRawValue(*runtime, value, sourceProps.editable);
184
+ } catch (const std::exception& exc) {
185
+ throw std::runtime_error(std::string("AutoSizeInput.editable: ") + exc.what());
186
+ }
187
+ }()),
188
+ keyboardType([&]() -> CachedProp<std::optional<std::string>> {
189
+ try {
190
+ const react::RawValue* rawValue = rawProps.at("keyboardType", nullptr, nullptr);
191
+ if (rawValue == nullptr) return sourceProps.keyboardType;
192
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
193
+ return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.keyboardType);
194
+ } catch (const std::exception& exc) {
195
+ throw std::runtime_error(std::string("AutoSizeInput.keyboardType: ") + exc.what());
196
+ }
197
+ }()),
198
+ returnKeyType([&]() -> CachedProp<std::optional<std::string>> {
199
+ try {
200
+ const react::RawValue* rawValue = rawProps.at("returnKeyType", nullptr, nullptr);
201
+ if (rawValue == nullptr) return sourceProps.returnKeyType;
202
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
203
+ return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.returnKeyType);
204
+ } catch (const std::exception& exc) {
205
+ throw std::runtime_error(std::string("AutoSizeInput.returnKeyType: ") + exc.what());
206
+ }
207
+ }()),
208
+ autoCorrect([&]() -> CachedProp<std::optional<bool>> {
209
+ try {
210
+ const react::RawValue* rawValue = rawProps.at("autoCorrect", nullptr, nullptr);
211
+ if (rawValue == nullptr) return sourceProps.autoCorrect;
212
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
213
+ return CachedProp<std::optional<bool>>::fromRawValue(*runtime, value, sourceProps.autoCorrect);
214
+ } catch (const std::exception& exc) {
215
+ throw std::runtime_error(std::string("AutoSizeInput.autoCorrect: ") + exc.what());
216
+ }
217
+ }()),
218
+ autoCapitalize([&]() -> CachedProp<std::optional<std::string>> {
219
+ try {
220
+ const react::RawValue* rawValue = rawProps.at("autoCapitalize", nullptr, nullptr);
221
+ if (rawValue == nullptr) return sourceProps.autoCapitalize;
222
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
223
+ return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.autoCapitalize);
224
+ } catch (const std::exception& exc) {
225
+ throw std::runtime_error(std::string("AutoSizeInput.autoCapitalize: ") + exc.what());
226
+ }
227
+ }()),
228
+ selectionColor([&]() -> CachedProp<std::optional<std::string>> {
229
+ try {
230
+ const react::RawValue* rawValue = rawProps.at("selectionColor", nullptr, nullptr);
231
+ if (rawValue == nullptr) return sourceProps.selectionColor;
232
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
233
+ return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.selectionColor);
234
+ } catch (const std::exception& exc) {
235
+ throw std::runtime_error(std::string("AutoSizeInput.selectionColor: ") + exc.what());
236
+ }
237
+ }()),
238
+ prefixMarginRight([&]() -> CachedProp<std::optional<double>> {
239
+ try {
240
+ const react::RawValue* rawValue = rawProps.at("prefixMarginRight", nullptr, nullptr);
241
+ if (rawValue == nullptr) return sourceProps.prefixMarginRight;
242
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
243
+ return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.prefixMarginRight);
244
+ } catch (const std::exception& exc) {
245
+ throw std::runtime_error(std::string("AutoSizeInput.prefixMarginRight: ") + exc.what());
246
+ }
247
+ }()),
248
+ suffixMarginLeft([&]() -> CachedProp<std::optional<double>> {
249
+ try {
250
+ const react::RawValue* rawValue = rawProps.at("suffixMarginLeft", nullptr, nullptr);
251
+ if (rawValue == nullptr) return sourceProps.suffixMarginLeft;
252
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
253
+ return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.suffixMarginLeft);
254
+ } catch (const std::exception& exc) {
255
+ throw std::runtime_error(std::string("AutoSizeInput.suffixMarginLeft: ") + exc.what());
256
+ }
257
+ }()),
258
+ onChangeText([&]() -> CachedProp<std::optional<std::function<void(const std::string& /* text */)>>> {
259
+ try {
260
+ const react::RawValue* rawValue = rawProps.at("onChangeText", nullptr, nullptr);
261
+ if (rawValue == nullptr) return sourceProps.onChangeText;
262
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
263
+ return CachedProp<std::optional<std::function<void(const std::string& /* text */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onChangeText);
264
+ } catch (const std::exception& exc) {
265
+ throw std::runtime_error(std::string("AutoSizeInput.onChangeText: ") + exc.what());
266
+ }
267
+ }()),
268
+ onFocus([&]() -> CachedProp<std::optional<std::function<void()>>> {
269
+ try {
270
+ const react::RawValue* rawValue = rawProps.at("onFocus", nullptr, nullptr);
271
+ if (rawValue == nullptr) return sourceProps.onFocus;
272
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
273
+ return CachedProp<std::optional<std::function<void()>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onFocus);
274
+ } catch (const std::exception& exc) {
275
+ throw std::runtime_error(std::string("AutoSizeInput.onFocus: ") + exc.what());
276
+ }
277
+ }()),
278
+ onBlur([&]() -> CachedProp<std::optional<std::function<void()>>> {
279
+ try {
280
+ const react::RawValue* rawValue = rawProps.at("onBlur", nullptr, nullptr);
281
+ if (rawValue == nullptr) return sourceProps.onBlur;
282
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
283
+ return CachedProp<std::optional<std::function<void()>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onBlur);
284
+ } catch (const std::exception& exc) {
285
+ throw std::runtime_error(std::string("AutoSizeInput.onBlur: ") + exc.what());
286
+ }
287
+ }()),
288
+ hybridRef([&]() -> CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridAutoSizeInputSpec>& /* ref */)>>> {
289
+ try {
290
+ const react::RawValue* rawValue = rawProps.at("hybridRef", nullptr, nullptr);
291
+ if (rawValue == nullptr) return sourceProps.hybridRef;
292
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
293
+ return CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridAutoSizeInputSpec>& /* ref */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.hybridRef);
294
+ } catch (const std::exception& exc) {
295
+ throw std::runtime_error(std::string("AutoSizeInput.hybridRef: ") + exc.what());
296
+ }
297
+ }()) { }
298
+
299
+ HybridAutoSizeInputProps::HybridAutoSizeInputProps(const HybridAutoSizeInputProps& other):
300
+ react::ViewProps(),
301
+ text(other.text),
302
+ prefix(other.prefix),
303
+ suffix(other.suffix),
304
+ placeholder(other.placeholder),
305
+ fontSize(other.fontSize),
306
+ minFontSize(other.minFontSize),
307
+ multiline(other.multiline),
308
+ maxNumberOfLines(other.maxNumberOfLines),
309
+ textColor(other.textColor),
310
+ prefixColor(other.prefixColor),
311
+ suffixColor(other.suffixColor),
312
+ placeholderColor(other.placeholderColor),
313
+ textAlign(other.textAlign),
314
+ fontFamily(other.fontFamily),
315
+ fontWeight(other.fontWeight),
316
+ editable(other.editable),
317
+ keyboardType(other.keyboardType),
318
+ returnKeyType(other.returnKeyType),
319
+ autoCorrect(other.autoCorrect),
320
+ autoCapitalize(other.autoCapitalize),
321
+ selectionColor(other.selectionColor),
322
+ prefixMarginRight(other.prefixMarginRight),
323
+ suffixMarginLeft(other.suffixMarginLeft),
324
+ onChangeText(other.onChangeText),
325
+ onFocus(other.onFocus),
326
+ onBlur(other.onBlur),
327
+ hybridRef(other.hybridRef) { }
328
+
329
+ bool HybridAutoSizeInputProps::filterObjectKeys(const std::string& propName) {
330
+ switch (hashString(propName)) {
331
+ case hashString("text"): return true;
332
+ case hashString("prefix"): return true;
333
+ case hashString("suffix"): return true;
334
+ case hashString("placeholder"): return true;
335
+ case hashString("fontSize"): return true;
336
+ case hashString("minFontSize"): return true;
337
+ case hashString("multiline"): return true;
338
+ case hashString("maxNumberOfLines"): return true;
339
+ case hashString("textColor"): return true;
340
+ case hashString("prefixColor"): return true;
341
+ case hashString("suffixColor"): return true;
342
+ case hashString("placeholderColor"): return true;
343
+ case hashString("textAlign"): return true;
344
+ case hashString("fontFamily"): return true;
345
+ case hashString("fontWeight"): return true;
346
+ case hashString("editable"): return true;
347
+ case hashString("keyboardType"): return true;
348
+ case hashString("returnKeyType"): return true;
349
+ case hashString("autoCorrect"): return true;
350
+ case hashString("autoCapitalize"): return true;
351
+ case hashString("selectionColor"): return true;
352
+ case hashString("prefixMarginRight"): return true;
353
+ case hashString("suffixMarginLeft"): return true;
354
+ case hashString("onChangeText"): return true;
355
+ case hashString("onFocus"): return true;
356
+ case hashString("onBlur"): return true;
357
+ case hashString("hybridRef"): return true;
358
+ default: return false;
359
+ }
360
+ }
361
+
362
+ HybridAutoSizeInputComponentDescriptor::HybridAutoSizeInputComponentDescriptor(const react::ComponentDescriptorParameters& parameters)
363
+ : ConcreteComponentDescriptor(parameters,
364
+ react::RawPropsParser(/* enableJsiParser */ true)) {}
365
+
366
+ std::shared_ptr<const react::Props> HybridAutoSizeInputComponentDescriptor::cloneProps(const react::PropsParserContext& context,
367
+ const std::shared_ptr<const react::Props>& props,
368
+ react::RawProps rawProps) const {
369
+ // 1. Prepare raw props parser
370
+ rawProps.parse(rawPropsParser_);
371
+ // 2. Copy props with Nitro's cached copy constructor
372
+ return HybridAutoSizeInputShadowNode::Props(context, /* & */ rawProps, props);
373
+ }
374
+
375
+ #ifdef ANDROID
376
+ void HybridAutoSizeInputComponentDescriptor::adopt(react::ShadowNode& shadowNode) const {
377
+ // This is called immediately after `ShadowNode` is created, cloned or in progress.
378
+ // On Android, we need to wrap props in our state, which gets routed through Java and later unwrapped in JNI/C++.
379
+ auto& concreteShadowNode = dynamic_cast<HybridAutoSizeInputShadowNode&>(shadowNode);
380
+ const HybridAutoSizeInputProps& props = concreteShadowNode.getConcreteProps();
381
+ HybridAutoSizeInputState state;
382
+ state.setProps(props);
383
+ concreteShadowNode.setStateData(std::move(state));
384
+ }
385
+ #endif
386
+
387
+ } // namespace margelo::nitro::autosizeinput::views