The socket struct passed through all Dala.Screen and Dala.Component callbacks.
Holds two things:
assigns— the public data map yourrender/1function reads from@assigns__dala__— internal Dala metadata (screen module, platform, view refs, nav stack)
You interact with a socket via assign/2 and assign/3. Never mutate __dala__
directly — it is an internal contract.
Summary
Functions
Assign multiple key/value pairs at once from a keyword list or map.
Assign a single key/value pair into the socket's assigns.
Check if any of the given keys have changed since last render.
Create a new socket for the given screen module.
Pop the current screen, returning to the previous one.
Pop the stack until the screen registered under dest is at the top.
Pop to the root of the current navigation stack.
Push a new screen onto the navigation stack.
Store the root view ref returned by the renderer into __dala__.root_view.
Called internally after the initial render.
Replace the entire navigation stack with a single new screen.
Switch to the named tab in a tab_bar or drawer layout.
Types
Functions
Assign multiple key/value pairs at once from a keyword list or map.
socket = assign(socket, count: 0, name: "test")
socket = assign(socket, %{count: 0})
Assign a single key/value pair into the socket's assigns.
socket = assign(socket, :count, 0)
Check if any of the given keys have changed since last render.
if Socket.changed?(socket, [:count, :name]) do
# Re-render needed
end
Create a new socket for the given screen module.
Options:
:platform—:android(default) or:ios
Pop the current screen, returning to the previous one.
No-op if already at the root of the stack.
Pop the stack until the screen registered under dest is at the top.
dest is a registered atom name or module. No-op if not found in history.
Pop to the root of the current navigation stack.
Push a new screen onto the navigation stack.
dest is either a registered atom name (e.g. :counter) or a screen module
(e.g. dalaDemo.CounterScreen). params are passed to the new screen's
mount/3 as the first argument.
The push is applied after the current callback returns — do_render in
Dala.Screen detects the nav_action and mounts the new module.
Store the root view ref returned by the renderer into __dala__.root_view.
Called internally after the initial render.
Replace the entire navigation stack with a single new screen.
Used for auth transitions (post-login → home with no back button to login).
Switch to the named tab in a tab_bar or drawer layout.