Build error
nandorojo opened this issue · comments
Problem
Versions
This bug happens on react-native-ios-utilities@4.3.0
and react-native-ios-context-menu@2.3.2
.
Workaround
This patch file fixes it, courtesy of @EvanBacon. However, I'm not sure if this is the real solution or not:
diff --git a/node_modules/react-native-ios-context-menu/ios/Sources/Common/AutoLayoutWrapperView.swift b/node_modules/react-native-ios-context-menu/ios/Sources/Common/AutoLayoutWrapperView.swift
index e2b9be9..ef6a008 100644
--- a/node_modules/react-native-ios-context-menu/ios/Sources/Common/AutoLayoutWrapperView.swift
+++ b/node_modules/react-native-ios-context-menu/ios/Sources/Common/AutoLayoutWrapperView.swift
@@ -18,7 +18,11 @@ class AutoLayoutWrapperView: UIView {
override func addSubview(_ view: UIView) {
if let detachedView = view as? RNIDetachedView {
- detachedView.updateBounds(newSize: self.bounds.size);
+ do {
+ try detachedView.updateBounds(newSize: self.bounds.size);
+ } catch {
+ print("Error: \(error)");
+ };
};
super.addSubview(view);
@@ -37,7 +41,11 @@ class AutoLayoutWrapperView: UIView {
func updateSizeOfSubviews(newSize: CGSize? = nil){
self.subviews.forEach {
guard let detachedView = $0 as? RNIDetachedView else { return };
- detachedView.updateBounds(newSize: newSize ?? self.bounds.size);
+ do {
+ try detachedView.updateBounds(newSize: newSize ?? self.bounds.size);
+ } catch {
+ print("Error: \(error)");
+ };
};
};
};
diff --git a/node_modules/react-native-ios-context-menu/ios/Sources/RNIContextMenuView/RNIContextMenuPreviewController.swift b/node_modules/react-native-ios-context-menu/ios/Sources/RNIContextMenuView/RNIContextMenuPreviewController.swift
index 2b4dc62..7c8472e 100644
--- a/node_modules/react-native-ios-context-menu/ios/Sources/RNIContextMenuView/RNIContextMenuPreviewController.swift
+++ b/node_modules/react-native-ios-context-menu/ios/Sources/RNIContextMenuView/RNIContextMenuPreviewController.swift
@@ -63,7 +63,11 @@ class RNIContextMenuPreviewController: UIViewController {
case .STRETCH:
guard let menuCustomPreviewView = self.menuCustomPreviewView else { return };
- menuCustomPreviewView.updateBounds(newSize: self.view.bounds.size);
+ do {
+ try menuCustomPreviewView.updateBounds(newSize: self.view.bounds.size);
+ } catch {
+ print("Error: \(error)");
+ };
self.preferredContentSize = .zero;
case .INHERIT:
diff --git a/node_modules/react-native-ios-context-menu/ios/Sources/RNIContextMenuView/RNIContextMenuView.swift b/node_modules/react-native-ios-context-menu/ios/Sources/RNIContextMenuView/RNIContextMenuView.swift
index affabcd..7c47022 100644
--- a/node_modules/react-native-ios-context-menu/ios/Sources/RNIContextMenuView/RNIContextMenuView.swift
+++ b/node_modules/react-native-ios-context-menu/ios/Sources/RNIContextMenuView/RNIContextMenuView.swift
@@ -307,7 +307,11 @@ public class RNIContextMenuView:
.init(with: detachedView)
);
- detachedView.detach();
+ do {
+ try detachedView.detach();
+ } catch {
+ print("Error: \(error)");
+ };
};
#if DEBUG
I can confirm that react-native-ios-context-menu
v2.4.0 has fixed this build issue.
Fixed in 2.4.0