@onekeyfe/react-native-auto-size-input 3.0.96 → 3.0.98
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/lib/nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.cpp +187 -139
- package/lib/nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.hpp +6 -1
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/views/HybridAutoSizeInputManager.kt +26 -10
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/views/HybridAutoSizeInputStateUpdater.kt +2 -2
- package/lib/nitrogen/generated/ios/c++/views/HybridAutoSizeInputComponent.mm +223 -171
- package/lib/nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.cpp +36 -355
- package/lib/nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.hpp +113 -79
- package/nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.cpp +187 -139
- package/nitrogen/generated/android/c++/views/JHybridAutoSizeInputStateUpdater.hpp +6 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/views/HybridAutoSizeInputManager.kt +26 -10
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/autosizeinput/views/HybridAutoSizeInputStateUpdater.kt +2 -2
- package/nitrogen/generated/ios/c++/views/HybridAutoSizeInputComponent.mm +223 -171
- package/nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.cpp +36 -355
- package/nitrogen/generated/shared/c++/views/HybridAutoSizeInputComponent.hpp +113 -79
- package/package.json +4 -4
|
@@ -37,6 +37,7 @@ using namespace margelo::nitro::autosizeinput::views;
|
|
|
37
37
|
|
|
38
38
|
@implementation HybridAutoSizeInputComponent {
|
|
39
39
|
std::shared_ptr<HybridAutoSizeInputSpecSwift> _hybridView;
|
|
40
|
+
BOOL _didDropView;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
+ (void) load {
|
|
@@ -50,6 +51,7 @@ using namespace margelo::nitro::autosizeinput::views;
|
|
|
50
51
|
|
|
51
52
|
- (instancetype) init {
|
|
52
53
|
if (self = [super init]) {
|
|
54
|
+
_props = HybridAutoSizeInputShadowNode::defaultSharedProps();
|
|
53
55
|
std::shared_ptr<HybridAutoSizeInputSpec> hybridView = AutoSizeInput::AutoSizeInputAutolinking::createAutoSizeInput();
|
|
54
56
|
_hybridView = std::dynamic_pointer_cast<HybridAutoSizeInputSpecSwift>(hybridView);
|
|
55
57
|
[self updateView];
|
|
@@ -69,185 +71,235 @@ using namespace margelo::nitro::autosizeinput::views;
|
|
|
69
71
|
[self setContentView:view];
|
|
70
72
|
}
|
|
71
73
|
|
|
74
|
+
- (void) notifyOnDropView {
|
|
75
|
+
// A recycled component can later be invalidated. Notify only once per mount.
|
|
76
|
+
if (_didDropView) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
AutoSizeInput::HybridAutoSizeInputSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
80
|
+
swiftPart.onDropView();
|
|
81
|
+
_didDropView = YES;
|
|
82
|
+
}
|
|
83
|
+
|
|
72
84
|
- (void) updateProps:(const std::shared_ptr<const react::Props>&)props
|
|
73
85
|
oldProps:(const std::shared_ptr<const react::Props>&)oldProps {
|
|
86
|
+
// A props update marks a newly mounted or still-active component.
|
|
87
|
+
_didDropView = NO;
|
|
88
|
+
|
|
74
89
|
// 1. Downcast props
|
|
75
|
-
const auto&
|
|
76
|
-
auto
|
|
90
|
+
const auto& newViewProps = *std::static_pointer_cast<const HybridAutoSizeInputProps>(props);
|
|
91
|
+
const auto* oldViewProps = static_cast<const HybridAutoSizeInputProps*>(oldProps.get());
|
|
77
92
|
AutoSizeInput::HybridAutoSizeInputSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
78
93
|
|
|
79
|
-
// 2. Update
|
|
80
|
-
|
|
94
|
+
// 2. Update only props that differ from the previous Props snapshot.
|
|
95
|
+
const bool hasTransactionPropChanges = oldViewProps == nullptr
|
|
96
|
+
? newViewProps.hasAnyProvidedProps()
|
|
97
|
+
: !newViewProps.hasSameProps(*oldViewProps);
|
|
98
|
+
if (hasTransactionPropChanges) {
|
|
99
|
+
swiftPart.beforeUpdate();
|
|
81
100
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
101
|
+
// mostRecentEventCount: optional
|
|
102
|
+
if (oldViewProps == nullptr
|
|
103
|
+
? newViewProps.mostRecentEventCount.isProvided()
|
|
104
|
+
: !newViewProps.mostRecentEventCount.hasSameValue(oldViewProps->mostRecentEventCount)) {
|
|
105
|
+
swiftPart.setMostRecentEventCount(newViewProps.mostRecentEventCount.get());
|
|
106
|
+
}
|
|
107
|
+
// text: optional
|
|
108
|
+
if (oldViewProps == nullptr
|
|
109
|
+
? newViewProps.text.isProvided()
|
|
110
|
+
: !newViewProps.text.hasSameValue(oldViewProps->text)) {
|
|
111
|
+
swiftPart.setText(newViewProps.text.get());
|
|
112
|
+
}
|
|
113
|
+
// prefix: optional
|
|
114
|
+
if (oldViewProps == nullptr
|
|
115
|
+
? newViewProps.prefix.isProvided()
|
|
116
|
+
: !newViewProps.prefix.hasSameValue(oldViewProps->prefix)) {
|
|
117
|
+
swiftPart.setPrefix(newViewProps.prefix.get());
|
|
118
|
+
}
|
|
119
|
+
// suffix: optional
|
|
120
|
+
if (oldViewProps == nullptr
|
|
121
|
+
? newViewProps.suffix.isProvided()
|
|
122
|
+
: !newViewProps.suffix.hasSameValue(oldViewProps->suffix)) {
|
|
123
|
+
swiftPart.setSuffix(newViewProps.suffix.get());
|
|
124
|
+
}
|
|
125
|
+
// placeholder: optional
|
|
126
|
+
if (oldViewProps == nullptr
|
|
127
|
+
? newViewProps.placeholder.isProvided()
|
|
128
|
+
: !newViewProps.placeholder.hasSameValue(oldViewProps->placeholder)) {
|
|
129
|
+
swiftPart.setPlaceholder(newViewProps.placeholder.get());
|
|
130
|
+
}
|
|
131
|
+
// fontSize: optional
|
|
132
|
+
if (oldViewProps == nullptr
|
|
133
|
+
? newViewProps.fontSize.isProvided()
|
|
134
|
+
: !newViewProps.fontSize.hasSameValue(oldViewProps->fontSize)) {
|
|
135
|
+
swiftPart.setFontSize(newViewProps.fontSize.get());
|
|
136
|
+
}
|
|
137
|
+
// minFontSize: optional
|
|
138
|
+
if (oldViewProps == nullptr
|
|
139
|
+
? newViewProps.minFontSize.isProvided()
|
|
140
|
+
: !newViewProps.minFontSize.hasSameValue(oldViewProps->minFontSize)) {
|
|
141
|
+
swiftPart.setMinFontSize(newViewProps.minFontSize.get());
|
|
142
|
+
}
|
|
143
|
+
// multiline: optional
|
|
144
|
+
if (oldViewProps == nullptr
|
|
145
|
+
? newViewProps.multiline.isProvided()
|
|
146
|
+
: !newViewProps.multiline.hasSameValue(oldViewProps->multiline)) {
|
|
147
|
+
swiftPart.setMultiline(newViewProps.multiline.get());
|
|
148
|
+
}
|
|
149
|
+
// maxNumberOfLines: optional
|
|
150
|
+
if (oldViewProps == nullptr
|
|
151
|
+
? newViewProps.maxNumberOfLines.isProvided()
|
|
152
|
+
: !newViewProps.maxNumberOfLines.hasSameValue(oldViewProps->maxNumberOfLines)) {
|
|
153
|
+
swiftPart.setMaxNumberOfLines(newViewProps.maxNumberOfLines.get());
|
|
154
|
+
}
|
|
155
|
+
// textColor: optional
|
|
156
|
+
if (oldViewProps == nullptr
|
|
157
|
+
? newViewProps.textColor.isProvided()
|
|
158
|
+
: !newViewProps.textColor.hasSameValue(oldViewProps->textColor)) {
|
|
159
|
+
swiftPart.setTextColor(newViewProps.textColor.get());
|
|
160
|
+
}
|
|
161
|
+
// prefixColor: optional
|
|
162
|
+
if (oldViewProps == nullptr
|
|
163
|
+
? newViewProps.prefixColor.isProvided()
|
|
164
|
+
: !newViewProps.prefixColor.hasSameValue(oldViewProps->prefixColor)) {
|
|
165
|
+
swiftPart.setPrefixColor(newViewProps.prefixColor.get());
|
|
166
|
+
}
|
|
167
|
+
// suffixColor: optional
|
|
168
|
+
if (oldViewProps == nullptr
|
|
169
|
+
? newViewProps.suffixColor.isProvided()
|
|
170
|
+
: !newViewProps.suffixColor.hasSameValue(oldViewProps->suffixColor)) {
|
|
171
|
+
swiftPart.setSuffixColor(newViewProps.suffixColor.get());
|
|
172
|
+
}
|
|
173
|
+
// placeholderColor: optional
|
|
174
|
+
if (oldViewProps == nullptr
|
|
175
|
+
? newViewProps.placeholderColor.isProvided()
|
|
176
|
+
: !newViewProps.placeholderColor.hasSameValue(oldViewProps->placeholderColor)) {
|
|
177
|
+
swiftPart.setPlaceholderColor(newViewProps.placeholderColor.get());
|
|
178
|
+
}
|
|
179
|
+
// textAlign: optional
|
|
180
|
+
if (oldViewProps == nullptr
|
|
181
|
+
? newViewProps.textAlign.isProvided()
|
|
182
|
+
: !newViewProps.textAlign.hasSameValue(oldViewProps->textAlign)) {
|
|
183
|
+
swiftPart.setTextAlign(newViewProps.textAlign.get());
|
|
184
|
+
}
|
|
185
|
+
// fontFamily: optional
|
|
186
|
+
if (oldViewProps == nullptr
|
|
187
|
+
? newViewProps.fontFamily.isProvided()
|
|
188
|
+
: !newViewProps.fontFamily.hasSameValue(oldViewProps->fontFamily)) {
|
|
189
|
+
swiftPart.setFontFamily(newViewProps.fontFamily.get());
|
|
190
|
+
}
|
|
191
|
+
// fontWeight: optional
|
|
192
|
+
if (oldViewProps == nullptr
|
|
193
|
+
? newViewProps.fontWeight.isProvided()
|
|
194
|
+
: !newViewProps.fontWeight.hasSameValue(oldViewProps->fontWeight)) {
|
|
195
|
+
swiftPart.setFontWeight(newViewProps.fontWeight.get());
|
|
196
|
+
}
|
|
197
|
+
// editable: optional
|
|
198
|
+
if (oldViewProps == nullptr
|
|
199
|
+
? newViewProps.editable.isProvided()
|
|
200
|
+
: !newViewProps.editable.hasSameValue(oldViewProps->editable)) {
|
|
201
|
+
swiftPart.setEditable(newViewProps.editable.get());
|
|
202
|
+
}
|
|
203
|
+
// keyboardType: optional
|
|
204
|
+
if (oldViewProps == nullptr
|
|
205
|
+
? newViewProps.keyboardType.isProvided()
|
|
206
|
+
: !newViewProps.keyboardType.hasSameValue(oldViewProps->keyboardType)) {
|
|
207
|
+
swiftPart.setKeyboardType(newViewProps.keyboardType.get());
|
|
208
|
+
}
|
|
209
|
+
// returnKeyType: optional
|
|
210
|
+
if (oldViewProps == nullptr
|
|
211
|
+
? newViewProps.returnKeyType.isProvided()
|
|
212
|
+
: !newViewProps.returnKeyType.hasSameValue(oldViewProps->returnKeyType)) {
|
|
213
|
+
swiftPart.setReturnKeyType(newViewProps.returnKeyType.get());
|
|
214
|
+
}
|
|
215
|
+
// autoCorrect: optional
|
|
216
|
+
if (oldViewProps == nullptr
|
|
217
|
+
? newViewProps.autoCorrect.isProvided()
|
|
218
|
+
: !newViewProps.autoCorrect.hasSameValue(oldViewProps->autoCorrect)) {
|
|
219
|
+
swiftPart.setAutoCorrect(newViewProps.autoCorrect.get());
|
|
220
|
+
}
|
|
221
|
+
// autoCapitalize: optional
|
|
222
|
+
if (oldViewProps == nullptr
|
|
223
|
+
? newViewProps.autoCapitalize.isProvided()
|
|
224
|
+
: !newViewProps.autoCapitalize.hasSameValue(oldViewProps->autoCapitalize)) {
|
|
225
|
+
swiftPart.setAutoCapitalize(newViewProps.autoCapitalize.get());
|
|
226
|
+
}
|
|
227
|
+
// selectionColor: optional
|
|
228
|
+
if (oldViewProps == nullptr
|
|
229
|
+
? newViewProps.selectionColor.isProvided()
|
|
230
|
+
: !newViewProps.selectionColor.hasSameValue(oldViewProps->selectionColor)) {
|
|
231
|
+
swiftPart.setSelectionColor(newViewProps.selectionColor.get());
|
|
232
|
+
}
|
|
233
|
+
// prefixMarginRight: optional
|
|
234
|
+
if (oldViewProps == nullptr
|
|
235
|
+
? newViewProps.prefixMarginRight.isProvided()
|
|
236
|
+
: !newViewProps.prefixMarginRight.hasSameValue(oldViewProps->prefixMarginRight)) {
|
|
237
|
+
swiftPart.setPrefixMarginRight(newViewProps.prefixMarginRight.get());
|
|
238
|
+
}
|
|
239
|
+
// suffixMarginLeft: optional
|
|
240
|
+
if (oldViewProps == nullptr
|
|
241
|
+
? newViewProps.suffixMarginLeft.isProvided()
|
|
242
|
+
: !newViewProps.suffixMarginLeft.hasSameValue(oldViewProps->suffixMarginLeft)) {
|
|
243
|
+
swiftPart.setSuffixMarginLeft(newViewProps.suffixMarginLeft.get());
|
|
244
|
+
}
|
|
245
|
+
// showBorder: optional
|
|
246
|
+
if (oldViewProps == nullptr
|
|
247
|
+
? newViewProps.showBorder.isProvided()
|
|
248
|
+
: !newViewProps.showBorder.hasSameValue(oldViewProps->showBorder)) {
|
|
249
|
+
swiftPart.setShowBorder(newViewProps.showBorder.get());
|
|
250
|
+
}
|
|
251
|
+
// inputBackgroundColor: optional
|
|
252
|
+
if (oldViewProps == nullptr
|
|
253
|
+
? newViewProps.inputBackgroundColor.isProvided()
|
|
254
|
+
: !newViewProps.inputBackgroundColor.hasSameValue(oldViewProps->inputBackgroundColor)) {
|
|
255
|
+
swiftPart.setInputBackgroundColor(newViewProps.inputBackgroundColor.get());
|
|
256
|
+
}
|
|
257
|
+
// contentAutoWidth: optional
|
|
258
|
+
if (oldViewProps == nullptr
|
|
259
|
+
? newViewProps.contentAutoWidth.isProvided()
|
|
260
|
+
: !newViewProps.contentAutoWidth.hasSameValue(oldViewProps->contentAutoWidth)) {
|
|
261
|
+
swiftPart.setContentAutoWidth(newViewProps.contentAutoWidth.get());
|
|
262
|
+
}
|
|
263
|
+
// contentCentered: optional
|
|
264
|
+
if (oldViewProps == nullptr
|
|
265
|
+
? newViewProps.contentCentered.isProvided()
|
|
266
|
+
: !newViewProps.contentCentered.hasSameValue(oldViewProps->contentCentered)) {
|
|
267
|
+
swiftPart.setContentCentered(newViewProps.contentCentered.get());
|
|
268
|
+
}
|
|
269
|
+
// onChangeText: optional
|
|
270
|
+
if (oldViewProps == nullptr
|
|
271
|
+
? newViewProps.onChangeText.isProvided()
|
|
272
|
+
: !newViewProps.onChangeText.hasSameValue(oldViewProps->onChangeText)) {
|
|
273
|
+
swiftPart.setOnChangeText(newViewProps.onChangeText.get());
|
|
274
|
+
}
|
|
275
|
+
// onFocus: optional
|
|
276
|
+
if (oldViewProps == nullptr
|
|
277
|
+
? newViewProps.onFocus.isProvided()
|
|
278
|
+
: !newViewProps.onFocus.hasSameValue(oldViewProps->onFocus)) {
|
|
279
|
+
swiftPart.setOnFocus(newViewProps.onFocus.get());
|
|
280
|
+
}
|
|
281
|
+
// onBlur: optional
|
|
282
|
+
if (oldViewProps == nullptr
|
|
283
|
+
? newViewProps.onBlur.isProvided()
|
|
284
|
+
: !newViewProps.onBlur.hasSameValue(oldViewProps->onBlur)) {
|
|
285
|
+
swiftPart.setOnBlur(newViewProps.onBlur.get());
|
|
286
|
+
}
|
|
237
287
|
|
|
238
|
-
|
|
288
|
+
// Update hybridRef if it changed
|
|
289
|
+
if (oldViewProps == nullptr
|
|
290
|
+
? newViewProps.hybridRef.isProvided()
|
|
291
|
+
: !newViewProps.hybridRef.hasSameValue(oldViewProps->hybridRef)) {
|
|
292
|
+
// hybridRef changed - call it with new this
|
|
293
|
+
const auto& maybeFunc = newViewProps.hybridRef.get();
|
|
294
|
+
if (maybeFunc.has_value()) {
|
|
295
|
+
maybeFunc.value()(_hybridView);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
239
298
|
|
|
240
|
-
|
|
241
|
-
if (newViewProps.hybridRef.isDirty) {
|
|
242
|
-
// hybridRef changed - call it with new this
|
|
243
|
-
const auto& maybeFunc = newViewProps.hybridRef.value;
|
|
244
|
-
if (maybeFunc.has_value()) {
|
|
245
|
-
maybeFunc.value()(_hybridView);
|
|
246
|
-
}
|
|
247
|
-
newViewProps.hybridRef.isDirty = false;
|
|
299
|
+
swiftPart.afterUpdate();
|
|
248
300
|
}
|
|
249
301
|
|
|
250
|
-
//
|
|
302
|
+
// 3. Continue in base class
|
|
251
303
|
[super updateProps:props oldProps:oldProps];
|
|
252
304
|
}
|
|
253
305
|
|
|
@@ -256,6 +308,7 @@ using namespace margelo::nitro::autosizeinput::views;
|
|
|
256
308
|
}
|
|
257
309
|
|
|
258
310
|
- (void)prepareForRecycle {
|
|
311
|
+
[self notifyOnDropView];
|
|
259
312
|
[super prepareForRecycle];
|
|
260
313
|
AutoSizeInput::HybridAutoSizeInputSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
261
314
|
swiftPart.maybePrepareForRecycle();
|
|
@@ -263,8 +316,7 @@ using namespace margelo::nitro::autosizeinput::views;
|
|
|
263
316
|
|
|
264
317
|
#ifdef ENABLE_RCT_COMPONENT_VIEW_INVALIDATE
|
|
265
318
|
- (void)invalidate {
|
|
266
|
-
|
|
267
|
-
swiftPart.onDropView();
|
|
319
|
+
[self notifyOnDropView];
|
|
268
320
|
[super invalidate];
|
|
269
321
|
}
|
|
270
322
|
#endif
|