liveview-native / live_view_native

A framework for building native applications with Phoenix LiveView
https://native.live/
MIT License
593 stars 23 forks source link

support phoenix_root_layout without "html" #108

Closed mayel closed 7 months ago

mayel commented 9 months ago

resolves an issue with the swift rendered inside the html template

mayel commented 9 months ago

even with this fix, I need to add <csrf-token value={Phoenix.Controller.get_csrf_token()} /> to my SWIFTUI code otherwise I'm back to the connection error in #107 because it's not being included in the root layout, seems its this condition not matching in LiveViewNative.Layouts: is_root_template? = "#{func_name}" == "root_#{platform.platform_id}"

mayel commented 8 months ago

any word on this to avoid the HTML layout being rendered when native one is expected? 🙏

bcardarella commented 7 months ago

@mayel sorry I didn't respond sooner. v0.3.0 is nearing a beta release and we'll have instructions for setting up your app. This PR is resolved with this release as you can now set your own root in your Router:

plug :put_root_layout,
      html: {LvnWorkshopWeb.Layouts, :root},
      swiftui: {LvnWorkshopWeb.Layouts.SwiftUI, :root}

Thanks for the contribution, sorry it didn't make it in!