@dongsuo/react-native-uitextview 1.0.3 → 1.0.4
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/ios/RNUITextView.mm +21 -9
- package/package.json +1 -1
package/ios/RNUITextView.mm
CHANGED
|
@@ -192,16 +192,28 @@ static inline NSString *_Nullable RNStringFromStdString(const std::string &value
|
|
|
192
192
|
}
|
|
193
193
|
if (newViewProps.customMenuItems.size() > 0) {
|
|
194
194
|
NSMutableArray<NSDictionary *> *items = [NSMutableArray array];
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
195
|
+
try {
|
|
196
|
+
for (const auto &item : newViewProps.customMenuItems) {
|
|
197
|
+
try {
|
|
198
|
+
NSString *title = RNStringFromStdString(item.title);
|
|
199
|
+
NSString *actionId = RNStringFromStdString(item.actionId);
|
|
200
|
+
|
|
201
|
+
if (title.length == 0 || actionId.length == 0) {
|
|
202
|
+
NSLog(@"[RNUITextView] Skipping invalid custom menu item (title length: %lu, actionId length: %lu)", (unsigned long)title.length, (unsigned long)actionId.length);
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
[items addObject:@{ @"title": title, @"actionId": actionId }];
|
|
207
|
+
} catch (const std::exception &e) {
|
|
208
|
+
NSLog(@"[RNUITextView] C++ exception processing custom menu item: %s", e.what());
|
|
209
|
+
} catch (...) {
|
|
210
|
+
NSLog(@"[RNUITextView] Unknown exception processing custom menu item");
|
|
211
|
+
}
|
|
202
212
|
}
|
|
203
|
-
|
|
204
|
-
[
|
|
213
|
+
} catch (const std::exception &e) {
|
|
214
|
+
NSLog(@"[RNUITextView] C++ exception iterating custom menu items: %s", e.what());
|
|
215
|
+
} catch (...) {
|
|
216
|
+
NSLog(@"[RNUITextView] Unknown exception iterating custom menu items");
|
|
205
217
|
}
|
|
206
218
|
|
|
207
219
|
self.customMenuItems = items.count > 0 ? items : nil;
|