@onekeyfe/react-native-auto-size-input 3.0.81-alpha.8 → 3.0.82
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/android/build.gradle +1 -0
- package/android/src/main/java/com/margelo/nitro/autosizeinput/AutoSizeInput.kt +36 -8
- package/android/src/main/java/com/margelo/nitro/autosizeinput/TextUpdateEventCounter.kt +46 -0
- package/android/src/test/java/com/margelo/nitro/autosizeinput/TextUpdateEventCounterTest.kt +147 -0
- package/ios/AutoSizeInput.swift +57 -0
- package/lib/nitrogen/generated/android/autosizeinput+autolinking.cmake +1 -1
- package/lib/nitrogen/generated/android/autosizeinput+autolinking.gradle +1 -1
- package/lib/nitrogen/generated/android/autosizeinputOnLoad.cpp +30 -20
- package/lib/nitrogen/generated/android/autosizeinputOnLoad.hpp +14 -5
- package/lib/nitrogen/generated/android/c++/JFunc_void.hpp +3 -3
- package/lib/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +3 -3
- package/lib/nitrogen/generated/android/c++/JHybridAutoSizeInputSpec.cpp +92 -82
- package/lib/nitrogen/generated/android/c++/JHybridAutoSizeInputSpec.hpp +22 -22
- package/lib/nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.cpp +108 -104
- package/lib/nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.hpp +4 -4
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/Func_void.kt +1 -1
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/Func_void_std__string.kt +1 -1
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/HybridAutoSizeInputSpec.kt +23 -19
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/autosizeinputOnLoad.kt +1 -1
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/views/HybridAutoSizeInputManager.kt +40 -10
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/views/HybridAutoSizeInputStateUpdater.kt +1 -1
- package/lib/nitrogen/generated/ios/AutoSizeInput+autolinking.rb +2 -2
- package/lib/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Bridge.cpp +1 -1
- package/lib/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Bridge.hpp +20 -20
- package/lib/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Umbrella.hpp +1 -1
- package/lib/nitrogen/generated/ios/AutoSizeInputAutolinking.mm +1 -1
- package/lib/nitrogen/generated/ios/AutoSizeInputAutolinking.swift +9 -8
- package/lib/nitrogen/generated/ios/c++/HybridAutoSizeInputSpecSwift.cpp +1 -1
- package/lib/nitrogen/generated/ios/c++/HybridAutoSizeInputSpecSwift.hpp +15 -2
- package/lib/nitrogen/generated/ios/c++/views/HybridAutoSizeInputComponent.mm +32 -1
- package/lib/nitrogen/generated/ios/swift/Func_void.swift +1 -2
- package/lib/nitrogen/generated/ios/swift/Func_void_std__string.swift +1 -2
- package/lib/nitrogen/generated/ios/swift/HybridAutoSizeInputSpec.swift +4 -4
- package/lib/nitrogen/generated/ios/swift/HybridAutoSizeInputSpec_cxx.swift +82 -7
- package/lib/nitrogen/generated/shared/c++/HybridAutoSizeInputSpec.cpp +3 -1
- package/lib/nitrogen/generated/shared/c++/HybridAutoSizeInputSpec.hpp +4 -2
- package/lib/nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.cpp +21 -43
- package/lib/nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.hpp +11 -7
- package/lib/nitrogen/generated/shared/json/AutoSizeInputConfig.json +1 -0
- package/lib/typescript/src/AutoSizeInput.nitro.d.ts +1 -0
- package/nitrogen/generated/android/autosizeinput+autolinking.cmake +1 -1
- package/nitrogen/generated/android/autosizeinput+autolinking.gradle +1 -1
- package/nitrogen/generated/android/autosizeinputOnLoad.cpp +30 -20
- package/nitrogen/generated/android/autosizeinputOnLoad.hpp +14 -5
- package/nitrogen/generated/android/c++/JFunc_void.hpp +3 -3
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +3 -3
- package/nitrogen/generated/android/c++/JHybridAutoSizeInputSpec.cpp +92 -82
- package/nitrogen/generated/android/c++/JHybridAutoSizeInputSpec.hpp +22 -22
- package/nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.cpp +108 -104
- package/nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.hpp +4 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/Func_void.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/Func_void_std__string.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/HybridAutoSizeInputSpec.kt +23 -19
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/autosizeinputOnLoad.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/views/HybridAutoSizeInputManager.kt +40 -10
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/views/HybridAutoSizeInputStateUpdater.kt +1 -1
- package/nitrogen/generated/ios/AutoSizeInput+autolinking.rb +2 -2
- package/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Bridge.cpp +1 -1
- package/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Bridge.hpp +20 -20
- package/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Umbrella.hpp +1 -1
- package/nitrogen/generated/ios/AutoSizeInputAutolinking.mm +1 -1
- package/nitrogen/generated/ios/AutoSizeInputAutolinking.swift +9 -8
- package/nitrogen/generated/ios/c++/HybridAutoSizeInputSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridAutoSizeInputSpecSwift.hpp +15 -2
- package/nitrogen/generated/ios/c++/views/HybridAutoSizeInputComponent.mm +32 -1
- package/nitrogen/generated/ios/swift/Func_void.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +1 -2
- package/nitrogen/generated/ios/swift/HybridAutoSizeInputSpec.swift +4 -4
- package/nitrogen/generated/ios/swift/HybridAutoSizeInputSpec_cxx.swift +82 -7
- package/nitrogen/generated/shared/c++/HybridAutoSizeInputSpec.cpp +3 -1
- package/nitrogen/generated/shared/c++/HybridAutoSizeInputSpec.hpp +4 -2
- package/nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.cpp +21 -43
- package/nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.hpp +11 -7
- package/nitrogen/generated/shared/json/AutoSizeInputConfig.json +1 -0
- package/package.json +5 -6
- package/src/AutoSizeInput.nitro.ts +1 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// AutoSizeInput-Swift-Cxx-Bridge.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -30,21 +30,6 @@ namespace AutoSizeInput { class HybridAutoSizeInputSpec_cxx; }
|
|
|
30
30
|
*/
|
|
31
31
|
namespace margelo::nitro::autosizeinput::bridge::swift {
|
|
32
32
|
|
|
33
|
-
// pragma MARK: std::optional<std::string>
|
|
34
|
-
/**
|
|
35
|
-
* Specialized version of `std::optional<std::string>`.
|
|
36
|
-
*/
|
|
37
|
-
using std__optional_std__string_ = std::optional<std::string>;
|
|
38
|
-
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
39
|
-
return std::optional<std::string>(value);
|
|
40
|
-
}
|
|
41
|
-
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
42
|
-
return optional.has_value();
|
|
43
|
-
}
|
|
44
|
-
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
45
|
-
return *optional;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
33
|
// pragma MARK: std::optional<double>
|
|
49
34
|
/**
|
|
50
35
|
* Specialized version of `std::optional<double>`.
|
|
@@ -57,7 +42,22 @@ namespace margelo::nitro::autosizeinput::bridge::swift {
|
|
|
57
42
|
return optional.has_value();
|
|
58
43
|
}
|
|
59
44
|
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
60
|
-
return
|
|
45
|
+
return optional.value();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// pragma MARK: std::optional<std::string>
|
|
49
|
+
/**
|
|
50
|
+
* Specialized version of `std::optional<std::string>`.
|
|
51
|
+
*/
|
|
52
|
+
using std__optional_std__string_ = std::optional<std::string>;
|
|
53
|
+
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
54
|
+
return std::optional<std::string>(value);
|
|
55
|
+
}
|
|
56
|
+
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
57
|
+
return optional.has_value();
|
|
58
|
+
}
|
|
59
|
+
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
60
|
+
return optional.value();
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// pragma MARK: std::optional<bool>
|
|
@@ -72,7 +72,7 @@ namespace margelo::nitro::autosizeinput::bridge::swift {
|
|
|
72
72
|
return optional.has_value();
|
|
73
73
|
}
|
|
74
74
|
inline bool get_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
75
|
-
return
|
|
75
|
+
return optional.value();
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
// pragma MARK: std::function<void(const std::string& /* text */)>
|
|
@@ -109,7 +109,7 @@ namespace margelo::nitro::autosizeinput::bridge::swift {
|
|
|
109
109
|
return optional.has_value();
|
|
110
110
|
}
|
|
111
111
|
inline std::function<void(const std::string& /* text */)> get_std__optional_std__function_void_const_std__string_____text______(const std::optional<std::function<void(const std::string& /* text */)>>& optional) noexcept {
|
|
112
|
-
return
|
|
112
|
+
return optional.value();
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
// pragma MARK: std::function<void()>
|
|
@@ -146,7 +146,7 @@ namespace margelo::nitro::autosizeinput::bridge::swift {
|
|
|
146
146
|
return optional.has_value();
|
|
147
147
|
}
|
|
148
148
|
inline std::function<void()> get_std__optional_std__function_void____(const std::optional<std::function<void()>>& optional) noexcept {
|
|
149
|
-
return
|
|
149
|
+
return optional.value();
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
// pragma MARK: std::shared_ptr<HybridAutoSizeInputSpec>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// AutoSizeInputAutolinking.mm
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#import <Foundation/Foundation.h>
|
|
@@ -2,19 +2,16 @@
|
|
|
2
2
|
/// AutoSizeInputAutolinking.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
8
12
|
public final class AutoSizeInputAutolinking {
|
|
9
13
|
public typealias bridge = margelo.nitro.autosizeinput.bridge.swift
|
|
10
14
|
|
|
11
|
-
/**
|
|
12
|
-
* Creates an instance of a Swift class that implements `HybridAutoSizeInputSpec`,
|
|
13
|
-
* and wraps it in a Swift class that can directly interop with C++ (`HybridAutoSizeInputSpec_cxx`)
|
|
14
|
-
*
|
|
15
|
-
* This is generated by Nitrogen and will initialize the class specified
|
|
16
|
-
* in the `"autolinking"` property of `nitro.json` (in this case, `HybridAutoSizeInput`).
|
|
17
|
-
*/
|
|
18
15
|
public static func createAutoSizeInput() -> bridge.std__shared_ptr_HybridAutoSizeInputSpec_ {
|
|
19
16
|
let hybridObject = HybridAutoSizeInput()
|
|
20
17
|
return { () -> bridge.std__shared_ptr_HybridAutoSizeInputSpec_ in
|
|
@@ -22,4 +19,8 @@ public final class AutoSizeInputAutolinking {
|
|
|
22
19
|
return __cxxWrapped.getCxxPart()
|
|
23
20
|
}()
|
|
24
21
|
}
|
|
22
|
+
|
|
23
|
+
public static func isAutoSizeInputRecyclable() -> Bool {
|
|
24
|
+
return HybridAutoSizeInput.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
25
26
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridAutoSizeInputSpecSwift.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridAutoSizeInputSpecSwift.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridAutoSizeInputSpecSwift.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -14,8 +14,8 @@ namespace AutoSizeInput { class HybridAutoSizeInputSpec_cxx; }
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
#include <string>
|
|
18
17
|
#include <optional>
|
|
18
|
+
#include <string>
|
|
19
19
|
#include <functional>
|
|
20
20
|
|
|
21
21
|
#include "AutoSizeInput-Swift-Cxx-Umbrella.hpp"
|
|
@@ -49,6 +49,12 @@ namespace margelo::nitro::autosizeinput {
|
|
|
49
49
|
inline size_t getExternalMemorySize() noexcept override {
|
|
50
50
|
return _swiftPart.getMemorySize();
|
|
51
51
|
}
|
|
52
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
53
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridAutoSizeInputSpecSwift>(other)) {
|
|
54
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
52
58
|
void dispose() noexcept override {
|
|
53
59
|
_swiftPart.dispose();
|
|
54
60
|
}
|
|
@@ -58,6 +64,13 @@ namespace margelo::nitro::autosizeinput {
|
|
|
58
64
|
|
|
59
65
|
public:
|
|
60
66
|
// Properties
|
|
67
|
+
inline std::optional<double> getMostRecentEventCount() noexcept override {
|
|
68
|
+
auto __result = _swiftPart.getMostRecentEventCount();
|
|
69
|
+
return __result;
|
|
70
|
+
}
|
|
71
|
+
inline void setMostRecentEventCount(std::optional<double> mostRecentEventCount) noexcept override {
|
|
72
|
+
_swiftPart.setMostRecentEventCount(mostRecentEventCount);
|
|
73
|
+
}
|
|
61
74
|
inline std::optional<std::string> getText() noexcept override {
|
|
62
75
|
auto __result = _swiftPart.getText();
|
|
63
76
|
return __result;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridAutoSizeInputComponent.mm
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#import "HybridAutoSizeInputComponent.hpp"
|
|
@@ -17,6 +17,13 @@
|
|
|
17
17
|
#import "HybridAutoSizeInputSpecSwift.hpp"
|
|
18
18
|
#import "AutoSizeInput-Swift-Cxx-Umbrella.hpp"
|
|
19
19
|
|
|
20
|
+
#if __has_include(<cxxreact/ReactNativeVersion.h>)
|
|
21
|
+
#include <cxxreact/ReactNativeVersion.h>
|
|
22
|
+
#if REACT_NATIVE_VERSION_MINOR >= 82
|
|
23
|
+
#define ENABLE_RCT_COMPONENT_VIEW_INVALIDATE
|
|
24
|
+
#endif
|
|
25
|
+
#endif
|
|
26
|
+
|
|
20
27
|
using namespace facebook;
|
|
21
28
|
using namespace margelo::nitro::autosizeinput;
|
|
22
29
|
using namespace margelo::nitro::autosizeinput::views;
|
|
@@ -25,6 +32,7 @@ using namespace margelo::nitro::autosizeinput::views;
|
|
|
25
32
|
* Represents the React Native View holder for the Nitro "AutoSizeInput" HybridView.
|
|
26
33
|
*/
|
|
27
34
|
@interface HybridAutoSizeInputComponent: RCTViewComponentView
|
|
35
|
+
+ (BOOL)shouldBeRecycled;
|
|
28
36
|
@end
|
|
29
37
|
|
|
30
38
|
@implementation HybridAutoSizeInputComponent {
|
|
@@ -71,6 +79,11 @@ using namespace margelo::nitro::autosizeinput::views;
|
|
|
71
79
|
// 2. Update each prop individually
|
|
72
80
|
swiftPart.beforeUpdate();
|
|
73
81
|
|
|
82
|
+
// mostRecentEventCount: optional
|
|
83
|
+
if (newViewProps.mostRecentEventCount.isDirty) {
|
|
84
|
+
swiftPart.setMostRecentEventCount(newViewProps.mostRecentEventCount.value);
|
|
85
|
+
newViewProps.mostRecentEventCount.isDirty = false;
|
|
86
|
+
}
|
|
74
87
|
// text: optional
|
|
75
88
|
if (newViewProps.text.isDirty) {
|
|
76
89
|
swiftPart.setText(newViewProps.text.value);
|
|
@@ -238,4 +251,22 @@ using namespace margelo::nitro::autosizeinput::views;
|
|
|
238
251
|
[super updateProps:props oldProps:oldProps];
|
|
239
252
|
}
|
|
240
253
|
|
|
254
|
+
+ (BOOL)shouldBeRecycled {
|
|
255
|
+
return AutoSizeInput::AutoSizeInputAutolinking::isAutoSizeInputRecyclable();
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
- (void)prepareForRecycle {
|
|
259
|
+
[super prepareForRecycle];
|
|
260
|
+
AutoSizeInput::HybridAutoSizeInputSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
261
|
+
swiftPart.maybePrepareForRecycle();
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
#ifdef ENABLE_RCT_COMPONENT_VIEW_INVALIDATE
|
|
265
|
+
- (void)invalidate {
|
|
266
|
+
AutoSizeInput::HybridAutoSizeInputSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
267
|
+
swiftPart.onDropView();
|
|
268
|
+
[super invalidate];
|
|
269
|
+
}
|
|
270
|
+
#endif
|
|
271
|
+
|
|
241
272
|
@end
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/// Func_void.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import NitroModules
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/// Func_void_std__string.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import NitroModules
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
/// HybridAutoSizeInputSpec.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import NitroModules
|
|
10
9
|
|
|
11
10
|
/// See ``HybridAutoSizeInputSpec``
|
|
12
11
|
public protocol HybridAutoSizeInputSpec_protocol: HybridObject, HybridView {
|
|
13
12
|
// Properties
|
|
13
|
+
var mostRecentEventCount: Double? { get set }
|
|
14
14
|
var text: String? { get set }
|
|
15
15
|
var prefix: String? { get set }
|
|
16
16
|
var suffix: String? { get set }
|
|
@@ -60,14 +60,14 @@ open class HybridAutoSizeInputSpec_base {
|
|
|
60
60
|
public init() { }
|
|
61
61
|
public func getCxxWrapper() -> HybridAutoSizeInputSpec_cxx {
|
|
62
62
|
#if DEBUG
|
|
63
|
-
guard self is HybridAutoSizeInputSpec else {
|
|
63
|
+
guard self is any HybridAutoSizeInputSpec else {
|
|
64
64
|
fatalError("`self` is not a `HybridAutoSizeInputSpec`! Did you accidentally inherit from `HybridAutoSizeInputSpec_base` instead of `HybridAutoSizeInputSpec`?")
|
|
65
65
|
}
|
|
66
66
|
#endif
|
|
67
67
|
if let cxxWrapper = self.cxxWrapper {
|
|
68
68
|
return cxxWrapper
|
|
69
69
|
} else {
|
|
70
|
-
let cxxWrapper = HybridAutoSizeInputSpec_cxx(self as! HybridAutoSizeInputSpec)
|
|
70
|
+
let cxxWrapper = HybridAutoSizeInputSpec_cxx(self as! any HybridAutoSizeInputSpec)
|
|
71
71
|
self.cxxWrapper = cxxWrapper
|
|
72
72
|
return cxxWrapper
|
|
73
73
|
}
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/// HybridAutoSizeInputSpec_cxx.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import NitroModules
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -96,6 +95,14 @@ open class HybridAutoSizeInputSpec_cxx {
|
|
|
96
95
|
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
97
96
|
}
|
|
98
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Compares this object with the given [other] object for reference equality.
|
|
100
|
+
*/
|
|
101
|
+
@inline(__always)
|
|
102
|
+
public func equals(other: HybridAutoSizeInputSpec_cxx) -> Bool {
|
|
103
|
+
return self.__implementation === other.__implementation
|
|
104
|
+
}
|
|
105
|
+
|
|
99
106
|
/**
|
|
100
107
|
* Call dispose() on the Swift class.
|
|
101
108
|
* This _may_ be called manually from JS.
|
|
@@ -114,6 +121,30 @@ open class HybridAutoSizeInputSpec_cxx {
|
|
|
114
121
|
}
|
|
115
122
|
|
|
116
123
|
// Properties
|
|
124
|
+
public final var mostRecentEventCount: bridge.std__optional_double_ {
|
|
125
|
+
@inline(__always)
|
|
126
|
+
get {
|
|
127
|
+
return { () -> bridge.std__optional_double_ in
|
|
128
|
+
if let __unwrappedValue = self.__implementation.mostRecentEventCount {
|
|
129
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
130
|
+
} else {
|
|
131
|
+
return .init()
|
|
132
|
+
}
|
|
133
|
+
}()
|
|
134
|
+
}
|
|
135
|
+
@inline(__always)
|
|
136
|
+
set {
|
|
137
|
+
self.__implementation.mostRecentEventCount = { () -> Double? in
|
|
138
|
+
if bridge.has_value_std__optional_double_(newValue) {
|
|
139
|
+
let __unwrapped = bridge.get_std__optional_double_(newValue)
|
|
140
|
+
return __unwrapped
|
|
141
|
+
} else {
|
|
142
|
+
return nil
|
|
143
|
+
}
|
|
144
|
+
}()
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
117
148
|
public final var text: bridge.std__optional_std__string_ {
|
|
118
149
|
@inline(__always)
|
|
119
150
|
get {
|
|
@@ -223,7 +254,14 @@ open class HybridAutoSizeInputSpec_cxx {
|
|
|
223
254
|
}
|
|
224
255
|
@inline(__always)
|
|
225
256
|
set {
|
|
226
|
-
self.__implementation.fontSize =
|
|
257
|
+
self.__implementation.fontSize = { () -> Double? in
|
|
258
|
+
if bridge.has_value_std__optional_double_(newValue) {
|
|
259
|
+
let __unwrapped = bridge.get_std__optional_double_(newValue)
|
|
260
|
+
return __unwrapped
|
|
261
|
+
} else {
|
|
262
|
+
return nil
|
|
263
|
+
}
|
|
264
|
+
}()
|
|
227
265
|
}
|
|
228
266
|
}
|
|
229
267
|
|
|
@@ -240,7 +278,14 @@ open class HybridAutoSizeInputSpec_cxx {
|
|
|
240
278
|
}
|
|
241
279
|
@inline(__always)
|
|
242
280
|
set {
|
|
243
|
-
self.__implementation.minFontSize =
|
|
281
|
+
self.__implementation.minFontSize = { () -> Double? in
|
|
282
|
+
if bridge.has_value_std__optional_double_(newValue) {
|
|
283
|
+
let __unwrapped = bridge.get_std__optional_double_(newValue)
|
|
284
|
+
return __unwrapped
|
|
285
|
+
} else {
|
|
286
|
+
return nil
|
|
287
|
+
}
|
|
288
|
+
}()
|
|
244
289
|
}
|
|
245
290
|
}
|
|
246
291
|
|
|
@@ -281,7 +326,14 @@ open class HybridAutoSizeInputSpec_cxx {
|
|
|
281
326
|
}
|
|
282
327
|
@inline(__always)
|
|
283
328
|
set {
|
|
284
|
-
self.__implementation.maxNumberOfLines =
|
|
329
|
+
self.__implementation.maxNumberOfLines = { () -> Double? in
|
|
330
|
+
if bridge.has_value_std__optional_double_(newValue) {
|
|
331
|
+
let __unwrapped = bridge.get_std__optional_double_(newValue)
|
|
332
|
+
return __unwrapped
|
|
333
|
+
} else {
|
|
334
|
+
return nil
|
|
335
|
+
}
|
|
336
|
+
}()
|
|
285
337
|
}
|
|
286
338
|
}
|
|
287
339
|
|
|
@@ -610,7 +662,14 @@ open class HybridAutoSizeInputSpec_cxx {
|
|
|
610
662
|
}
|
|
611
663
|
@inline(__always)
|
|
612
664
|
set {
|
|
613
|
-
self.__implementation.prefixMarginRight =
|
|
665
|
+
self.__implementation.prefixMarginRight = { () -> Double? in
|
|
666
|
+
if bridge.has_value_std__optional_double_(newValue) {
|
|
667
|
+
let __unwrapped = bridge.get_std__optional_double_(newValue)
|
|
668
|
+
return __unwrapped
|
|
669
|
+
} else {
|
|
670
|
+
return nil
|
|
671
|
+
}
|
|
672
|
+
}()
|
|
614
673
|
}
|
|
615
674
|
}
|
|
616
675
|
|
|
@@ -627,7 +686,14 @@ open class HybridAutoSizeInputSpec_cxx {
|
|
|
627
686
|
}
|
|
628
687
|
@inline(__always)
|
|
629
688
|
set {
|
|
630
|
-
self.__implementation.suffixMarginLeft =
|
|
689
|
+
self.__implementation.suffixMarginLeft = { () -> Double? in
|
|
690
|
+
if bridge.has_value_std__optional_double_(newValue) {
|
|
691
|
+
let __unwrapped = bridge.get_std__optional_double_(newValue)
|
|
692
|
+
return __unwrapped
|
|
693
|
+
} else {
|
|
694
|
+
return nil
|
|
695
|
+
}
|
|
696
|
+
}()
|
|
631
697
|
}
|
|
632
698
|
}
|
|
633
699
|
|
|
@@ -857,4 +923,13 @@ open class HybridAutoSizeInputSpec_cxx {
|
|
|
857
923
|
public final func afterUpdate() {
|
|
858
924
|
__implementation.afterUpdate()
|
|
859
925
|
}
|
|
926
|
+
|
|
927
|
+
public final func maybePrepareForRecycle() {
|
|
928
|
+
guard let recyclable = __implementation as? any RecyclableView else { return }
|
|
929
|
+
recyclable.prepareForRecycle()
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
public final func onDropView() {
|
|
933
|
+
__implementation.onDropView()
|
|
934
|
+
}
|
|
860
935
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridAutoSizeInputSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridAutoSizeInputSpec.hpp"
|
|
@@ -14,6 +14,8 @@ namespace margelo::nitro::autosizeinput {
|
|
|
14
14
|
HybridObject::loadHybridMethods();
|
|
15
15
|
// load custom methods/properties
|
|
16
16
|
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridGetter("mostRecentEventCount", &HybridAutoSizeInputSpec::getMostRecentEventCount);
|
|
18
|
+
prototype.registerHybridSetter("mostRecentEventCount", &HybridAutoSizeInputSpec::setMostRecentEventCount);
|
|
17
19
|
prototype.registerHybridGetter("text", &HybridAutoSizeInputSpec::getText);
|
|
18
20
|
prototype.registerHybridSetter("text", &HybridAutoSizeInputSpec::setText);
|
|
19
21
|
prototype.registerHybridGetter("prefix", &HybridAutoSizeInputSpec::getPrefix);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridAutoSizeInputSpec.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
#include <string>
|
|
19
18
|
#include <optional>
|
|
19
|
+
#include <string>
|
|
20
20
|
#include <functional>
|
|
21
21
|
|
|
22
22
|
namespace margelo::nitro::autosizeinput {
|
|
@@ -46,6 +46,8 @@ namespace margelo::nitro::autosizeinput {
|
|
|
46
46
|
|
|
47
47
|
public:
|
|
48
48
|
// Properties
|
|
49
|
+
virtual std::optional<double> getMostRecentEventCount() = 0;
|
|
50
|
+
virtual void setMostRecentEventCount(std::optional<double> mostRecentEventCount) = 0;
|
|
49
51
|
virtual std::optional<std::string> getText() = 0;
|
|
50
52
|
virtual void setText(const std::optional<std::string>& text) = 0;
|
|
51
53
|
virtual std::optional<std::string> getPrefix() = 0;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridAutoSizeInputComponent.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridAutoSizeInputComponent.hpp"
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
#include <utility>
|
|
13
13
|
#include <NitroModules/NitroDefines.hpp>
|
|
14
14
|
#include <NitroModules/JSIConverter.hpp>
|
|
15
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
15
16
|
#include <react/renderer/core/RawValue.h>
|
|
16
17
|
#include <react/renderer/core/ShadowNode.h>
|
|
17
18
|
#include <react/renderer/core/ComponentDescriptor.h>
|
|
@@ -25,6 +26,16 @@ namespace margelo::nitro::autosizeinput::views {
|
|
|
25
26
|
const HybridAutoSizeInputProps& sourceProps,
|
|
26
27
|
const react::RawProps& rawProps):
|
|
27
28
|
react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
|
|
29
|
+
mostRecentEventCount([&]() -> CachedProp<std::optional<double>> {
|
|
30
|
+
try {
|
|
31
|
+
const react::RawValue* rawValue = rawProps.at("mostRecentEventCount", nullptr, nullptr);
|
|
32
|
+
if (rawValue == nullptr) return sourceProps.mostRecentEventCount;
|
|
33
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
34
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.mostRecentEventCount);
|
|
35
|
+
} catch (const std::exception& exc) {
|
|
36
|
+
throw std::runtime_error(std::string("AutoSizeInput.mostRecentEventCount: ") + exc.what());
|
|
37
|
+
}
|
|
38
|
+
}()),
|
|
28
39
|
text([&]() -> CachedProp<std::optional<std::string>> {
|
|
29
40
|
try {
|
|
30
41
|
const react::RawValue* rawValue = rawProps.at("text", nullptr, nullptr);
|
|
@@ -300,7 +311,7 @@ namespace margelo::nitro::autosizeinput::views {
|
|
|
300
311
|
const react::RawValue* rawValue = rawProps.at("onChangeText", nullptr, nullptr);
|
|
301
312
|
if (rawValue == nullptr) return sourceProps.onChangeText;
|
|
302
313
|
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
303
|
-
return CachedProp<std::optional<std::function<void(const std::string& /* text */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onChangeText);
|
|
314
|
+
return CachedProp<std::optional<std::function<void(const std::string& /* text */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, PropNameIDCache::get(*runtime, "f")), sourceProps.onChangeText);
|
|
304
315
|
} catch (const std::exception& exc) {
|
|
305
316
|
throw std::runtime_error(std::string("AutoSizeInput.onChangeText: ") + exc.what());
|
|
306
317
|
}
|
|
@@ -310,7 +321,7 @@ namespace margelo::nitro::autosizeinput::views {
|
|
|
310
321
|
const react::RawValue* rawValue = rawProps.at("onFocus", nullptr, nullptr);
|
|
311
322
|
if (rawValue == nullptr) return sourceProps.onFocus;
|
|
312
323
|
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
313
|
-
return CachedProp<std::optional<std::function<void()>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onFocus);
|
|
324
|
+
return CachedProp<std::optional<std::function<void()>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, PropNameIDCache::get(*runtime, "f")), sourceProps.onFocus);
|
|
314
325
|
} catch (const std::exception& exc) {
|
|
315
326
|
throw std::runtime_error(std::string("AutoSizeInput.onFocus: ") + exc.what());
|
|
316
327
|
}
|
|
@@ -320,7 +331,7 @@ namespace margelo::nitro::autosizeinput::views {
|
|
|
320
331
|
const react::RawValue* rawValue = rawProps.at("onBlur", nullptr, nullptr);
|
|
321
332
|
if (rawValue == nullptr) return sourceProps.onBlur;
|
|
322
333
|
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
323
|
-
return CachedProp<std::optional<std::function<void()>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onBlur);
|
|
334
|
+
return CachedProp<std::optional<std::function<void()>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, PropNameIDCache::get(*runtime, "f")), sourceProps.onBlur);
|
|
324
335
|
} catch (const std::exception& exc) {
|
|
325
336
|
throw std::runtime_error(std::string("AutoSizeInput.onBlur: ") + exc.what());
|
|
326
337
|
}
|
|
@@ -330,48 +341,15 @@ namespace margelo::nitro::autosizeinput::views {
|
|
|
330
341
|
const react::RawValue* rawValue = rawProps.at("hybridRef", nullptr, nullptr);
|
|
331
342
|
if (rawValue == nullptr) return sourceProps.hybridRef;
|
|
332
343
|
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
333
|
-
return CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridAutoSizeInputSpec>& /* ref */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.hybridRef);
|
|
344
|
+
return CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridAutoSizeInputSpec>& /* ref */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, PropNameIDCache::get(*runtime, "f")), sourceProps.hybridRef);
|
|
334
345
|
} catch (const std::exception& exc) {
|
|
335
346
|
throw std::runtime_error(std::string("AutoSizeInput.hybridRef: ") + exc.what());
|
|
336
347
|
}
|
|
337
348
|
}()) { }
|
|
338
349
|
|
|
339
|
-
HybridAutoSizeInputProps::HybridAutoSizeInputProps(const HybridAutoSizeInputProps& other):
|
|
340
|
-
react::ViewProps(),
|
|
341
|
-
text(other.text),
|
|
342
|
-
prefix(other.prefix),
|
|
343
|
-
suffix(other.suffix),
|
|
344
|
-
placeholder(other.placeholder),
|
|
345
|
-
fontSize(other.fontSize),
|
|
346
|
-
minFontSize(other.minFontSize),
|
|
347
|
-
multiline(other.multiline),
|
|
348
|
-
maxNumberOfLines(other.maxNumberOfLines),
|
|
349
|
-
textColor(other.textColor),
|
|
350
|
-
prefixColor(other.prefixColor),
|
|
351
|
-
suffixColor(other.suffixColor),
|
|
352
|
-
placeholderColor(other.placeholderColor),
|
|
353
|
-
textAlign(other.textAlign),
|
|
354
|
-
fontFamily(other.fontFamily),
|
|
355
|
-
fontWeight(other.fontWeight),
|
|
356
|
-
editable(other.editable),
|
|
357
|
-
keyboardType(other.keyboardType),
|
|
358
|
-
returnKeyType(other.returnKeyType),
|
|
359
|
-
autoCorrect(other.autoCorrect),
|
|
360
|
-
autoCapitalize(other.autoCapitalize),
|
|
361
|
-
selectionColor(other.selectionColor),
|
|
362
|
-
prefixMarginRight(other.prefixMarginRight),
|
|
363
|
-
suffixMarginLeft(other.suffixMarginLeft),
|
|
364
|
-
showBorder(other.showBorder),
|
|
365
|
-
inputBackgroundColor(other.inputBackgroundColor),
|
|
366
|
-
contentAutoWidth(other.contentAutoWidth),
|
|
367
|
-
contentCentered(other.contentCentered),
|
|
368
|
-
onChangeText(other.onChangeText),
|
|
369
|
-
onFocus(other.onFocus),
|
|
370
|
-
onBlur(other.onBlur),
|
|
371
|
-
hybridRef(other.hybridRef) { }
|
|
372
|
-
|
|
373
350
|
bool HybridAutoSizeInputProps::filterObjectKeys(const std::string& propName) {
|
|
374
351
|
switch (hashString(propName)) {
|
|
352
|
+
case hashString("mostRecentEventCount"): return true;
|
|
375
353
|
case hashString("text"): return true;
|
|
376
354
|
case hashString("prefix"): return true;
|
|
377
355
|
case hashString("suffix"): return true;
|
|
@@ -424,10 +402,10 @@ namespace margelo::nitro::autosizeinput::views {
|
|
|
424
402
|
void HybridAutoSizeInputComponentDescriptor::adopt(react::ShadowNode& shadowNode) const {
|
|
425
403
|
// This is called immediately after `ShadowNode` is created, cloned or in progress.
|
|
426
404
|
// On Android, we need to wrap props in our state, which gets routed through Java and later unwrapped in JNI/C++.
|
|
427
|
-
auto& concreteShadowNode =
|
|
428
|
-
const HybridAutoSizeInputProps
|
|
429
|
-
|
|
430
|
-
state
|
|
405
|
+
auto& concreteShadowNode = static_cast<HybridAutoSizeInputShadowNode&>(shadowNode);
|
|
406
|
+
const std::shared_ptr<const HybridAutoSizeInputProps>& constProps = concreteShadowNode.getConcreteSharedProps();
|
|
407
|
+
const std::shared_ptr<HybridAutoSizeInputProps>& props = std::const_pointer_cast<HybridAutoSizeInputProps>(constProps);
|
|
408
|
+
HybridAutoSizeInputState state{props};
|
|
431
409
|
concreteShadowNode.setStateData(std::move(state));
|
|
432
410
|
}
|
|
433
411
|
#endif
|