score:1

Accepted answer

as of now, the best way to do this is using the electron platform.

score:3

the question is not recent, but i found it searching for this topic and there is a recent relevant update: with the new desktop efforts from microsoft, this is now feasible, although still tricky.

credits to ospfranco for the great work.


the only way to do it is by editing your appdelegate class and initialize the status button label and its popover content with the root view content from the react native application. it's also possible to customize its size, appearance and the button at the bar, but only in swift code.

func applicationdidfinishlaunching(_ anotification: notification) {
    let jscodelocation: url

    jscodelocation = rctbundleurlprovider.sharedsettings().jsbundleurl(forbundleroot: "index", fallbackresource:nil)
    let rootview = rctrootview(bundleurl: jscodelocation, modulename: "tempomat", initialproperties: nil, launchoptions: nil)
    let rootviewcontroller = nsviewcontroller()
    rootviewcontroller.view = rootview

    popover = nspopover()

    popover.contentsize = nssize(width: 700, height: 800)
    popover.animates = true
    popover.behavior = .transient
    popover.contentviewcontroller = rootviewcontroller

    statusbaritem = nsstatusbar.system.statusitem(withlength: cgfloat(60))

    if let button = self.statusbaritem.button {
        button.action = #selector(togglepopover(_:))
      button.title = "tempomat"
    }

  }

references:


Related Query

More Query from same tag