View Source LiveViewNative.LiveView (live_view_native v0.4.0-rc.0)
Use this module within a LiveView to delegate rendering requests from a native client to a format specific rendering component.
All event handling should remain in the LiveView, all rendering concerns for a given format will be delegated to the component.
Please refer to LiveViewNative.Component
for more information
on rendering components.
Summary
Functions
Uses LiveView Native in the current module for rendering delegation
Functions
Uses LiveView Native in the current module for rendering delegation
defmodule MyAppWeb.HomeLive do
use MyAppWeb, :live_view
use LiveViewNative.LiveView,
formats: [:swiftui, :jetpack],
layouts: [
swiftui: {MyAppWeb.Layouts.SwiftUI, :app},
jetpack: {MyAppWeb.Layouts.Jetpack, :app}
],
dispatch_to: &Module.concat/2
end
Options
:formats
- the formats this LiveView will delegate to a render component. For example, specifyingformats: [:swiftui, jetpack]
for a LiveView namedMyAppWeb.HomeLive
will invokeMyAppWeb.HomeLive.SwiftUI
andMyAppWeb.HomeLivew.Jetpack
when respectively rendering each format. The appended module suffix is taken from the:module_suffix
value on each registered LiveView Native plugin.:layouts
- which layouts to render for each format, for example:[swiftui: {MyAppWeb.Layouts.SwiftUI, :app}]
:dispatch_to
- a function that takes the parent LiveView module and the format'splugin.module_suffix
and will determine which module therender/1
function will be called on