@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.
- package/AutoSizeInput.podspec +29 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +128 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/autosizeinput/AutoSizeInput.kt +565 -0
- package/android/src/main/java/com/margelo/nitro/autosizeinput/AutoSizeInputPackage.kt +29 -0
- package/ios/AutoSizeInput.swift +620 -0
- package/lib/module/AutoSizeInput.nitro.js +4 -0
- package/lib/module/AutoSizeInput.nitro.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/nitrogen/generated/android/autosizeinput+autolinking.cmake +83 -0
- package/lib/nitrogen/generated/android/autosizeinput+autolinking.gradle +27 -0
- package/lib/nitrogen/generated/android/autosizeinputOnLoad.cpp +50 -0
- package/lib/nitrogen/generated/android/autosizeinputOnLoad.hpp +25 -0
- package/lib/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/lib/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/lib/nitrogen/generated/android/c++/JHybridAutoSizeInputSpec.cpp +317 -0
- package/lib/nitrogen/generated/android/c++/JHybridAutoSizeInputSpec.hpp +117 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.cpp +156 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.hpp +49 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/Func_void.kt +80 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/Func_void_std__string.kt +80 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/HybridAutoSizeInputSpec.kt +239 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/autosizeinputOnLoad.kt +35 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/views/HybridAutoSizeInputManager.kt +50 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/views/HybridAutoSizeInputStateUpdater.kt +23 -0
- package/lib/nitrogen/generated/ios/AutoSizeInput+autolinking.rb +60 -0
- package/lib/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Bridge.cpp +49 -0
- package/lib/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Bridge.hpp +173 -0
- package/lib/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Umbrella.hpp +46 -0
- package/lib/nitrogen/generated/ios/AutoSizeInputAutolinking.mm +33 -0
- package/lib/nitrogen/generated/ios/AutoSizeInputAutolinking.swift +25 -0
- package/lib/nitrogen/generated/ios/c++/HybridAutoSizeInputSpecSwift.cpp +11 -0
- package/lib/nitrogen/generated/ios/c++/HybridAutoSizeInputSpecSwift.hpp +263 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridAutoSizeInputComponent.mm +221 -0
- package/lib/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/lib/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/lib/nitrogen/generated/ios/swift/HybridAutoSizeInputSpec.swift +82 -0
- package/lib/nitrogen/generated/ios/swift/HybridAutoSizeInputSpec_cxx.swift +764 -0
- package/lib/nitrogen/generated/shared/c++/HybridAutoSizeInputSpec.cpp +74 -0
- package/lib/nitrogen/generated/shared/c++/HybridAutoSizeInputSpec.hpp +116 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.cpp +387 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.hpp +133 -0
- package/lib/nitrogen/generated/shared/json/AutoSizeInputConfig.json +35 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/AutoSizeInput.nitro.d.ts +35 -0
- package/lib/typescript/src/AutoSizeInput.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/autosizeinput+autolinking.cmake +83 -0
- package/nitrogen/generated/android/autosizeinput+autolinking.gradle +27 -0
- package/nitrogen/generated/android/autosizeinputOnLoad.cpp +50 -0
- package/nitrogen/generated/android/autosizeinputOnLoad.hpp +25 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridAutoSizeInputSpec.cpp +317 -0
- package/nitrogen/generated/android/c++/JHybridAutoSizeInputSpec.hpp +117 -0
- package/nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.cpp +156 -0
- package/nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/Func_void.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/Func_void_std__string.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/HybridAutoSizeInputSpec.kt +239 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/autosizeinputOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/views/HybridAutoSizeInputManager.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/views/HybridAutoSizeInputStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/AutoSizeInput+autolinking.rb +60 -0
- package/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Bridge.cpp +49 -0
- package/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Bridge.hpp +173 -0
- package/nitrogen/generated/ios/AutoSizeInput-Swift-Cxx-Umbrella.hpp +46 -0
- package/nitrogen/generated/ios/AutoSizeInputAutolinking.mm +33 -0
- package/nitrogen/generated/ios/AutoSizeInputAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridAutoSizeInputSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridAutoSizeInputSpecSwift.hpp +263 -0
- package/nitrogen/generated/ios/c++/views/HybridAutoSizeInputComponent.mm +221 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridAutoSizeInputSpec.swift +82 -0
- package/nitrogen/generated/ios/swift/HybridAutoSizeInputSpec_cxx.swift +764 -0
- package/nitrogen/generated/shared/c++/HybridAutoSizeInputSpec.cpp +74 -0
- package/nitrogen/generated/shared/c++/HybridAutoSizeInputSpec.hpp +116 -0
- package/nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.cpp +387 -0
- package/nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.hpp +133 -0
- package/nitrogen/generated/shared/json/AutoSizeInputConfig.json +35 -0
- package/package.json +170 -0
- package/src/AutoSizeInput.nitro.ts +56 -0
- package/src/index.tsx +13 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridAutoSizeInputComponent.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
|
+
#include <optional>
|
|
11
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
12
|
+
#include <NitroModules/NitroHash.hpp>
|
|
13
|
+
#include <NitroModules/CachedProp.hpp>
|
|
14
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
16
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
18
|
+
|
|
19
|
+
#include <string>
|
|
20
|
+
#include <optional>
|
|
21
|
+
#include <functional>
|
|
22
|
+
#include <memory>
|
|
23
|
+
#include "HybridAutoSizeInputSpec.hpp"
|
|
24
|
+
|
|
25
|
+
namespace margelo::nitro::autosizeinput::views {
|
|
26
|
+
|
|
27
|
+
using namespace facebook;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The name of the actual native View.
|
|
31
|
+
*/
|
|
32
|
+
extern const char HybridAutoSizeInputComponentName[];
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Props for the "AutoSizeInput" View.
|
|
36
|
+
*/
|
|
37
|
+
class HybridAutoSizeInputProps final: public react::ViewProps {
|
|
38
|
+
public:
|
|
39
|
+
HybridAutoSizeInputProps() = default;
|
|
40
|
+
HybridAutoSizeInputProps(const HybridAutoSizeInputProps&);
|
|
41
|
+
HybridAutoSizeInputProps(const react::PropsParserContext& context,
|
|
42
|
+
const HybridAutoSizeInputProps& sourceProps,
|
|
43
|
+
const react::RawProps& rawProps);
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
CachedProp<std::optional<std::string>> text;
|
|
47
|
+
CachedProp<std::optional<std::string>> prefix;
|
|
48
|
+
CachedProp<std::optional<std::string>> suffix;
|
|
49
|
+
CachedProp<std::optional<std::string>> placeholder;
|
|
50
|
+
CachedProp<std::optional<double>> fontSize;
|
|
51
|
+
CachedProp<std::optional<double>> minFontSize;
|
|
52
|
+
CachedProp<std::optional<bool>> multiline;
|
|
53
|
+
CachedProp<std::optional<double>> maxNumberOfLines;
|
|
54
|
+
CachedProp<std::optional<std::string>> textColor;
|
|
55
|
+
CachedProp<std::optional<std::string>> prefixColor;
|
|
56
|
+
CachedProp<std::optional<std::string>> suffixColor;
|
|
57
|
+
CachedProp<std::optional<std::string>> placeholderColor;
|
|
58
|
+
CachedProp<std::optional<std::string>> textAlign;
|
|
59
|
+
CachedProp<std::optional<std::string>> fontFamily;
|
|
60
|
+
CachedProp<std::optional<std::string>> fontWeight;
|
|
61
|
+
CachedProp<std::optional<bool>> editable;
|
|
62
|
+
CachedProp<std::optional<std::string>> keyboardType;
|
|
63
|
+
CachedProp<std::optional<std::string>> returnKeyType;
|
|
64
|
+
CachedProp<std::optional<bool>> autoCorrect;
|
|
65
|
+
CachedProp<std::optional<std::string>> autoCapitalize;
|
|
66
|
+
CachedProp<std::optional<std::string>> selectionColor;
|
|
67
|
+
CachedProp<std::optional<double>> prefixMarginRight;
|
|
68
|
+
CachedProp<std::optional<double>> suffixMarginLeft;
|
|
69
|
+
CachedProp<std::optional<std::function<void(const std::string& /* text */)>>> onChangeText;
|
|
70
|
+
CachedProp<std::optional<std::function<void()>>> onFocus;
|
|
71
|
+
CachedProp<std::optional<std::function<void()>>> onBlur;
|
|
72
|
+
CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridAutoSizeInputSpec>& /* ref */)>>> hybridRef;
|
|
73
|
+
|
|
74
|
+
private:
|
|
75
|
+
static bool filterObjectKeys(const std::string& propName);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* State for the "AutoSizeInput" View.
|
|
80
|
+
*/
|
|
81
|
+
class HybridAutoSizeInputState final {
|
|
82
|
+
public:
|
|
83
|
+
HybridAutoSizeInputState() = default;
|
|
84
|
+
|
|
85
|
+
public:
|
|
86
|
+
void setProps(const HybridAutoSizeInputProps& props) { _props.emplace(props); }
|
|
87
|
+
const std::optional<HybridAutoSizeInputProps>& getProps() const { return _props; }
|
|
88
|
+
|
|
89
|
+
public:
|
|
90
|
+
#ifdef ANDROID
|
|
91
|
+
HybridAutoSizeInputState(const HybridAutoSizeInputState& /* previousState */, folly::dynamic /* data */) {}
|
|
92
|
+
folly::dynamic getDynamic() const {
|
|
93
|
+
throw std::runtime_error("HybridAutoSizeInputState does not support folly!");
|
|
94
|
+
}
|
|
95
|
+
react::MapBuffer getMapBuffer() const {
|
|
96
|
+
throw std::runtime_error("HybridAutoSizeInputState does not support MapBuffer!");
|
|
97
|
+
};
|
|
98
|
+
#endif
|
|
99
|
+
|
|
100
|
+
private:
|
|
101
|
+
std::optional<HybridAutoSizeInputProps> _props;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The Shadow Node for the "AutoSizeInput" View.
|
|
106
|
+
*/
|
|
107
|
+
using HybridAutoSizeInputShadowNode = react::ConcreteViewShadowNode<HybridAutoSizeInputComponentName /* "HybridAutoSizeInput" */,
|
|
108
|
+
HybridAutoSizeInputProps /* custom props */,
|
|
109
|
+
react::ViewEventEmitter /* default */,
|
|
110
|
+
HybridAutoSizeInputState /* custom state */>;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The Component Descriptor for the "AutoSizeInput" View.
|
|
114
|
+
*/
|
|
115
|
+
class HybridAutoSizeInputComponentDescriptor final: public react::ConcreteComponentDescriptor<HybridAutoSizeInputShadowNode> {
|
|
116
|
+
public:
|
|
117
|
+
HybridAutoSizeInputComponentDescriptor(const react::ComponentDescriptorParameters& parameters);
|
|
118
|
+
|
|
119
|
+
public:
|
|
120
|
+
/**
|
|
121
|
+
* A faster path for cloning props - reuses the caching logic from `HybridAutoSizeInputProps`.
|
|
122
|
+
*/
|
|
123
|
+
std::shared_ptr<const react::Props> cloneProps(const react::PropsParserContext& context,
|
|
124
|
+
const std::shared_ptr<const react::Props>& props,
|
|
125
|
+
react::RawProps rawProps) const override;
|
|
126
|
+
#ifdef ANDROID
|
|
127
|
+
void adopt(react::ShadowNode& shadowNode) const override;
|
|
128
|
+
#endif
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/* The actual view for "AutoSizeInput" needs to be implemented in platform-specific code. */
|
|
132
|
+
|
|
133
|
+
} // namespace margelo::nitro::autosizeinput::views
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"uiViewClassName": "AutoSizeInput",
|
|
3
|
+
"supportsRawText": false,
|
|
4
|
+
"bubblingEventTypes": {},
|
|
5
|
+
"directEventTypes": {},
|
|
6
|
+
"validAttributes": {
|
|
7
|
+
"text": true,
|
|
8
|
+
"prefix": true,
|
|
9
|
+
"suffix": true,
|
|
10
|
+
"placeholder": true,
|
|
11
|
+
"fontSize": true,
|
|
12
|
+
"minFontSize": true,
|
|
13
|
+
"multiline": true,
|
|
14
|
+
"maxNumberOfLines": true,
|
|
15
|
+
"textColor": true,
|
|
16
|
+
"prefixColor": true,
|
|
17
|
+
"suffixColor": true,
|
|
18
|
+
"placeholderColor": true,
|
|
19
|
+
"textAlign": true,
|
|
20
|
+
"fontFamily": true,
|
|
21
|
+
"fontWeight": true,
|
|
22
|
+
"editable": true,
|
|
23
|
+
"keyboardType": true,
|
|
24
|
+
"returnKeyType": true,
|
|
25
|
+
"autoCorrect": true,
|
|
26
|
+
"autoCapitalize": true,
|
|
27
|
+
"selectionColor": true,
|
|
28
|
+
"prefixMarginRight": true,
|
|
29
|
+
"suffixMarginLeft": true,
|
|
30
|
+
"onChangeText": true,
|
|
31
|
+
"onFocus": true,
|
|
32
|
+
"onBlur": true,
|
|
33
|
+
"hybridRef": true
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { HybridView, HybridViewMethods, HybridViewProps } from 'react-native-nitro-modules';
|
|
2
|
+
export interface AutoSizeInputProps extends HybridViewProps {
|
|
3
|
+
text?: string;
|
|
4
|
+
prefix?: string;
|
|
5
|
+
suffix?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
fontSize?: number;
|
|
8
|
+
minFontSize?: number;
|
|
9
|
+
multiline?: boolean;
|
|
10
|
+
maxNumberOfLines?: number;
|
|
11
|
+
textColor?: string;
|
|
12
|
+
prefixColor?: string;
|
|
13
|
+
suffixColor?: string;
|
|
14
|
+
placeholderColor?: string;
|
|
15
|
+
textAlign?: string;
|
|
16
|
+
fontFamily?: string;
|
|
17
|
+
fontWeight?: string;
|
|
18
|
+
editable?: boolean;
|
|
19
|
+
keyboardType?: string;
|
|
20
|
+
returnKeyType?: string;
|
|
21
|
+
autoCorrect?: boolean;
|
|
22
|
+
autoCapitalize?: string;
|
|
23
|
+
selectionColor?: string;
|
|
24
|
+
prefixMarginRight?: number;
|
|
25
|
+
suffixMarginLeft?: number;
|
|
26
|
+
onChangeText?: (text: string) => void;
|
|
27
|
+
onFocus?: () => void;
|
|
28
|
+
onBlur?: () => void;
|
|
29
|
+
}
|
|
30
|
+
export interface AutoSizeInputMethods extends HybridViewMethods {
|
|
31
|
+
focus(): void;
|
|
32
|
+
blur(): void;
|
|
33
|
+
}
|
|
34
|
+
export type AutoSizeInput = HybridView<AutoSizeInputProps, AutoSizeInputMethods>;
|
|
35
|
+
//# sourceMappingURL=AutoSizeInput.nitro.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoSizeInput.nitro.d.ts","sourceRoot":"","sources":["../../../src/AutoSizeInput.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IAEzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAG1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IAGxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAG1B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,IAAI,CAAC;CACd;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AutoSizeInputMethods, AutoSizeInputProps } from './AutoSizeInput.nitro';
|
|
2
|
+
export type { AutoSizeInputMethods, AutoSizeInputProps };
|
|
3
|
+
export declare const AutoSizeInputView: import("react-native-nitro-modules").ReactNativeView<AutoSizeInputProps, AutoSizeInputMethods>;
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,CAAC;AAEzD,eAAO,MAAM,iBAAiB,gGAGe,CAAC"}
|
package/nitro.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cxxNamespace": ["autosizeinput"],
|
|
3
|
+
"ios": {
|
|
4
|
+
"iosModuleName": "AutoSizeInput"
|
|
5
|
+
},
|
|
6
|
+
"android": {
|
|
7
|
+
"androidNamespace": ["autosizeinput"],
|
|
8
|
+
"androidCxxLibName": "autosizeinput"
|
|
9
|
+
},
|
|
10
|
+
"autolinking": {
|
|
11
|
+
"AutoSizeInput": {
|
|
12
|
+
"swift": "HybridAutoSizeInput",
|
|
13
|
+
"kotlin": "HybridAutoSizeInput"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"ignorePaths": ["node_modules"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#
|
|
2
|
+
# autosizeinput+autolinking.cmake
|
|
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
|
+
# This is a CMake file that adds all files generated by Nitrogen
|
|
9
|
+
# to the current CMake project.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your CMakeLists.txt:
|
|
12
|
+
# ```cmake
|
|
13
|
+
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/autosizeinput+autolinking.cmake)
|
|
14
|
+
# ```
|
|
15
|
+
|
|
16
|
+
# Define a flag to check if we are building properly
|
|
17
|
+
add_definitions(-DBUILDING_AUTOSIZEINPUT_WITH_GENERATED_CMAKE_PROJECT)
|
|
18
|
+
|
|
19
|
+
# Enable Raw Props parsing in react-native (for Nitro Views)
|
|
20
|
+
add_definitions(-DRN_SERIALIZABLE_STATE)
|
|
21
|
+
|
|
22
|
+
# Add all headers that were generated by Nitrogen
|
|
23
|
+
include_directories(
|
|
24
|
+
"../nitrogen/generated/shared/c++"
|
|
25
|
+
"../nitrogen/generated/android/c++"
|
|
26
|
+
"../nitrogen/generated/android/"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Add all .cpp sources that were generated by Nitrogen
|
|
30
|
+
target_sources(
|
|
31
|
+
# CMake project name (Android C++ library name)
|
|
32
|
+
autosizeinput PRIVATE
|
|
33
|
+
# Autolinking Setup
|
|
34
|
+
../nitrogen/generated/android/autosizeinputOnLoad.cpp
|
|
35
|
+
# Shared Nitrogen C++ sources
|
|
36
|
+
../nitrogen/generated/shared/c++/HybridAutoSizeInputSpec.cpp
|
|
37
|
+
../nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.cpp
|
|
38
|
+
# Android-specific Nitrogen C++ sources
|
|
39
|
+
../nitrogen/generated/android/c++/JHybridAutoSizeInputSpec.cpp
|
|
40
|
+
../nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.cpp
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
44
|
+
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
|
45
|
+
target_compile_definitions(
|
|
46
|
+
autosizeinput PRIVATE
|
|
47
|
+
-DFOLLY_NO_CONFIG=1
|
|
48
|
+
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
49
|
+
-DFOLLY_USE_LIBCPP=1
|
|
50
|
+
-DFOLLY_CFG_NO_COROUTINES=1
|
|
51
|
+
-DFOLLY_MOBILE=1
|
|
52
|
+
-DFOLLY_HAVE_RECVMMSG=1
|
|
53
|
+
-DFOLLY_HAVE_PTHREAD=1
|
|
54
|
+
# Once we target android-23 above, we can comment
|
|
55
|
+
# the following line. NDK uses GNU style stderror_r() after API 23.
|
|
56
|
+
-DFOLLY_HAVE_XSI_STRERROR_R=1
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# Add all libraries required by the generated specs
|
|
60
|
+
find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
|
|
61
|
+
find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
|
|
62
|
+
find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
|
|
63
|
+
|
|
64
|
+
# Link all libraries together
|
|
65
|
+
target_link_libraries(
|
|
66
|
+
autosizeinput
|
|
67
|
+
fbjni::fbjni # <-- Facebook C++ JNI helpers
|
|
68
|
+
ReactAndroid::jsi # <-- RN: JSI
|
|
69
|
+
react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# Link react-native (different prefab between RN 0.75 and RN 0.76)
|
|
73
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
74
|
+
target_link_libraries(
|
|
75
|
+
autosizeinput
|
|
76
|
+
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
|
|
77
|
+
)
|
|
78
|
+
else()
|
|
79
|
+
target_link_libraries(
|
|
80
|
+
autosizeinput
|
|
81
|
+
ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
|
|
82
|
+
)
|
|
83
|
+
endif()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// autosizeinput+autolinking.gradle
|
|
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
|
+
/// This is a Gradle file that adds all files generated by Nitrogen
|
|
9
|
+
/// to the current Gradle project.
|
|
10
|
+
///
|
|
11
|
+
/// To use it, add this to your build.gradle:
|
|
12
|
+
/// ```gradle
|
|
13
|
+
/// apply from: '../nitrogen/generated/android/autosizeinput+autolinking.gradle'
|
|
14
|
+
/// ```
|
|
15
|
+
|
|
16
|
+
logger.warn("[NitroModules] 🔥 autosizeinput is boosted by nitro!")
|
|
17
|
+
|
|
18
|
+
android {
|
|
19
|
+
sourceSets {
|
|
20
|
+
main {
|
|
21
|
+
java.srcDirs += [
|
|
22
|
+
// Nitrogen files
|
|
23
|
+
"${project.projectDir}/../nitrogen/generated/android/kotlin"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// autosizeinputOnLoad.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
|
+
#ifndef BUILDING_AUTOSIZEINPUT_WITH_GENERATED_CMAKE_PROJECT
|
|
9
|
+
#error autosizeinputOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
#include "autosizeinputOnLoad.hpp"
|
|
13
|
+
|
|
14
|
+
#include <jni.h>
|
|
15
|
+
#include <fbjni/fbjni.h>
|
|
16
|
+
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
|
+
|
|
18
|
+
#include "JHybridAutoSizeInputSpec.hpp"
|
|
19
|
+
#include "JFunc_void_std__string.hpp"
|
|
20
|
+
#include "JFunc_void.hpp"
|
|
21
|
+
#include "views/JHybridAutoSizeInputStateUpdater.hpp"
|
|
22
|
+
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
23
|
+
|
|
24
|
+
namespace margelo::nitro::autosizeinput {
|
|
25
|
+
|
|
26
|
+
int initialize(JavaVM* vm) {
|
|
27
|
+
using namespace margelo::nitro;
|
|
28
|
+
using namespace margelo::nitro::autosizeinput;
|
|
29
|
+
using namespace facebook;
|
|
30
|
+
|
|
31
|
+
return facebook::jni::initialize(vm, [] {
|
|
32
|
+
// Register native JNI methods
|
|
33
|
+
margelo::nitro::autosizeinput::JHybridAutoSizeInputSpec::registerNatives();
|
|
34
|
+
margelo::nitro::autosizeinput::JFunc_void_std__string_cxx::registerNatives();
|
|
35
|
+
margelo::nitro::autosizeinput::JFunc_void_cxx::registerNatives();
|
|
36
|
+
margelo::nitro::autosizeinput::views::JHybridAutoSizeInputStateUpdater::registerNatives();
|
|
37
|
+
|
|
38
|
+
// Register Nitro Hybrid Objects
|
|
39
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
40
|
+
"AutoSizeInput",
|
|
41
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
42
|
+
static DefaultConstructableObject<JHybridAutoSizeInputSpec::javaobject> object("com/margelo/nitro/autosizeinput/HybridAutoSizeInput");
|
|
43
|
+
auto instance = object.create();
|
|
44
|
+
return instance->cthis()->shared();
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
} // namespace margelo::nitro::autosizeinput
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// autosizeinputOnLoad.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
|
+
#include <jni.h>
|
|
9
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
10
|
+
|
|
11
|
+
namespace margelo::nitro::autosizeinput {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Initializes the native (C++) part of autosizeinput, and autolinks all Hybrid Objects.
|
|
15
|
+
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`).
|
|
16
|
+
* Example:
|
|
17
|
+
* ```cpp (cpp-adapter.cpp)
|
|
18
|
+
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
19
|
+
* return margelo::nitro::autosizeinput::initialize(vm);
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
int initialize(JavaVM* vm);
|
|
24
|
+
|
|
25
|
+
} // namespace margelo::nitro::autosizeinput
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include <functional>
|
|
14
|
+
#include <NitroModules/JNICallable.hpp>
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::autosizeinput {
|
|
17
|
+
|
|
18
|
+
using namespace facebook;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Represents the Java/Kotlin callback `() -> Unit`.
|
|
22
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
23
|
+
*/
|
|
24
|
+
struct JFunc_void: public jni::JavaClass<JFunc_void> {
|
|
25
|
+
public:
|
|
26
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/autosizeinput/Func_void;";
|
|
27
|
+
|
|
28
|
+
public:
|
|
29
|
+
/**
|
|
30
|
+
* Invokes the function this `JFunc_void` instance holds through JNI.
|
|
31
|
+
*/
|
|
32
|
+
void invoke() const {
|
|
33
|
+
static const auto method = javaClassStatic()->getMethod<void()>("invoke");
|
|
34
|
+
method(self());
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* An implementation of Func_void that is backed by a C++ implementation (using `std::function<...>`)
|
|
40
|
+
*/
|
|
41
|
+
class JFunc_void_cxx final: public jni::HybridClass<JFunc_void_cxx, JFunc_void> {
|
|
42
|
+
public:
|
|
43
|
+
static jni::local_ref<JFunc_void::javaobject> fromCpp(const std::function<void()>& func) {
|
|
44
|
+
return JFunc_void_cxx::newObjectCxxArgs(func);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
/**
|
|
49
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_cxx` instance holds.
|
|
50
|
+
*/
|
|
51
|
+
void invoke_cxx() {
|
|
52
|
+
_func();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
[[nodiscard]]
|
|
57
|
+
inline const std::function<void()>& getFunction() const {
|
|
58
|
+
return _func;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/autosizeinput/Func_void_cxx;";
|
|
63
|
+
static void registerNatives() {
|
|
64
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_cxx::invoke_cxx)});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private:
|
|
68
|
+
explicit JFunc_void_cxx(const std::function<void()>& func): _func(func) { }
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
friend HybridBase;
|
|
72
|
+
std::function<void()> _func;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro::autosizeinput
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_std__string.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include <NitroModules/JNICallable.hpp>
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::autosizeinput {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Represents the Java/Kotlin callback `(text: String) -> Unit`.
|
|
23
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
24
|
+
*/
|
|
25
|
+
struct JFunc_void_std__string: public jni::JavaClass<JFunc_void_std__string> {
|
|
26
|
+
public:
|
|
27
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/autosizeinput/Func_void_std__string;";
|
|
28
|
+
|
|
29
|
+
public:
|
|
30
|
+
/**
|
|
31
|
+
* Invokes the function this `JFunc_void_std__string` instance holds through JNI.
|
|
32
|
+
*/
|
|
33
|
+
void invoke(const std::string& text) const {
|
|
34
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* text */)>("invoke");
|
|
35
|
+
method(self(), jni::make_jstring(text));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* An implementation of Func_void_std__string that is backed by a C++ implementation (using `std::function<...>`)
|
|
41
|
+
*/
|
|
42
|
+
class JFunc_void_std__string_cxx final: public jni::HybridClass<JFunc_void_std__string_cxx, JFunc_void_std__string> {
|
|
43
|
+
public:
|
|
44
|
+
static jni::local_ref<JFunc_void_std__string::javaobject> fromCpp(const std::function<void(const std::string& /* text */)>& func) {
|
|
45
|
+
return JFunc_void_std__string_cxx::newObjectCxxArgs(func);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
/**
|
|
50
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_std__string_cxx` instance holds.
|
|
51
|
+
*/
|
|
52
|
+
void invoke_cxx(jni::alias_ref<jni::JString> text) {
|
|
53
|
+
_func(text->toStdString());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
[[nodiscard]]
|
|
58
|
+
inline const std::function<void(const std::string& /* text */)>& getFunction() const {
|
|
59
|
+
return _func;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public:
|
|
63
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/autosizeinput/Func_void_std__string_cxx;";
|
|
64
|
+
static void registerNatives() {
|
|
65
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__string_cxx::invoke_cxx)});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private:
|
|
69
|
+
explicit JFunc_void_std__string_cxx(const std::function<void(const std::string& /* text */)>& func): _func(func) { }
|
|
70
|
+
|
|
71
|
+
private:
|
|
72
|
+
friend HybridBase;
|
|
73
|
+
std::function<void(const std::string& /* text */)> _func;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro::autosizeinput
|