Giter VIP home page Giter VIP logo

Comments (2)

nikosdouvlis avatar nikosdouvlis commented on May 28, 2024

A little update on this. I was having the same issue and after looking into it I found out that on ipads the activity view controller is presented as a popover.

It needs either a sourceView and a sourceRect or a barButtonItem so it know where it should open from.

It seems that the sourceRect is not being set for the popoverPresentationController

I don't have time to test it right now, but you can try patching the Plugin.swift with:

(around line 23)

        try dataObj.write(to: tmpUrl)            
        let capacitorView = self.bridge.viewController.view
        let activityVC = UIActivityViewController(activityItems: [tmpUrl], applicationActivities: nil)
        
        // on iphones the activityVC is presented modally
        // on ipads its presented as a popover
        // it needs a sourceView and a sourceRect which is a bounds (coordinates)
        // from where the controller opens. If we dont provide the sourceRect the popover opens
        // next to the view (outside) breaking the contraints
        activityVC.popoverPresentationController?.sourceView = capacitorView
        activityVC.popoverPresentationController?.sourceRect = CGRect(x: capacitorView?.center.x ?? 0, y: capacitorView?.bounds.size.height ?? 0, width: 0, height: 0)
    
        
        DispatchQueue.main.async {
            self.bridge.viewController.present(activityVC, animated: true, completion: { call.resolve() })
        }

Its not a perfect solution since this always makes the popover to appear from the same spot (bottom of the screen, on the middle) but it should be working

from capacitor-filesharer.

moberwasserlechner avatar moberwasserlechner commented on May 28, 2024

@nikosdouvlis Thx for looking into it.

from capacitor-filesharer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.