|
diff --git a/plugin/swift/ShareExtensionViewController.swift b/plugin/swift/ShareExtensionViewController.swift |
|
index fe2403a671cc0fc88faa2ac74be2d030be51e69a..a346ddfa4bc6ded0768e124b95de7306e0dc597d 100644 |
|
--- a/plugin/swift/ShareExtensionViewController.swift |
|
+++ b/plugin/swift/ShareExtensionViewController.swift |
|
@@ -47,6 +47,16 @@ class ShareExtensionViewController: UIViewController { |
|
|
|
override func viewDidLoad() { |
|
super.viewDidLoad() |
|
+ |
|
+ // Set preferred size for the share extension modal |
|
+ let screenHeight = UIScreen.main.bounds.height |
|
+ let modalHeight = screenHeight * 0.7 // 70% of screen height |
|
+ self.preferredContentSize = CGSize(width: UIScreen.main.bounds.width, height: modalHeight) |
|
+ |
|
+ // Make root view transparent |
|
+ self.view.backgroundColor = .clear |
|
+ self.view.isOpaque = false |
|
+ |
|
setupLoadingIndicator() |
|
|
|
// Set the contentScaleFactor for the main view of this view controller |
|
@@ -113,18 +123,19 @@ class ShareExtensionViewController: UIViewController { |
|
// Set the content scale factor for the new view (the React Native view) BEFORE setting frame and assigning |
|
reactNativeRootView.contentScaleFactor = currentScale |
|
|
|
- // Set the frame of the React Native view to fill the bounds of the original view |
|
- reactNativeRootView.frame = currentBounds |
|
- |
|
- |
|
+ // Set background color and corner radius for the React Native view |
|
+ reactNativeRootView.backgroundColor = .white |
|
+ reactNativeRootView.layer.cornerRadius = 10 |
|
+ reactNativeRootView.clipsToBounds = true |
|
+ |
|
view.addSubview(reactNativeRootView) |
|
|
|
- // Ensure the React Native root view fills its parent (self.view) |
|
+ // Update constraints to respect the modal height |
|
reactNativeRootView.translatesAutoresizingMaskIntoConstraints = false |
|
NSLayoutConstraint.activate([ |
|
- reactNativeRootView.topAnchor.constraint(equalTo: self.view.topAnchor), |
|
- reactNativeRootView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), |
|
- reactNativeRootView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor), |
|
+ reactNativeRootView.centerXAnchor.constraint(equalTo: self.view.centerXAnchor), |
|
+ reactNativeRootView.widthAnchor.constraint(equalTo: self.view.widthAnchor), |
|
+ reactNativeRootView.heightAnchor.constraint(equalToConstant: self.preferredContentSize.height), |
|
reactNativeRootView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor) |
|
]) |
|
|