You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works in the meantime, though I'd still prefer being able to have separate files:
def render(%{platform_id: :swiftui} = assigns) do
# This UI renders on the iOS/Mac app
~SWIFTUI"""
<VStack>
<Text>
Hello native!
</Text>
</VStack>
"""
end
def render(assigns) do
assigns
|> render_sface()
end
@noozo I had no issues doing this for the live layout:
defmoduleMyApp.Web.LayoutLivedouseSurface.ComponentuseLiveViewNative.Componentdefrender(%{platform_id: :swiftui}=assigns)do# This renders a layout for the iOS/Mac app~SWIFTUI""" <VStack> <%= @inner_content %> </VStack>"""enddefrender(assigns)do# This layout renders for the web (with Surface)
~F"""
<div
id="layout_live"
[...]
Activity
mayel commentedon Sep 17, 2023
So gave it a shot and the good news is that it mostly works! :)
Surface and LiveViewNative happily live side by side in components and views. E.g.:
The only thing that doesn't seem to work is collocating
.sfaceand LVN files as I mentioned above and documented here: https://hexdocs.pm/live_view_native/render-patterns.html#external-template-filesThis works in the meantime, though I'd still prefer being able to have separate files:
mayel commentedon Sep 17, 2023
This seems the relevant code in Surface: https://github.com/surface-ui/surface/blob/v0.11.0/lib/surface/renderer.ex
And in LVN:
I'm happy to give it a go, though some guidance on how to best integrate them would be helpful!
noozo commentedon Oct 13, 2023
i think it mostly works, the main issue RN is layouts, me thinks.
mayel commentedon Oct 13, 2023
@noozo I had no issues doing this for the live layout:
mayel commentedon Dec 21, 2023
With the LiveViewNative 0.2 beta, there's a PR to get layouts working: liveview-native/live_view_native#108